ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
BitBuffer Class Reference


A bit buffer using dynamic allocation.

See also
Two alternatives are provided with BitBufferMA , which uses monotonic allocation and BitBufferLocal , which uses local (stack) memory.

Definition at line 478 of file bitbuffer.hpp.

#include <bitbuffer.hpp>

Inheritance diagram for BitBuffer:
Collaboration diagram for BitBuffer:

Public Method Index:

 BitBuffer (uinteger initialCapacity)
virtual uinteger Capacity () const override
virtual bool EnsureCapacity (uinteger bitsRequired, BitBufferBase::Index idx) override
- Public Method Index: inherited from BitBufferBase
 BitBufferBase () noexcept
virtual ~BitBufferBase ()
char * CharStream (Index idx=Index(0, 0))
TStorageData () 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)

Additional Inherited Members

- Public Type Index: inherited from BitBufferBase
using TStorage = unsigned int

Field Details:

◆ storage

std::vector<TStorage> storage

The vector that holds the data.

Definition at line 482 of file bitbuffer.hpp.

Constructor(s) / Destructor Details::

◆ BitBuffer()

BitBuffer ( uinteger initialCapacity)


initialCapacityThe requested initial capacity of the buffer in bits.

Definition at line 489 of file bitbuffer.hpp.

Here is the call graph for this function:

Method Details:

◆ Capacity()

virtual uinteger Capacity ( ) const

Returns the (currently allocated) capacity.

The size of the internal storage in bits.

Implements BitBufferBase.

Definition at line 498 of file bitbuffer.hpp.

◆ EnsureCapacity()

virtual bool EnsureCapacity ( uinteger bitsRequired,
BitBufferBase::Index idx )

Checks if the given required storage space is internally reserved. If not, the internal capacity is doubled, or, if more is required, set to the required space.

bitsRequiredThe number of bits required.
idxThe index of current buffer use.
true if the space is available or could be made available, false otherwise.

Implements BitBufferBase.

Definition at line 512 of file bitbuffer.hpp.

Here is the call graph for this function:

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