OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::cbitset64< _N > Class Template Reference

This is similar to std::bitset, except waaay less bloat. More...

#include <OgreBitset.h>

+ Inheritance diagram for Ogre::cbitset64< _N >:

Public Member Functions

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 findFirstBitSet () const
 Finds the first bit set. More...
 
size_t findLastBitSetPlusOne () const
 Finds the first bit unset after the last bit set. 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>
class Ogre::cbitset64< _N >

This is similar to std::bitset, except waaay less bloat.

cbitset64 stands for constant/compile-time bitset with an internal representation of 64-bits

2^6 = 64 0x3F = 64 - 1 = 6 bits set

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

Member Function Documentation

◆ capacity()

size_t Ogre::cbitsetN< _N, uint64 , _bits, _mask >::capacity ( ) const
inlineinherited

Return maximum number of bits this bitset can hold.

◆ clear()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::clear ( )
inlineinherited

Sets all bits to 0.

◆ empty()

bool Ogre::cbitsetN< _N, uint64 , _bits, _mask >::empty ( ) const
inherited

Returns true if all bits are unset.

◆ findFirstBitSet()

template<size_t _N>
size_t Ogre::cbitset64< _N >::findFirstBitSet ( ) const

Finds the first bit set.

Returns
The index to the first unset bit returns this->capacity() if all bits are unset (i.e. all 0s)

◆ findLastBitSetPlusOne()

template<size_t _N>
size_t Ogre::cbitset64< _N >::findLastBitSetPlusOne ( ) const

Finds the first bit unset after the last bit set.

Returns
If all bits are unset (i.e. all 0s): Returns 0 If at least one bit is set: The index to the last set bit, plus one. Return range is [1; capacity]

◆ numBitsSet()

size_t Ogre::cbitsetN< _N, uint64 , _bits, _mask >::numBitsSet ( const size_t  positionEnd) const
inherited

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

◆ set()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::set ( const size_t  position)
inherited

Sets bit at 'position' to 1.

Parameters
positionValue in range [0; _N)

◆ setAll()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::setAll ( )
inherited

Sets all bits to 1.

◆ setAllUntil()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::setAllUntil ( size_t  position)
inherited

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()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::setValue ( const size_t  position,
const bool  bValue 
)
inherited

Sets bit at 'position'.

Parameters
positionValue in range [0; _N)
bValue

◆ test()

bool Ogre::cbitsetN< _N, uint64 , _bits, _mask >::test ( const size_t  position) const
inherited

Returns true if bit at 'position' is 1.

Parameters
positionValue in range [0; _N)

◆ unset()

void Ogre::cbitsetN< _N, uint64 , _bits, _mask >::unset ( const size_t  position)
inherited

Sets bit at 'position' to 0.

Parameters
positionValue in range [0; _N)

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