#include <bitset.h>
Public Methods | |
csBitSet () | |
Create an empty bit set. | |
csBitSet (unsigned iBitCount) | |
Create bit set of given size. | |
~csBitSet () | |
Destroy the bit array. | |
unsigned | GetByteCount () const |
Query number of bytes used to represent bit set. | |
unsigned | GetBitCount () const |
Query number of bits represented by bit set. | |
void | Resize (unsigned iBitCount) |
Resize the array. | |
unsigned char* | GetBits () const |
Get a pointer to entire array for custom manipulations. | |
void | Reset () |
Clear the entire array. | |
void | Set () |
Set all the bits to one. | |
void | Set (unsigned index) |
Set a bit in the array. | |
void | Set (unsigned index, unsigned count) |
Set a number of bits in the array, starting with given index. | |
void | Reset (unsigned index) |
Reset a bit in the array. | |
void | Reset (unsigned index, unsigned count) |
Set a number of bits in the array, starting with given index. | |
bool | Get (unsigned index) const |
Get the value of a bit in the array. | |
bool | operator[] (unsigned index) const |
Same but in a more nice form. | |
csBitSet& | operator|= (csBitSet &bs) |
OR two bit sets together. | |
csBitSet& | operator &= (csBitSet &bs) |
AND two bit sets together. | |
char* | Description () const |
Dump an ASCII representation of the bit set to a string. More... | |
Protected Attributes | |
unsigned | bit_count |
unsigned | byte_count |
unsigned char* | bits |
The csBitSet class allow you to allocate, resize and manipulate such an array.
The bit set is a highly effective way to store an array of booleans. The implementation uses assembly whenever possible, and most methods are inline, thus it is highly recommended to use it whenever possible.
|
Dump an ASCII representation of the bit set to a string. Caller is responsible for destroying the returned string with delete[]. |