#include <bitbuffer.hpp>
A bit buffer using local storage, which means a fixed size internal array. If used as function member, the storage is located on the stack and hence its size has platform-specific limitations.
This class is useful to read and write smaller pieces of data, for example header information of binary data files which furthermore are filled/loaded with bit buffers using of other memory allocations.
TCapacity | The number of bits to reserve internally |
Definition at line 619 of file bitbuffer.hpp.
Public Methods | |
BitBufferLocal () noexcept | |
virtual uinteger | Capacity () const override |
virtual bool | EnsureCapacity (uinteger bitsRequired, BitBufferBase::Index idx) override |
![]() | |
BitBufferBase () noexcept | |
virtual | ~BitBufferBase () |
char * | CharStream (Index idx=Index(0, 0)) |
TStorage * | Data () const |
ALIB_API void | FromLittleEndianEncoding (const Index &startIndex, const Index &endIndex) |
TStorage | GetWord (const Index &index) const |
uinteger | RemainingSize (const Index &idx) const |
void | SetWord (const Index &index, TStorage value) |
ALIB_API Index | Terminate (Index writerIndex) |
ALIB_API void | ToLittleEndianEncoding (const Index &startIndex, const Index &endIndex) |
ALIB_API Index | Unterminate (Index terminationIndex) |
Protected Fields | |
TStorage | storage [(TCapacity+(sizeof(TStorage) *8 -1))/(sizeof(TStorage) *8)] |
![]() | |
TStorage * | data |
Additional Inherited Members | |
![]() | |
using | TStorage = unsigned int |
|
inlinenoexcept |
|
inlineoverridevirtual |
Returns the (in this case fixed size!) capacity.
Implements BitBufferBase.
Definition at line 639 of file bitbuffer.hpp.
|
inlineoverridevirtual |
Checks if the given required storage space is internally reserved. If not, in debug compilations, an ALib assertion is raised, as this is a fixed size buffer.
bitsRequired | The number of bits required. |
idx | The index of current buffer use. |
true
if the the space is available or could be made available, false
otherwise. Implements BitBufferBase.
Definition at line 654 of file bitbuffer.hpp.
The array that holds the data.
Definition at line 624 of file bitbuffer.hpp.