CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_search_HitQueue_ 00008 #define _lucene_search_HitQueue_ 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #include "SearchHeader.h" 00015 00016 CL_NS_DEF(search) 00017 00018 00022 class HitQueue: LUCENE_BASE { 00023 private: 00024 ScoreDoc* heap; 00025 size_t _size; 00026 size_t maxSize; 00027 00028 void upHeap(); 00029 void downHeap(); 00030 00031 protected: 00032 bool lessThan(struct ScoreDoc& hitA, struct ScoreDoc& hitB); 00033 00034 public: 00035 void adjustTop(); 00036 struct ScoreDoc& top(); 00037 void put(struct ScoreDoc& element); 00038 ScoreDoc pop(); 00045 bool insert(struct ScoreDoc& element); 00049 size_t size(); 00050 HitQueue(const int32_t maxSize); 00051 ~HitQueue(); 00052 00053 }; 00054 CL_NS_END 00055 #endif