Plasma Engine  2.0
Loading...
Searching...
No Matches
plStaticBitfield< T > Class Template Reference

Public Types

using StorageType = T
 
using ConstIterator = plBitIterator<StorageType, true, plUInt32>
 

Public Member Functions

 plStaticBitfield ()
 Initializes the bitfield to all zero.
 
bool IsAnyBitSet () const
 Returns true, if the bitfield is not zero.
 
bool IsNoBitSet () const
 Returns true, if the bitfield is all zero.
 
bool AreAllBitsSet () const
 Returns true, if the bitfield is not empty and all bits are set to one.
 
void SetBit (plUInt32 uiBit)
 Sets the given bit to 1.
 
void ClearBit (plUInt32 uiBit)
 Clears the given bit to 0.
 
void SetBitValue (plUInt32 uiBit, bool bValue)
 Sets the given bit to 1 or 0 depending on the given value.
 
bool IsBitSet (plUInt32 uiBit) const
 Returns true, if the given bit is set to 1.
 
void ClearAllBits ()
 Clears all bits to 0. Same as Clear().
 
void SetAllBits ()
 Sets all bits to 1.
 
void SetBitRange (plUInt32 uiFirstBit, plUInt32 uiNumBits)
 Sets the range starting at uiFirstBit up to (and including) uiLastBit to 1.
 
void ClearBitRange (plUInt32 uiFirstBit, plUInt32 uiNumBits)
 Clears the range starting at uiFirstBit up to (and including) uiLastBit to 0.
 
plUInt32 GetLowestBitSet () const
 Returns the index of the lowest bit that is set. Returns the max index+1 in case no bit is set, at all.
 
plUInt32 GetHighestBitSet () const
 Returns the index of the highest bit that is set. Returns the max index+1 in case no bit is set, at all.
 
plUInt32 GetNumBitsSet () const
 Returns the count of how many bits are set in total.
 
GetValue () const
 Returns the raw uint that stores all bits.
 
void SetValue (T value)
 Sets the raw uint that stores all bits.
 
void Swap (plStaticBitfield< T > &other)
 Swaps two bitfields.
 
PL_ALWAYS_INLINE void operator|= (const plStaticBitfield< T > &rhs)
 Modifies this to also contain the bits from rhs.
 
PL_ALWAYS_INLINE void operator&= (const plStaticBitfield< T > &rhs)
 Modifies this to only contain the bits that were set in this and rhs.
 
plResult Serialize (plStreamWriter &inout_writer) const
 
plResult Deserialize (plStreamReader &inout_reader)
 
ConstIterator GetIterator () const
 Returns a constant iterator to the very first set bit. Note that due to the way iterating through bits is accelerated, changes to the bitfield while iterating through the bits has undefined behaviour.
 
ConstIterator GetEndIterator () const
 Returns an invalid iterator. Needed to support range based for loops.
 

Static Public Member Functions

static constexpr plUInt32 GetStorageTypeBitCount ()
 
static plStaticBitfield< T > MakeFromMask (StorageType bits)
 

Friends

template<typename U >
plStaticBitfield< U > operator| (plStaticBitfield< U > lhs, plStaticBitfield< U > rhs)
 
template<typename U >
plStaticBitfield< U > operator& (plStaticBitfield< U > lhs, plStaticBitfield< U > rhs)
 
template<typename U >
plStaticBitfield< U > operator^ (plStaticBitfield< U > lhs, plStaticBitfield< U > rhs)
 
template<typename U >
bool operator== (plStaticBitfield< U > lhs, plStaticBitfield< U > rhs)
 
template<typename U >
bool operator!= (plStaticBitfield< U > lhs, plStaticBitfield< U > rhs)
 

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