OGRE-Next: Ogre::cbitsetN< _N, _internalDataType, _bits, _mask > Class Template Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::cbitsetN< _N, _internalDataType, _bits, _mask > Class Template Reference
Core

`#include <OgreBitset.h>`

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

## 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

  _N | Number of bits this bitset will hold
  _bits | The 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 )
  _mask | The 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 ); Ogre::cbitsetN::set 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

References clear().

## 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

Sets all bits to 0.

Referenced by cbitsetN().

## ◆ 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

  position | Value 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

  position | Value 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

  position | Value 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

  position | Value in range [0; _N)

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

- OgreBitset.h