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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HitQueueBase.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 {
16 public:
17 HitQueueBase(int32_t size);
18 virtual ~HitQueueBase();
19
20 LUCENE_CLASS(HitQueueBase);
21
22 public:
23 virtual ScoreDocPtr add(ScoreDocPtr scoreDoc);
24 virtual ScoreDocPtr addOverflow(ScoreDocPtr scoreDoc);
25 virtual ScoreDocPtr top();
26 virtual ScoreDocPtr pop();
27 virtual ScoreDocPtr updateTop();
28 virtual int32_t size();
29 virtual bool empty();
30 virtual void clear();
31
32 protected:
33 PriorityQueueScoreDocsPtr queue;
34 int32_t queueSize;
35
36 public:
37 virtual void initialize();
38
39 protected:
40 virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second) = 0;
41 virtual ScoreDocPtr getSentinelObject();
42
43 friend class PriorityQueueScoreDocs;
44 };
45
46 class LPPAPI PriorityQueueScoreDocs : public PriorityQueue<ScoreDocPtr>
47 {
48 public:
49 PriorityQueueScoreDocs(HitQueueBasePtr hitQueue, int32_t size);
50 virtual ~PriorityQueueScoreDocs();
51
52 LUCENE_CLASS(PriorityQueueScoreDocs);
53
54 protected:
55 HitQueueBaseWeakPtr _hitQueue;
56
57 protected:
58 virtual bool lessThan(const ScoreDocPtr& first, const ScoreDocPtr& second);
59 virtual ScoreDocPtr getSentinelObject();
60 };
61 }
62
63 #endif

clucene.sourceforge.net