ezEngine  Milestone 7
ezBitfield< Container > Class Template Reference

A template interface, that turns any array class into a bitfield. More...

#include <Bitfield.h>

Public Member Functions

EZ_FORCE_INLINE ezUInt32 GetCount ()
 Returns the number of bits that this bitfield stores.
 
void SetCount (ezUInt32 uiBitCount)
 Resizes the Bitfield to hold the given number of bits. This version does NOT initialize new bits!
 
void SetCount (ezUInt32 uiBitCount, bool bSetNew)
 Resizes the Bitfield to hold the given number of bits. If bSetNew is true, new bits are set to 1, otherwise they are cleared to 0.
 
EZ_FORCE_INLINE bool IsEmpty () const
 Returns true, if the bitfield does not store any bits.
 
void Clear ()
 Discards all bits and sets count to zero.
 
EZ_FORCE_INLINE void SetBit (ezUInt32 uiBit)
 Sets the given bit to 1.
 
EZ_FORCE_INLINE void ClearBit (ezUInt32 uiBit)
 Clears the given bit to 0.
 
EZ_FORCE_INLINE bool IsSet (ezUInt32 uiBit) const
 Returns true, if the given bit is set to 1.
 
void ClearAllBits ()
 Clears all bits to 0.
 
void SetAllBits ()
 Sets all bits to 1.
 
void SetRange (ezUInt32 uiFirstBit, ezUInt32 uiLastBit)
 Sets the range starting at uiFirstBit up to (and including) uiLastBit to 1.
 
void ClearRange (ezUInt32 uiFirstBit, ezUInt32 uiLastBit)
 Clears the range starting at uiFirstBit up to (and including) uiLastBit to 0.
 

Private Member Functions

EZ_FORCE_INLINE ezUInt32 GetBitInt (ezUInt32 uiBitIndex) const
 
EZ_FORCE_INLINE ezUInt32 GetBitMask (ezUInt32 uiBitIndex) const
 

Private Attributes

ezUInt32 m_uiCount
 
Container m_Container
 

Detailed Description

template<class Container>
class ezBitfield< Container >

A template interface, that turns any array class into a bitfield.

This class provides an interface to work with single bits, to store true/false values. The underlying container is configurable, though it must support random access and a 'SetCount' function and it must use elements of type ezUInt32. In most cases a dynamic array should be used. For this case the ezDynamicBitfield typedef is already available. It is also useful to use an ezHybridArray, though there is not ezHybridBitfield typedef, due to language restrictions.


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