Fennel: SparseBitmap Class Reference (original) (raw)
SparseBitmap is an example of how to create a page-based persistent data structure using Fennel. More...
| Public Member Functions | |
|---|---|
| SparseBitmap (fennel::SegmentAccessor segmentAccessor, fennel::PageId dirPageId=fennel::NULL_PAGE_ID) | |
| Creates a new empty sparse bitmap (or loads an existing one). | |
| virtual | ~SparseBitmap () |
| Sparse bitmap destructor. | |
| bool | getBit (SparseBitmapOffset iOffset) |
| Reads a bit from the bitmap. | |
| void | setBit (SparseBitmapOffset iOffset, bool value) |
| Writes a bit in the bitmap. | |
| fennel::PageId | getDirPageId () const |
| **Returns:**the location of the directory node for this bitmap | |
| size_t | getBitsPerLeaf () const |
| **Returns:**number of bits contained by each leaf node | |
| size_t | getMaxDirectoryEntries () const |
| **Returns:**maximum number of entries which can be contained by the directory node | |
| Private Member Functions | |
| fennel::PageId | searchDirectory (SparseBitmapDirLock &dirLock, SparseBitmapOffset iLeafStartOffset) |
| Looks up a leaf node (based on its start offset) in the directory. | |
| Private Attributes | |
| fennel::SegmentAccessor | segmentAccessor |
| Accessor for the segment storing the bitmap node pages. | |
| fennel::PageId | dirPageId |
| Location of bitmap directory node. | |
| size_t | nBitsPerLeaf |
| Number of bits contained by each leaf node; this is fixed based on segment page size after headers and footers have been subtracted off. | |
| size_t | nDirEntriesMax |
| Maximum number of entries which can be contained by the directory node; this is fixed based on segment page size after headers and footers have been subtracted off, and determines the total number of leaf pages which can be allocated. |
Detailed Description
SparseBitmap is an example of how to create a page-based persistent data structure using Fennel.
It is only intended for educational purposes, not for real use.
Definition at line 142 of file SparseBitmapTest.cpp.
Constructor & Destructor Documentation
| SparseBitmap::SparseBitmap | ( | fennel::SegmentAccessor | segmentAccessor, |
|---|---|---|---|
| fennel::PageId | dirPageId = fennel::NULL_PAGE_ID | ||
| ) | [explicit] |
| SparseBitmap::~SparseBitmap | ( | | ) | [virtual] | | ---------------------------- | - | | - | ----------- |
Member Function Documentation
Writes a bit in the bitmap.
Parameters:
| iOffset | address of bit to write |
|---|---|
| value | true to set bit; false to clear bit |
Definition at line 328 of file SparseBitmapTest.cpp.
References ANON_PAGE_OWNER_ID, dirPageId, SparseBitmapLeaf::getBytesForWrite(), SparseBitmapDirectory::getEntriesForWrite(), SparseBitmapDirEntry::iLeafStartOffset, SparseBitmapLeaf::iStartOffset, SparseBitmapDirEntry::leafId, nBitsPerLeaf, nDirEntriesMax, SparseBitmapDirectory::nEntries, NULL_PAGE_ID, searchDirectory(), and segmentAccessor.
Referenced by SparseBitmapTest::testBasic(), SparseBitmapTest::testFullDirectory(), and SparseBitmapTest::testSpread().
| fennel::PageId SparseBitmap::getDirPageId | ( | | ) | const | | ----------------------------------------- | - | | - | ----- |
| size_t SparseBitmap::getBitsPerLeaf | ( | | ) | const | | ------------------------------------ | - | | - | ----- |
| size_t SparseBitmap::getMaxDirectoryEntries | ( | | ) | const | | -------------------------------------------- | - | | - | ----- |
Member Data Documentation
Maximum number of entries which can be contained by the directory node; this is fixed based on segment page size after headers and footers have been subtracted off, and determines the total number of leaf pages which can be allocated.
Definition at line 167 of file SparseBitmapTest.cpp.
Referenced by getMaxDirectoryEntries(), setBit(), and SparseBitmap().
The documentation for this class was generated from the following file:
- /home/pub/open/dev/fennel/test/SparseBitmapTest.cpp
