TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Register of bits. More...
#include <BitRegister.h>
Public Member Functions | |
BitRegister (unsigned int numBits=8 *sizeof(unsigned int)) | |
BitRegister (const BitRegister &bitRegister) | |
const BitRegister | operator| (const BitRegister &rhs) const |
const BitRegister | operator& (const BitRegister &rhs) const |
const BitRegister | operator^ (const BitRegister &rhs) const |
const BitRegister | operator+ (const BitRegister &rhs) const |
const BitRegister | operator- (const BitRegister &rhs) const |
bool | operator< (const BitRegister &rhs) const |
bool | operator> (const BitRegister &rhs) const |
bool | operator== (const BitRegister &rhs) const |
void | operator+= (const BitRegister &rhs) |
void | operator-= (const BitRegister &rhs) |
const BitRegister & | operator++ () |
const BitRegister | operator++ (int) |
const BitRegister & | operator-- () |
const BitRegister | operator-- (int) |
void | operator= (const BitRegister &rhs) |
void | operator= (unsigned int rhs) |
BitRegister | operator<< (unsigned int rhs) const |
BitRegister | operator>> (unsigned int rhs) const |
void | setBit (unsigned int position, bool values) |
bool | getBit (unsigned int position) const |
void | setValues (unsigned int values) |
unsigned int | getValues () const |
bool | toBool () const |
unsigned int | toUnsignedInt () const |
void | clear () |
void | print () const |
unsigned int | getNumBits () const |
unsigned int | getNumOneBits () const |
bool | getMostSignificantBit () const |
void | setMostSignificantBit () |
void | clearMostSignificantBit () |
BitRegister | cloneStructure () const |
std::string | toString () const |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const BitRegister &bitRegister) |
Register of bits.
The BitRegister is provides methods or performing bitwise operations on an underlying unsigned int.
TBTK::BitRegister::BitRegister | ( | unsigned int | numBits = 8 *sizeof(unsigned int) | ) |
Constructor.
TBTK::BitRegister::BitRegister | ( | const BitRegister & | bitRegister | ) |
Copy constructor.
|
inline |
Clear register.
|
inline |
Clear the most significant bit.
|
inline |
Create a new BitRegister with the same structure. (Provided to ensure the interface is similar with the interface for ExtensiveBitRegister.)
|
inline |
Get bit value.
|
inline |
Returns the most significant bit.
|
inline |
Returns the number of bits in the register.
|
inline |
Returns the number of bits that are one.
|
inline |
Get values as unsigned int.
|
inline |
Bitwise and operator.
|
inline |
Addition operator.
|
inline |
Increment operator.
|
inline |
Increment operator.
|
inline |
+= operator.
|
inline |
Subtraction operator.
|
inline |
Decrement operator.
|
inline |
Decrement operator.
|
inline |
-= operator.
|
inline |
Less than operator.
|
inline |
Left bitshift operator.
|
inline |
Assignment operator.
|
inline |
Assignment operator.
|
inline |
Comparison operator.
|
inline |
Greater than operator.
|
inline |
Right bitshift operator.
|
inline |
Bitwise xor operator.
|
inline |
Bitwise or operator.
|
inline |
Print bit register.
|
inline |
Set value of bit at a specific position.
|
inline |
Set the most significant bit.
|
inline |
Set values as unsigned int.
|
inline |
Returns a bool that is false if all bits are zero, and true otherwise.
|
inline |
Get string representation of the BitRegister.
|
inline |
Returns an unsigned int containing the least significant bits.
|
friend |
Writes the BitRegsiter toString()-representation to a stream.
stream | The stream to write to. |
bitRegister | The BitRegister to write. |