ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
BitBufferLocal< TCapacity > Class Template Reference


template<uinteger TCapacity>
class alib::bitbuffer::BitBufferLocal< TCapacity >

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.

See also
Two alternatives are provided with BitBuffer and BitBufferMA .
Template Parameters
TCapacityThe number of bits to reserve internally

Definition at line 604 of file bitbuffer.hpp.

#include <bitbuffer.hpp>

Inheritance diagram for BitBufferLocal< TCapacity >:
Collaboration diagram for BitBufferLocal< TCapacity >:

Public Method Index:

 BitBufferLocal () noexcept
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

template<uinteger TCapacity>
TStorage storage[(TCapacity+bitsof(TStorage) - 1)/bitsof(TStorage)]

The array that holds the data.

Definition at line 608 of file bitbuffer.hpp.

Constructor(s) / Destructor Details::

◆ BitBufferLocal()

template<uinteger TCapacity>
BitBufferLocal ( )


Definition at line 614 of file bitbuffer.hpp.

Method Details:

◆ Capacity()

template<uinteger TCapacity>
virtual uinteger Capacity ( ) const

Returns the (in this case fixed size!) capacity.

The size of the internal storage in bits.

Implements BitBufferBase.

Definition at line 623 of file bitbuffer.hpp.

◆ EnsureCapacity()

template<uinteger TCapacity>
virtual bool EnsureCapacity ( uinteger bitsRequired,
BitBufferBase::Index idx )

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.

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 638 of file bitbuffer.hpp.

Here is the call graph for this function:

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