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

ByteBlockPool.h
Go to the documentation of this file.
1 // 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 BYTEBLOCKPOOL_H
8 #define BYTEBLOCKPOOL_H
9
10 #include "LuceneObject.h"
11
12 namespace Lucene {
13
23 class LPPAPI ByteBlockPool : public LuceneObject {
24 public:
25 ByteBlockPool(const ByteBlockPoolAllocatorBasePtr& allocator, bool trackAllocations);
26 virtual ~ByteBlockPool();
27
28 LUCENE_CLASS(ByteBlockPool);
29
30 public:
31 Collection<ByteArray> buffers;
32 int32_t bufferUpto; // Which buffer we are up to
33 int32_t byteUpto; // Where we are in head buffer
34
35 ByteArray buffer;
36 int32_t byteOffset;
37
38 static const int32_t nextLevelArray[];
39 static const int32_t levelSizeArray[];
40
41 protected:
42 bool trackAllocations;
43 ByteBlockPoolAllocatorBasePtr allocator;
44
45 public:
46 static int32_t FIRST_LEVEL_SIZE();
47
48 void reset();
49 void nextBuffer();
50 int32_t newSlice(int32_t size);
51 int32_t allocSlice(ByteArray slice, int32_t upto);
52 };
53
54 class LPPAPI ByteBlockPoolAllocatorBase : public LuceneObject {
55 public:
56 virtual ~ByteBlockPoolAllocatorBase();
57
58 LUCENE_CLASS(ByteBlockPoolAllocatorBase);
59
60 public:
61 virtual void recycleByteBlocks(Collection<ByteArray> blocks, int32_t start, int32_t end) = 0;
62 virtual void recycleByteBlocks(Collection<ByteArray> blocks) = 0;
63 virtual ByteArray getByteBlock(bool trackAllocations) = 0;
64 };
65
66 }
67
68 #endif
LuceneObject.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::ByteBlockPoolAllocatorBase
Definition: ByteBlockPool.h:54
Lucene::ByteBlockPoolAllocatorBase::recycleByteBlocks
virtual void recycleByteBlocks(Collection< ByteArray > blocks)=0
Lucene::ByteBlockPoolAllocatorBase::getByteBlock
virtual ByteArray getByteBlock(bool trackAllocations)=0
Lucene::ByteBlockPoolAllocatorBase::recycleByteBlocks
virtual void recycleByteBlocks(Collection< ByteArray > blocks, int32_t start, int32_t end)=0
Lucene::ByteBlockPoolAllocatorBase::~ByteBlockPoolAllocatorBase
virtual ~ByteBlockPoolAllocatorBase()
Lucene::ByteBlockPool
Class that Posting and PostingVector use to write byte streams into shared fixed-size byte[] arrays....
Definition: ByteBlockPool.h:23
Lucene::ByteBlockPool::newSlice
int32_t newSlice(int32_t size)
Lucene::ByteBlockPool::nextBuffer
void nextBuffer()
Lucene::ByteBlockPool::~ByteBlockPool
virtual ~ByteBlockPool()
Lucene::ByteBlockPool::trackAllocations
bool trackAllocations
Definition: ByteBlockPool.h:42
Lucene::ByteBlockPool::buffers
Collection< ByteArray > buffers
Definition: ByteBlockPool.h:28
Lucene::ByteBlockPool::byteOffset
int32_t byteOffset
Definition: ByteBlockPool.h:36
Lucene::ByteBlockPool::reset
void reset()
Lucene::ByteBlockPool::byteUpto
int32_t byteUpto
Definition: ByteBlockPool.h:33
Lucene::ByteBlockPool::bufferUpto
int32_t bufferUpto
Definition: ByteBlockPool.h:32
Lucene::ByteBlockPool::ByteBlockPool
ByteBlockPool(const ByteBlockPoolAllocatorBasePtr &allocator, bool trackAllocations)
Lucene::ByteBlockPool::allocator
ByteBlockPoolAllocatorBasePtr allocator
Definition: ByteBlockPool.h:43
Lucene::ByteBlockPool::FIRST_LEVEL_SIZE
static int32_t FIRST_LEVEL_SIZE()
Lucene::ByteBlockPool::allocSlice
int32_t allocSlice(ByteArray slice, int32_t upto)
Lucene::ByteBlockPool::buffer
ByteArray buffer
Definition: ByteBlockPool.h:35
Lucene::Collection< ByteArray >
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::ByteBlockPoolAllocatorBasePtr
boost::shared_ptr< ByteBlockPoolAllocatorBase > ByteBlockPoolAllocatorBasePtr
Definition: LuceneTypes.h:90

clucene.sourceforge.net