QxOrm
1.5.0
C++ Object Relational Mapping library
|
#include <bool_array.h>
Classes | |
class | _Element |
Public Member Functions | |
bool_array () | |
bool_array (unsigned long __size) | |
~bool_array () | |
bool | create (unsigned long __size) |
void | initialize (bool ___value) |
_Element | operator[] (unsigned long __idx) |
bool | at (unsigned long __idx) const |
void | reset (unsigned long __idx) |
void | set (unsigned long __idx) |
unsigned long | size () const |
unsigned long | count () const |
unsigned long | count (unsigned long __beg, unsigned long __end) const |
void | flip () |
Private Attributes | |
BYTE * | _M_byte_ptr |
unsigned long | _M_length |
Static Private Attributes | |
static BYTE | _S_bit_count [256] |
Class to represent a packed boolean array.
This was first written in April 1995, before I knew of any existing implementation of this kind of classes. Of course, the C++ Standard Template Library now demands an implementation of packed boolean array as `vector<bool>', but the code here should still be useful for the following three reasons: (1) STL support of MSVC 6 did not implement this specialization (nor did it have a `bit_vector'); (2) I incorporated some useful member functions from the STL bitset into this `bool_array', including `reset', `set', `flip', and `count'; (3) In my tests under MSVC 6 and GCC 2.95.3/3.2.3 my code is really FASTER than vector<bool> or the normal boolean array.
Definition at line 79 of file bool_array.h.
qx::memory::bool_array::bool_array | ( | ) | [inline] |
Definition at line 95 of file bool_array.h.
qx::memory::bool_array::bool_array | ( | unsigned long | __size | ) | [inline, explicit] |
Constructs the packed boolean array with a specific size.
__size | size of the array |
std::out_of_range | if __size equals 0 |
std::bad_alloc | if memory is insufficient |
Definition at line 167 of file bool_array.h.
qx::memory::bool_array::~bool_array | ( | ) | [inline] |
Definition at line 97 of file bool_array.h.
bool qx::memory::bool_array::at | ( | unsigned long | __idx | ) | const [inline] |
Reads the boolean value of an array element via an index.
__idx | index of the array element to access |
std::out_of_range | when the index is too big |
Definition at line 196 of file bool_array.h.
unsigned long qx::memory::bool_array::count | ( | ) | const |
unsigned long qx::memory::bool_array::count | ( | unsigned long | __beg, |
unsigned long | __end | ||
) | const |
bool qx::memory::bool_array::create | ( | unsigned long | __size | ) |
void qx::memory::bool_array::flip | ( | ) |
void qx::memory::bool_array::initialize | ( | bool | ___value | ) |
bool_array::_Element qx::memory::bool_array::operator[] | ( | unsigned long | __idx | ) | [inline] |
Creates a reference to an array element.
__idx | index of the array element to access |
Definition at line 182 of file bool_array.h.
void qx::memory::bool_array::reset | ( | unsigned long | __idx | ) | [inline] |
Resets an array element to false
via an index.
__idx | index of the array element to access |
std::out_of_range | when the index is too big |
Definition at line 212 of file bool_array.h.
void qx::memory::bool_array::set | ( | unsigned long | __idx | ) | [inline] |
Sets an array element to true
via an index.
__idx | index of the array element to access |
std::out_of_range | when the index is too big |
Definition at line 228 of file bool_array.h.
unsigned long qx::memory::bool_array::size | ( | ) | const [inline] |
Definition at line 108 of file bool_array.h.
BYTE* qx::memory::bool_array::_M_byte_ptr [private] |
Definition at line 114 of file bool_array.h.
unsigned long qx::memory::bool_array::_M_length [private] |
Definition at line 115 of file bool_array.h.
BYTE qx::memory::bool_array::_S_bit_count[256] [static, private] |
Definition at line 116 of file bool_array.h.