Murl::Bitfield Class Reference

The bitfield class. More...

#include "murl_bitfield.h"

Public Member Functions

 Bitfield ()
 The default constructor. More...
 
void Empty ()
 Empty the bitfield.
 
void Set (UInt32 bitIndex)
 Set a bit in the bitfield. More...
 
void Clear (UInt32 bitIndex)
 Clear a bit in the bitfield. More...
 
Bool IsSet (UInt32 bitIndex) const
 Check if a bit is set in the bitfield. More...
 
Bool IsCleared (UInt32 bitIndex) const
 Check if a bit is cleared in the bitfield. More...
 
UInt32 GetBitsCount () const
 Get the number of allocated bits in the bitfield. More...
 
UInt32 SetBitsCount (UInt32 numBits)
 Set the number of bits in the bitfield. More...
 
const UInt8Begin () const
 Get the pointer to the first bitfield byte. More...
 
const UInt8End () const
 Get the pointer next to the last bitfield byte. More...
 
UInt32 GetByteSize () const
 Get the byte size of the bitfield. More...
 

Detailed Description

The bitfield class.

Constructor & Destructor Documentation

◆ Bitfield()

Murl::Bitfield::Bitfield ( )
inline

The default constructor.

Create an empty bitfield.

Member Function Documentation

◆ Set()

void Murl::Bitfield::Set ( UInt32  bitIndex)
inline

Set a bit in the bitfield.

Extends the bitfield if the bitIndex is greater than the current number of bits, new bits are set to zero.

Parameters
bitIndexThe zero based index of the bit to set.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::SetCount().

◆ Clear()

void Murl::Bitfield::Clear ( UInt32  bitIndex)
inline

Clear a bit in the bitfield.

Extends the bitfield if the bitIndex is greater than the current number of bits, new bits are set to zero.

Parameters
bitIndexThe zero based index of the bit to clear.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::SetCount().

◆ IsSet()

Bool Murl::Bitfield::IsSet ( UInt32  bitIndex) const
inline

Check if a bit is set in the bitfield.

Parameters
bitIndexThe zero based index of the bit to test.
Returns
true if the bit is set, false if the index is out of range.

References Murl::Array< DataType >::GetCount().

◆ IsCleared()

Bool Murl::Bitfield::IsCleared ( UInt32  bitIndex) const
inline

Check if a bit is cleared in the bitfield.

Parameters
bitIndexThe zero based index of the bit to test.
Returns
true if the bit is cleared or the index is out of range.

References Murl::Array< DataType >::GetCount().

◆ GetBitsCount()

UInt32 Murl::Bitfield::GetBitsCount ( ) const
inline

Get the number of allocated bits in the bitfield.

Returns
The number of allocated bits in the bitfield.

References Murl::Array< DataType >::GetCount().

◆ SetBitsCount()

UInt32 Murl::Bitfield::SetBitsCount ( UInt32  numBits)
inline

Set the number of bits in the bitfield.

The bitfield is allocated in 32-bit steps, if the bitfield is extended, the new bits are set to zero.

Parameters
numBitsThe new number of bits in the bitfield.
Returns
The number of allocated bits in the bitfield.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::SetCount().

◆ Begin()

const UInt8* Murl::Bitfield::Begin ( ) const
inline

Get the pointer to the first bitfield byte.

Returns
The pointer to the first bitfield byte.

References Murl::Array< DataType >::Begin().

◆ End()

const UInt8* Murl::Bitfield::End ( ) const
inline

Get the pointer next to the last bitfield byte.

Returns
The pointer next to the last bitfield byte.

References Murl::Array< DataType >::End().

◆ GetByteSize()

UInt32 Murl::Bitfield::GetByteSize ( ) const
inline

Get the byte size of the bitfield.

Returns
The number of bytes used by the bitfield.

References Murl::Array< DataType >::GetCount().


The documentation for this class was generated from the following file:
  • murl_bitfield.h


Copyright © 2011-2024 Spraylight GmbH.