OGRE-Next  3.0.0
Object-Oriented Graphics Rendering Engine
Ogre::cbitsetN< _N, _internalDataType, _bits, _mask > Class Template Reference

#include <OgreBitset.h>

Public Member Functions

 cbitsetN ()
 
size_t capacity () const
 Return maximum number of bits this bitset can hold. More...
 
void clear ()
 Sets all bits to 0. More...
 
bool empty () const
 Returns true if all bits are unset. More...
 
size_t numBitsSet (const size_t positionEnd) const
 Returns the number of bits that are set between range [0; positionEnd). More...
 
void set (const size_t position)
 Sets bit at 'position' to 1. More...
 
void setAll ()
 Sets all bits to 1. More...
 
void setAllUntil (size_t position)
 Sets all bits in range [0; position) It's the same as calling: More...
 
void setValue (const size_t position, const bool bValue)
 Sets bit at 'position'. More...
 
bool test (const size_t position) const
 Returns true if bit at 'position' is 1. More...
 
void unset (const size_t position)
 Sets bit at 'position' to 0. More...
 

Detailed Description

template<size_t _N, typename _internalDataType, size_t _bits, size_t _mask>
class Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >

Remarks
IMPORTANT: To use this class, you MUST include OgreBitset.inl in your cpp file This split into *.h and *.inl was to avoid bloating build times of headers that include OgreBitset.h
Parameters
_NNumber of bits this bitset will hold
_bitsThe exponent of the number of bits to hold per mValues. E.g. 32 bits per mValues needs _bits = 5, because 2^5 = 32 Note we never tested other combinations where 2^_bits * 8 != sizeof( _internalDataType )
_maskThe maximum number of bits - 1 to avoid overflow e.g. 32 bits per mValues needs a mask of 31 (0x1F) to wrap around so when we call
this->set( 32 );
void set(const size_t position)
Sets bit at 'position' to 1.

It actually performs:

idx = 32 / 32; // 32 >> 5
mask = 32 % 32; // 32 & 0x1F
this->mValues[idx] |= mask;

Constructor & Destructor Documentation

◆ cbitsetN()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::cbitsetN ( )
inline

Member Function Documentation

◆ capacity()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
size_t Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::capacity ( ) const
inline

Return maximum number of bits this bitset can hold.

◆ clear()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::clear ( )
inline

◆ empty()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
bool Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::empty ( ) const

Returns true if all bits are unset.

◆ numBitsSet()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
size_t Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::numBitsSet ( const size_t  positionEnd) const

Returns the number of bits that are set between range [0; positionEnd).

◆ set()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::set ( const size_t  position)

Sets bit at 'position' to 1.

Parameters
positionValue in range [0; _N)

◆ setAll()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::setAll ( )

Sets all bits to 1.

◆ setAllUntil()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::setAllUntil ( size_t  position)

Sets all bits in range [0; position) It's the same as calling:

for( size_t i = 0u; i < position; ++i ) this->set( i );

Values in range [position; _N) are left untouched

Parameters
position

◆ setValue()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::setValue ( const size_t  position,
const bool  bValue 
)

Sets bit at 'position'.

Parameters
positionValue in range [0; _N)
bValue

◆ test()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
bool Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::test ( const size_t  position) const

Returns true if bit at 'position' is 1.

Parameters
positionValue in range [0; _N)

◆ unset()

template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::unset ( const size_t  position)

Sets bit at 'position' to 0.

Parameters
positionValue in range [0; _N)

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