Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HitQueueBase.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef HITQUEUEBASE_H
8 #define HITQUEUEBASE_H
9 
10 #include "PriorityQueue.h"
11 
12 namespace Lucene {
13 
14 class LPPAPI HitQueueBase : public LuceneObject {
15 public:
16  HitQueueBase(int32_t size);
17  virtual ~HitQueueBase();
18 
20 
21 public:
22  virtual ScoreDocPtr add(const ScoreDocPtr& scoreDoc);
23  virtual ScoreDocPtr addOverflow(const ScoreDocPtr& scoreDoc);
24  virtual ScoreDocPtr top();
25  virtual ScoreDocPtr pop();
26  virtual ScoreDocPtr updateTop();
27  virtual int32_t size();
28  virtual bool empty();
29  virtual void clear();
30 
31 protected:
33  int32_t queueSize;
34 
35 public:
36  virtual void initialize();
37 
38 protected:
39  virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second) = 0;
40  virtual ScoreDocPtr getSentinelObject();
41 
42  friend class PriorityQueueScoreDocs;
43 };
44 
45 class LPPAPI PriorityQueueScoreDocs : public PriorityQueue<ScoreDocPtr> {
46 public:
47  PriorityQueueScoreDocs(const HitQueueBasePtr& hitQueue, int32_t size);
48  virtual ~PriorityQueueScoreDocs();
49 
51 
52 protected:
53  HitQueueBaseWeakPtr _hitQueue;
54 
55 protected:
56  virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second);
57  virtual ScoreDocPtr getSentinelObject();
58 };
59 
60 }
61 
62 #endif

clucene.sourceforge.net