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
MultiLevelSkipListReader.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 MULTILEVELSKIPLISTREADER_H
8 #define MULTILEVELSKIPLISTREADER_H
9
10 #include "IndexInput.h"
11
12 namespace Lucene
13 {
20 class MultiLevelSkipListReader : public LuceneObject
21 {
22 public:
23 MultiLevelSkipListReader(IndexInputPtr skipStream, int32_t maxSkipLevels, int32_t skipInterval);
24 virtual ~MultiLevelSkipListReader();
25
26 LUCENE_CLASS(MultiLevelSkipListReader);
27
28 protected:
30 int32_t maxNumberOfSkipLevels;
31
33 int32_t numberOfSkipLevels;
34
39 int32_t numberOfLevelsToBuffer;
40
41 int32_t docCount;
42 bool haveSkipped;
43
44 Collection<IndexInputPtr> skipStream; // skipStream for each level
45 Collection<int64_t> skipPointer; // the start pointer of each skip level
46 Collection<int32_t> skipInterval; // skipInterval of each level
47 Collection<int32_t> numSkipped; // number of docs skipped per level
48
49 Collection<int32_t> skipDoc; // doc id of current skip entry per level
50 int32_t lastDoc; // doc id of last read skip entry with docId <= target
51 Collection<int64_t> childPointer; // child pointer of current skip entry per level
52 int64_t lastChildPointer; // childPointer of last read skip entry with docId <= target
53
54 bool inputIsBuffered;
55
56 public:
58 virtual int32_t getDoc();
59
62 virtual int32_t skipTo(int32_t target);
63
64 virtual void close();
65
67 virtual void init(int64_t skipPointer, int32_t df);
68
69 protected:
70 virtual bool loadNextSkip(int32_t level);
71
73 virtual void seekChild(int32_t level);
74
76 virtual void loadSkipLevels();
77
82 virtual int32_t readSkipData(int32_t level, IndexInputPtr skipStream) = 0;
83
85 virtual void setLastSkipData(int32_t level);
86 };
87
89 class SkipBuffer : public IndexInput
90 {
91 public:
92 SkipBuffer(IndexInputPtr input, int32_t length);
93 virtual ~SkipBuffer();
94
95 LUCENE_CLASS(SkipBuffer);
96
97 protected:
98 ByteArray data;
99 int64_t pointer;
100 int32_t pos;
101
102 public:
104 virtual void close();
105
107 virtual int64_t getFilePointer();
108
110 virtual int64_t length();
111
113 virtual uint8_t readByte();
114
116 virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
117
119 virtual void seek(int64_t pos);
120 };
121 }
122
123 #endif

clucene.sourceforge.net