ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::bitbuffer::BitBufferLocal< TCapacity > Class Template Reference

Description:

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 548 of file bitbuffer.inl.

Inheritance diagram for alib::bitbuffer::BitBufferLocal< TCapacity >:
[legend]
Collaboration diagram for alib::bitbuffer::BitBufferLocal< TCapacity >:
[legend]

Public Method Index:

 BitBufferLocal () noexcept
 Constructor.
 
virtual uinteger Capacity () const override
 
virtual bool EnsureCapacity (uinteger bitsRequired, BitBufferBase::Index idx) override
 
- Public Method Index: inherited from alib::bitbuffer::BitBufferBase
 BitBufferBase () noexcept
 Default Constructor (the only one).
 
virtual ~BitBufferBase ()
 Virtual destructor (does nothing, needed for abstract virtual class).
 
char * CharStream (Index idx=Index(0, 0))
 
TStorageData () const
 
ALIB_DLL 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_DLL Index Terminate (Index writerIndex)
 
ALIB_DLL void ToLittleEndianEncoding (const Index &startIndex, const Index &endIndex)
 
ALIB_DLL Index Unterminate (Index terminationIndex)
 

Protected Field Index:

TStorage storage [(TCapacity+bitsof(TStorage) - 1)/bitsof(TStorage)]
 The array that holds the data.
 
- Protected Field Index: inherited from alib::bitbuffer::BitBufferBase
TStoragedata
 

Additional Inherited Members

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

Field Details:

◆ storage

template<uinteger TCapacity>
TStorage alib::bitbuffer::BitBufferLocal< TCapacity >::storage[(TCapacity+bitsof(TStorage) - 1)/bitsof(TStorage)]
protected

The array that holds the data.

Definition at line 552 of file bitbuffer.inl.

Constructor(s) / Destructor Details:

◆ BitBufferLocal()

template<uinteger TCapacity>
alib::bitbuffer::BitBufferLocal< TCapacity >::BitBufferLocal ( )
inlinenoexcept

Constructor.

Definition at line 558 of file bitbuffer.inl.

Method Details:

◆ Capacity()

template<uinteger TCapacity>
virtual uinteger alib::bitbuffer::BitBufferLocal< TCapacity >::Capacity ( ) const
inlineoverridevirtual

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

Returns
The size of the internal storage in bits.

Implements alib::bitbuffer::BitBufferBase.

Definition at line 567 of file bitbuffer.inl.

◆ EnsureCapacity()

template<uinteger TCapacity>
virtual bool alib::bitbuffer::BitBufferLocal< TCapacity >::EnsureCapacity ( uinteger bitsRequired,
BitBufferBase::Index idx )
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.

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

Implements alib::bitbuffer::BitBufferBase.

Definition at line 582 of file bitbuffer.inl.

Here is the call graph for this function:

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