QxOrm  1.4.9
C++ Object Relational Mapping library
qx::memory::bool_array Class Reference

#include <bool_array.h>

List of all members.

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]

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
__sizesize of the array
Exceptions:
std::out_of_rangeif __size equals 0
std::bad_allocif 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.


Member Function Documentation

bool qx::memory::bool_array::at ( unsigned long  __idx) const [inline]

Reads the boolean value of an array element via an index.

Parameters:
__idxindex of the array element to access
Returns:
the boolean value of the accessed array element
Exceptions:
std::out_of_rangewhen 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.

Parameters:
__idxindex 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.

Parameters:
__idxindex of the array element to access
Exceptions:
std::out_of_rangewhen 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.

Parameters:
__idxindex of the array element to access
Exceptions:
std::out_of_rangewhen 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.


Member Data Documentation

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.

Definition at line 116 of file bool_array.h.


The documentation for this class was generated from the following file: