ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | Protected Fields | List of all members
BitBufferLocal< TCapacity > Class Template Reference

#include <bitbuffer.hpp>

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

Class Description

template<uinteger TCapacity>
class aworx::lib::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 619 of file bitbuffer.hpp.

Public Methods

 BitBufferLocal () noexcept
 
virtual uinteger Capacity () const override
 
virtual bool EnsureCapacity (uinteger bitsRequired, BitBufferBase::Index idx) override
 
- Public Methods 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)
 

Protected Fields

TStorage storage [(TCapacity+(sizeof(TStorage) *8 -1))/(sizeof(TStorage) *8)]
 
- Protected Fields inherited from BitBufferBase
TStoragedata
 

Additional Inherited Members

- Public Types inherited from BitBufferBase
using TStorage = unsigned int
 

Constructor & Destructor Documentation

◆ BitBufferLocal()

BitBufferLocal ( )
inlinenoexcept

Constructor.

Definition at line 630 of file bitbuffer.hpp.

Member Function Documentation

◆ Capacity()

virtual uinteger Capacity ( ) const
inlineoverridevirtual

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

Returns
The size of the internal storage in bits.

Implements BitBufferBase.

Definition at line 639 of file bitbuffer.hpp.

◆ EnsureCapacity()

virtual bool 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 the space is available or could be made available, false otherwise.

Implements BitBufferBase.

Definition at line 654 of file bitbuffer.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ storage

TStorage storage[(TCapacity+(sizeof(TStorage) *8 -1))/(sizeof(TStorage) *8)]
protected

The array that holds the data.

Definition at line 624 of file bitbuffer.hpp.


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