GClasses

GClasses::GBitTable Class Reference

Represents a table of bits. More...

#include <GBitTable.h>

List of all members.

Public Member Functions

 GBitTable (size_t bitCount)
 All bits are initialized to false.
 GBitTable (const GBitTable &o)
 Copy Constructor.
GBitTableoperator= (const GBitTable &o)
 Operator=.
virtual ~GBitTable ()
void clearAll ()
 Sets all bits to false.
void setAll ()
 Sets all bits to true.
bool bit (size_t index)
 Returns the bit at index.
void set (size_t index)
 Sets the bit at index.
void unset (size_t index)
 Clears the bit at index.
void toggle (size_t index)
 Toggles the bit at index.
bool equals (GBitTable *that)
 Returns true iff the bit tables are exactly equal. (Behavior is undefined if the tables are not the same size.)
bool areAllSet (size_t count)
 Returns true iff the first "count" bits are set. (Note that for most applications, it is more efficient to simply maintain a count of the number of bits that are set than to call this method.)
bool areAllClear (size_t count)
 Returns true iff the first "count" bits are clear.

Static Public Member Functions

static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure.

Protected Attributes

size_t m_size
size_t * m_pBits

Detailed Description

Represents a table of bits.


Constructor & Destructor Documentation

GClasses::GBitTable::GBitTable ( size_t  bitCount)

All bits are initialized to false.

GClasses::GBitTable::GBitTable ( const GBitTable o)

Copy Constructor.

virtual GClasses::GBitTable::~GBitTable ( ) [virtual]

Member Function Documentation

bool GClasses::GBitTable::areAllClear ( size_t  count)

Returns true iff the first "count" bits are clear.

bool GClasses::GBitTable::areAllSet ( size_t  count)

Returns true iff the first "count" bits are set. (Note that for most applications, it is more efficient to simply maintain a count of the number of bits that are set than to call this method.)

bool GClasses::GBitTable::bit ( size_t  index)

Returns the bit at index.

void GClasses::GBitTable::clearAll ( )

Sets all bits to false.

bool GClasses::GBitTable::equals ( GBitTable that)

Returns true iff the bit tables are exactly equal. (Behavior is undefined if the tables are not the same size.)

GBitTable& GClasses::GBitTable::operator= ( const GBitTable o)

Operator=.

void GClasses::GBitTable::set ( size_t  index)

Sets the bit at index.

void GClasses::GBitTable::setAll ( )

Sets all bits to true.

static void GClasses::GBitTable::test ( ) [static]

Performs unit tests for this class. Throws an exception if there is a failure.

void GClasses::GBitTable::toggle ( size_t  index)

Toggles the bit at index.

void GClasses::GBitTable::unset ( size_t  index)

Clears the bit at index.


Member Data Documentation

size_t* GClasses::GBitTable::m_pBits [protected]
size_t GClasses::GBitTable::m_size [protected]