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


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Protected Attributes
Lucene::ByteBlockPool Class Reference

Class that Posting and PostingVector use to write byte streams into shared fixed-size byte[] arrays. The idea is to allocate slices of increasing lengths. For example, the first slice is 5 bytes, the next slice is 14, etc. We start by writing our bytes into the first 5 bytes. When we hit the end of the slice, we allocate the next slice and then write the address of the new slice into the last 4 bytes of the previous slice (the "forwarding address"). More...

#include <ByteBlockPool.h>

+ Inheritance diagram for Lucene::ByteBlockPool:

Public Member Functions

 ByteBlockPool (const ByteBlockPoolAllocatorBasePtr &allocator, bool trackAllocations)
 
virtual ~ByteBlockPool ()
 
virtual String getClassName ()
 
boost::shared_ptr< ByteBlockPoolshared_from_this ()
 
void reset ()
 
void nextBuffer ()
 
int32_t newSlice (int32_t size)
 
int32_t allocSlice (ByteArray slice, int32_t upto)
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Static Public Member Functions

static String _getClassName ()
 
static int32_t FIRST_LEVEL_SIZE ()
 

Data Fields

Collection< ByteArray > buffers
 
int32_t bufferUpto
 
int32_t byteUpto
 
ByteArray buffer
 
int32_t byteOffset
 

Static Public Attributes

static const int32_t nextLevelArray []
 
static const int32_t levelSizeArray []
 

Protected Attributes

bool trackAllocations
 
ByteBlockPoolAllocatorBasePtr allocator
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Detailed Description

Class that Posting and PostingVector use to write byte streams into shared fixed-size byte[] arrays. The idea is to allocate slices of increasing lengths. For example, the first slice is 5 bytes, the next slice is 14, etc. We start by writing our bytes into the first 5 bytes. When we hit the end of the slice, we allocate the next slice and then write the address of the new slice into the last 4 bytes of the previous slice (the "forwarding address").

Each slice is filled with 0's initially, and we mark the end with a non-zero byte. This way the methods that are writing into the slice don't need to record its length and instead allocate a new slice once they hit a non-zero byte.

Constructor & Destructor Documentation

◆ ByteBlockPool()

Lucene::ByteBlockPool::ByteBlockPool ( const ByteBlockPoolAllocatorBasePtr allocator,
bool  trackAllocations 
)

◆ ~ByteBlockPool()

virtual Lucene::ByteBlockPool::~ByteBlockPool ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::ByteBlockPool::_getClassName ( )
inlinestatic

◆ allocSlice()

int32_t Lucene::ByteBlockPool::allocSlice ( ByteArray  slice,
int32_t  upto 
)

◆ FIRST_LEVEL_SIZE()

static int32_t Lucene::ByteBlockPool::FIRST_LEVEL_SIZE ( )
static

◆ getClassName()

virtual String Lucene::ByteBlockPool::getClassName ( )
inlinevirtual

◆ newSlice()

int32_t Lucene::ByteBlockPool::newSlice ( int32_t  size)

◆ nextBuffer()

void Lucene::ByteBlockPool::nextBuffer ( )

◆ reset()

void Lucene::ByteBlockPool::reset ( )

◆ shared_from_this()

boost::shared_ptr< ByteBlockPool > Lucene::ByteBlockPool::shared_from_this ( )
inline

Field Documentation

◆ allocator

ByteBlockPoolAllocatorBasePtr Lucene::ByteBlockPool::allocator
protected

◆ buffer

ByteArray Lucene::ByteBlockPool::buffer

◆ buffers

Collection<ByteArray> Lucene::ByteBlockPool::buffers

◆ bufferUpto

int32_t Lucene::ByteBlockPool::bufferUpto

◆ byteOffset

int32_t Lucene::ByteBlockPool::byteOffset

◆ byteUpto

int32_t Lucene::ByteBlockPool::byteUpto

◆ levelSizeArray

const int32_t Lucene::ByteBlockPool::levelSizeArray[]
static

◆ nextLevelArray

const int32_t Lucene::ByteBlockPool::nextLevelArray[]
static

◆ trackAllocations

bool Lucene::ByteBlockPool::trackAllocations
protected

The documentation for this class was generated from the following file:

clucene.sourceforge.net