GClasses
GClasses::GBitTable Class Reference

Detailed Description

Represents a table of bits.

#include <GBitTable.h>

Public Member Functions

 GBitTable (size_t bitCount)
 All bits are initialized to false. More...
 
 GBitTable (const GBitTable &o)
 Copy Constructor. More...
 
virtual ~GBitTable ()
 
bool areAllClear (size_t count)
 Returns true iff the first "count" bits are clear. More...
 
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.) More...
 
bool bit (size_t index)
 Returns the bit at index. More...
 
void clearAll ()
 Sets all bits to false. More...
 
bool equals (GBitTable *that)
 Returns true iff the bit tables are exactly equal. (Behavior is undefined if the tables are not the same size.) More...
 
GBitTableoperator= (const GBitTable &o)
 Operator=. More...
 
void set (size_t index)
 Sets the bit at index. More...
 
void setAll ()
 Sets all bits to true. More...
 
void toggle (size_t index)
 Toggles the bit at index. More...
 
void unset (size_t index)
 Clears the bit at index. More...
 

Static Public Member Functions

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

Protected Attributes

size_t * m_pBits
 
size_t m_size
 

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