OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::bitset64 Class Reference

See cbitset64. More...

#include <OgreBitset.h>

Public Member Functions

 bitset64 ()
 
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 findFirstBitSet (size_t startFrom) const
 Finds the first bit set. More...
 
size_t findLastBitSetPlusOne () const
 Finds the first bit unset after the last bit set. More...
 
size_t findLastBitSetPlusOne (size_t startFrom) const
 Same as findLastBitSetPlusOne(); starting from startFrom (exclusive). More...
 
size_t findLastBitUnset () const
 Finds the last bit unset. More...
 
size_t findLastBitUnset (size_t startFrom) const
 Finds the last bit unset; starting from startFrom (exclusive). More...
 
size_t numBitsSet (const size_t positionEnd) const
 Returns the number of bits that are set between range [0; positionEnd). More...
 
void reset (size_t bitsCapacity)
 
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

See cbitset64.

This is the same, but the maximum number of bits is not known at build time

Constructor & Destructor Documentation

◆ bitset64()

Ogre::bitset64::bitset64 ( )
inline

Member Function Documentation

◆ capacity()

size_t Ogre::bitset64::capacity ( ) const
inline

Return maximum number of bits this bitset can hold.

◆ clear()

void Ogre::bitset64::clear ( )
inline

Sets all bits to 0.

References Ogre::FastArray< T >::begin(), and Ogre::FastArray< T >::size().

◆ empty()

bool Ogre::bitset64::empty ( ) const
inline

Returns true if all bits are unset.

◆ findFirstBitSet() [1/2]

size_t Ogre::bitset64::findFirstBitSet ( ) const
inline

Finds the first bit set.

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

◆ findFirstBitSet() [2/2]

size_t Ogre::bitset64::findFirstBitSet ( size_t  startFrom) const
inline

Finds the first bit set.

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

◆ findLastBitSetPlusOne() [1/2]

size_t Ogre::bitset64::findLastBitSetPlusOne ( ) const
inline

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]

◆ findLastBitSetPlusOne() [2/2]

size_t Ogre::bitset64::findLastBitSetPlusOne ( size_t  startFrom) const
inline

Same as findLastBitSetPlusOne(); starting from startFrom (exclusive).

Parameters
startFromMust be in range (0; capacity] e.g. if capacity == 5 and we've set 01001b (0 is the 4th bit, 1 is the 0th bit) then:
findLastBitSetPlusOne( 6 ) = INVALID
findLastBitSetPlusOne( 5 ) = 4u
findLastBitSetPlusOne( 4 ) = 4u
findLastBitSetPlusOne( 3 ) = 1u
findLastBitSetPlusOne( 2 ) = 1u
findLastBitSetPlusOne( 1 ) = 1u
findLastBitSetPlusOne( 0 ) = INVALID
e.g. if capacity == 5 and we've set 10110b (1 is the 4th bit, 0 is the 0th bit) then:
findLastBitSetPlusOne( 6 ) = INVALID
findLastBitSetPlusOne( 5 ) = 5u
findLastBitSetPlusOne( 4 ) = 3u
findLastBitSetPlusOne( 3 ) = 3u
findLastBitSetPlusOne( 2 ) = 2u
findLastBitSetPlusOne( 1 ) = 0u (not found)
findLastBitSetPlusOne( 0 ) = INVALID
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; startFrom]

◆ findLastBitUnset() [1/2]

size_t Ogre::bitset64::findLastBitUnset ( ) const
inline

Finds the last bit unset.

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

◆ findLastBitUnset() [2/2]

size_t Ogre::bitset64::findLastBitUnset ( size_t  startFrom) const
inline

Finds the last bit unset; starting from startFrom (exclusive).

Parameters
startFromMust be in range (0; capacity] e.g. if capacity == 5 and we've set 01001b (0 is the 4th bit, 1 is the 0th bit) then:
findLastBitUnsetPlusOne( 6 ) = INVALID
findLastBitUnsetPlusOne( 5 ) = 4u
findLastBitUnsetPlusOne( 4 ) = 2u
findLastBitUnsetPlusOne( 3 ) = 2u
findLastBitUnsetPlusOne( 2 ) = 1u
findLastBitUnsetPlusOne( 1 ) = 5u (capacity, not found)
findLastBitUnsetPlusOne( 0 ) = INVALID
Returns
If all bits are set (i.e. all 1s): Returns this->capacity() If at least one bit is unset: The index to the last set unbit. Return range is [0; capacity)

◆ numBitsSet()

size_t Ogre::bitset64::numBitsSet ( const size_t  positionEnd) const
inline

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

◆ reset()

void Ogre::bitset64::reset ( size_t  bitsCapacity)
inline

◆ set()

void Ogre::bitset64::set ( const size_t  position)
inline

Sets bit at 'position' to 1.

Parameters
positionValue in range [0; _N)

◆ setAll()

void Ogre::bitset64::setAll ( )
inline

Sets all bits to 1.

◆ setAllUntil()

void Ogre::bitset64::setAllUntil ( size_t  position)
inline

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::bitset64::setValue ( const size_t  position,
const bool  bValue 
)
inline

Sets bit at 'position'.

Parameters
positionValue in range [0; _N)
bValue

◆ test()

bool Ogre::bitset64::test ( const size_t  position) const
inline

Returns true if bit at 'position' is 1.

Parameters
positionValue in range [0; _N)

◆ unset()

void Ogre::bitset64::unset ( const size_t  position)
inline

Sets bit at 'position' to 0.

Parameters
positionValue in range [0; _N)

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