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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MultiLevelSkipListReader.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 MULTILEVELSKIPLISTREADER_H
8 #define MULTILEVELSKIPLISTREADER_H
9 
10 #include "IndexInput.h"
11 
12 namespace Lucene {
13 
21 public:
22  MultiLevelSkipListReader(const IndexInputPtr& skipStream, int32_t maxSkipLevels, int32_t skipInterval);
23  virtual ~MultiLevelSkipListReader();
24 
26 
27 protected:
29  int32_t maxNumberOfSkipLevels;
30 
33 
39 
40  int32_t docCount;
42 
43  Collection<IndexInputPtr> skipStream; // skipStream for each level
44  Collection<int64_t> skipPointer; // the start pointer of each skip level
45  Collection<int32_t> skipInterval; // skipInterval of each level
46  Collection<int32_t> numSkipped; // number of docs skipped per level
47 
48  Collection<int32_t> skipDoc; // doc id of current skip entry per level
49  int32_t lastDoc; // doc id of last read skip entry with docId <= target
50  Collection<int64_t> childPointer; // child pointer of current skip entry per level
51  int64_t lastChildPointer; // childPointer of last read skip entry with docId <= target
52 
54 
55 public:
57  virtual int32_t getDoc();
58 
61  virtual int32_t skipTo(int32_t target);
62 
63  virtual void close();
64 
66  virtual void init(int64_t skipPointer, int32_t df);
67 
68 protected:
69  virtual bool loadNextSkip(int32_t level);
70 
72  virtual void seekChild(int32_t level);
73 
75  virtual void loadSkipLevels();
76 
81  virtual int32_t readSkipData(int32_t level, const IndexInputPtr& skipStream) = 0;
82 
84  virtual void setLastSkipData(int32_t level);
85 };
86 
88 class SkipBuffer : public IndexInput {
89 public:
90  SkipBuffer(const IndexInputPtr& input, int32_t length);
91  virtual ~SkipBuffer();
92 
94 
95 protected:
96  ByteArray data;
97  int64_t pointer;
98  int32_t pos;
99 
100 public:
102  virtual void close();
103 
105  virtual int64_t getFilePointer();
106 
108  virtual int64_t length();
109 
111  virtual uint8_t readByte();
112 
114  virtual void readBytes(uint8_t* b, int32_t offset, int32_t length);
115 
117  virtual void seek(int64_t pos);
118 };
119 
120 }
121 
122 #endif

clucene.sourceforge.net