ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | Protected Fields | List of all members
BitBufferMA Class Reference

#include <bitbuffer.hpp>

Inheritance diagram for BitBufferMA:
[legend]
Collaboration diagram for BitBufferMA:
[legend]

Class Description


A bit buffer using monotonic allocation.

See also
Two alternatives are provided with BitBuffer and BitBufferLocal.

Definition at line 544 of file bitbuffer.hpp.

Public Methods

 BitBufferMA (std::shared_ptr< MonoAllocator > monoAllocator, uinteger initialCapacity)
 
virtual uinteger Capacity () const override
 
virtual bool EnsureCapacity (uinteger bitsRequired, BitBufferBase::Index idx) override
 
std::shared_ptr< MonoAllocatorGetAllocator ()
 
- 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

std::shared_ptr< MonoAllocatorma
 
std::vector< TStorage, aworx::StdContMAOptional< TStorage > > storage
 
- Protected Fields inherited from BitBufferBase
TStoragedata
 

Additional Inherited Members

- Public Types inherited from BitBufferBase
using TStorage = unsigned int
 

Constructor & Destructor Documentation

◆ BitBufferMA()

BitBufferMA ( std::shared_ptr< MonoAllocator monoAllocator,
uinteger  initialCapacity 
)
inline

Constructor taking an external monotonic allocator and the initial capacity.

Parameters
monoAllocatorA reference to a monotonic allocator to use to allocate buffer storage data.
initialCapacityThe requested initial capacity of the buffer in bits.

Definition at line 561 of file bitbuffer.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ Capacity()

virtual uinteger Capacity ( ) const
inlineoverridevirtual

Returns the (currently allocated) capacity.

Returns
The size of the internal storage in bits.

Implements BitBufferBase.

Definition at line 572 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, the internal capacity is doubled, or, if more is required, set to the required space.

Parameters
bitsRequiredThe number of bits divided 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 586 of file bitbuffer.hpp.

Here is the call graph for this function:

◆ GetAllocator()

std::shared_ptr<MonoAllocator> GetAllocator ( )
inline

Returns the internal monotonic allocator for external use.

Returns
The monotonic allocator given on construction.

Definition at line 601 of file bitbuffer.hpp.

Member Data Documentation

◆ ma

std::shared_ptr<MonoAllocator> ma
protected

An external monotonic allocator to be used internally to allocate the storage provided with construction of this class.

Definition at line 549 of file bitbuffer.hpp.

◆ storage

std::vector<TStorage, aworx::StdContMAOptional<TStorage> > storage
protected

The vector that holds the data.

Definition at line 552 of file bitbuffer.hpp.


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