Public Member Functions
BitWizard< T > Class Template Reference

A class for conducting with bitwise operations on registers. More...

#include <BitWizard.h>

List of all members.

Public Member Functions

 BitWizard ()
 The constructor for the BitWizard class. Doesn't do anything.
bool getBit (const BitMinion::BitIndexEnumType &bitIndex, const T &registerValue) const
 Gets a specific bit from the provided register.
getBits (const BitMinion::BitIndexEnumType &bitIndex, const BitMinion::BitCountMaskEnumType &bitMask, const T &registerValue) const
 Get a group of bits from the provided register.
void setBit (const bool &bitValue, const BitMinion::BitIndexEnumType &bitIndex, T &registerValue)
 Sets a specific bit in the provided register.
void setBits (const T &bitsValue, const BitMinion::BitIndexEnumType &bitIndex, const BitMinion::BitCountMaskEnumType &bitMask, T &registerValue)
 Set a group of bits in the provided register.
bool testBit (const bool &bitValue, const BitMinion::BitIndexEnumType &bitIndex, const T &registerValue) const
 Checks a specific bit against a provided value in the provided register.
void toggleBit (const BitMinion::BitIndexEnumType &bitIndex, T &registerValue)
 Toggles a specific bit in the provided register.
virtual ~BitWizard ()
 The destructor for the BitWizard class. Doesn't do anything.

Detailed Description

template<typename T>
class BitWizard< T >

A class for conducting with bitwise operations on registers.

BitWizard is templated, and works well with values of the same type. Its functionality using mismatched (implicitly cast) values is somewhat documented, but unsupported. Each method takes a register value as an argument and operates on that register value. It does not store any values locally, so only one BitWizard is necessary for each size register you intend to work with. BitWizard is known to only work with types that support bit shifting (e.g., not float or double or Foo()).

Definition at line 135 of file BitWizard.h.


Constructor & Destructor Documentation

template<typename T >
BitWizard< T >::BitWizard ( )

The constructor for the BitWizard class. Doesn't do anything.

Definition at line 204 of file BitWizard.h.

template<typename T >
BitWizard< T >::~BitWizard ( ) [virtual]

The destructor for the BitWizard class. Doesn't do anything.

Definition at line 209 of file BitWizard.h.


Member Function Documentation

template<typename T>
bool BitWizard< T >::getBit ( const BitMinion::BitIndexEnumType bitIndex,
const T &  registerValue 
) const [inline]

Gets a specific bit from the provided register.

Parameters:
bitIndexThe index of the requested bit (big-endian).
registerValueThe register holding the bits to get.
Returns:
The value of the requested bit.

Definition at line 214 of file BitWizard.h.

template<typename T>
T BitWizard< T >::getBits ( const BitMinion::BitIndexEnumType bitIndex,
const BitMinion::BitCountMaskEnumType bitMask,
const T &  registerValue 
) const [inline]

Get a group of bits from the provided register.

Parameters:
bitIndexThe index of the least significant requested bit (big-endian).
bitMaskThe mask that corresponds with the proper number of bits to get.
registerValueThe register from which bits are gathered.
Returns:
The value of the requested bits, starting at the least-significant position (big-endian). All bits that are more significant than the size of the requested mask will be zero.

Definition at line 238 of file BitWizard.h.

template<typename T>
void BitWizard< T >::setBit ( const bool &  bitValue,
const BitMinion::BitIndexEnumType bitIndex,
T &  registerValue 
) [inline]

Sets a specific bit in the provided register.

Parameters:
bitValueThe value to set.
bitIndexThe index of the bit to set (big-endian).
registerValueThe register holding the bit to set.
Returns:
The value of the supplied register, with newly set bit.

Definition at line 226 of file BitWizard.h.

template<typename T>
void BitWizard< T >::setBits ( const T &  bitsValue,
const BitMinion::BitIndexEnumType bitIndex,
const BitMinion::BitCountMaskEnumType bitMask,
T &  registerValue 
) [inline]

Set a group of bits in the provided register.

To set three bits, put the new bit values in the 3 least significant bit positions of bitsValue, use THREE_BIT_MASK for bitMask, and set bitIndex to the least significant bit index of the 3 bits you want to change in registerValue.

setBits(0x6, BIT_TWO_INDEX, THREE_BIT_MASK, 0x20) == 0x38, that is, 0x20 (100000b) --> 0x38 (111000b)

Parameters:
bitsValueThe new bit values to set. Only the least significant bitMask-sized bits will be used (big-endian).
bitIndexThe index of the least significant bit to set (big-endian).
bitMaskThe mask that corresponds with the proper number of bits to set.
registerValueThe register in which bits are modified.
Returns:
The value of the supplied register, with newly set bits.

Definition at line 244 of file BitWizard.h.

template<typename T>
bool BitWizard< T >::testBit ( const bool &  bitValue,
const BitMinion::BitIndexEnumType bitIndex,
const T &  registerValue 
) const [inline]

Checks a specific bit against a provided value in the provided register.

Parameters:
bitValueThe value to check the bit against.
bitIndexThe index of the bit to check (big-endian).
registerValueThe register holding the bit to check.
Returns:
The result of the check. True if the bit matches the supplied value, false otherwise.

Definition at line 220 of file BitWizard.h.

template<typename T>
void BitWizard< T >::toggleBit ( const BitMinion::BitIndexEnumType bitIndex,
T &  registerValue 
) [inline]

Toggles a specific bit in the provided register.

If the provided bit is true, the returned bit will be false, and vice-versa.

Parameters:
bitIndexThe index of the bit to toggle (big-endian).
registerValueThe register holding the bit to toggle.
Returns:
The value of the supplied register, with newly toggled bit.

Definition at line 232 of file BitWizard.h.


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


robot_instance
Author(s):
autogenerated on Sat Jun 8 2019 20:43:12