# TBitField Class Reference
[MCCore]

Inheritance diagram for TBitField:

List of all members.

## Public Types
typedef T | TMask
| use this for declaring masks, enums may not work for 64-bit ints
## Public Member Functions
| TBitField (void)
| TBitField (const T initialBits)
T & | GetBits (void)
const T & | GetBits (void) const
boolean | TestMasked (const T mask) const
void | ClearMasked (const T mask)
void | SetMasked (const T mask)
void | ToggleMasked (const T mask)
void | SetMaskedValue (const T mask, const boolean value)
boolean | TestBit (const uint32 elemNum) const
void | ClearBit (const uint32 elemNum)
void | SetBit (const uint32 elemNum)
void | ToggleBit (const uint32 elemNum)
void | SetBitValue (const uint32 elemNum, const boolean value)
void | ClearAllBits (void)
void | SetAllBits (void)
void | ToggleAllBits (void)
void | SetAllBitValues (const boolean value)
## Static Public Member Functions
static TBitField< T > & | CastFromWord (T &word)
static const TBitField< T > & | CastFromWord (const T &word)
## Public Attributes
T | bits

## Detailed Description

This is a template for setting single bit values in a compiler supported type. Typically these are used when flags are plentiful and space is not. The calls match corresponding operations in TBitArray.

Note that the bits field is public so that shift operations and other built in compiler bit ops are possible.

What about multi-bit values, probably add new classes for this like TBitFieldN<T> and implement 2,3,4,... with just Test/SetBitValue ops. RotateLeft/Right and other non-standard bit operations would be nice too.

## Member Typedef Documentation

typedef T TBitField::TMask

use this for declaring masks, enums may not work for 64-bit ints

## Constructor & Destructor Documentation

TTi TBitField::TBitField | ( | void |  | ) | `[inline]`

TTi TBitField::TBitField | ( | const T | initialBits | ) | `[inline]`

## Member Function Documentation

TTi const TBitField< T > & TBitField::CastFromWord | ( | const T & | word | ) | `[inline, static]`

TTi TBitField< T > & TBitField::CastFromWord | ( | T & | word | ) | `[inline, static]`

TTi void TBitField::ClearAllBits | ( | void |  | ) | `[inline]`

TTi void TBitField::ClearBit | ( | const uint32 | elemNum | ) | `[inline]`

TTi void TBitField::ClearMasked | ( | const T | mask | ) | `[inline]`

TTi const T & TBitField::GetBits | ( | void |  | ) | const`[inline]`

TTi T & TBitField::GetBits | ( | void |  | ) | `[inline]`

TTi void TBitField::SetAllBits | ( | void |  | ) | `[inline]`

TTi void TBitField::SetAllBitValues | ( | const boolean | value | ) | `[inline]`

TTi void TBitField::SetBit | ( | const uint32 | elemNum | ) | `[inline]`

TTi void TBitField::SetBitValue | ( | const uint32 | elemNum,
|  | const boolean | value |
| ) |  |  | `[inline]`

TTi void TBitField::SetMasked | ( | const T | mask | ) | `[inline]`

TTi void TBitField::SetMaskedValue | ( | const T | mask,
|  | const boolean | value |
| ) |  |  | `[inline]`

TTi boolean TBitField::TestBit | ( | const uint32 | elemNum | ) | const`[inline]`

TTi boolean TBitField::TestMasked | ( | const T | mask | ) | const`[inline]`

TTi void TBitField::ToggleAllBits | ( | void |  | ) | `[inline]`

TTi void TBitField::ToggleBit | ( | const uint32 | elemNum | ) | `[inline]`

TTi void TBitField::ToggleMasked | ( | const T | mask | ) | `[inline]`

## Member Data Documentation

T TBitField::bits

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

- BitField.h