CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csBitArray Class Reference

A one-dimensional array of bits, similar to STL bitset. More...

#include <bitarray.h>

List of all members.

Public Methods

 csBitArray ()
 Defalut constructor.

 csBitArray (size_t size)
 Construct with a size of size bits.

 csBitArray (const csBitArray &that)
 Construct as duplicate of that (copy constructor).

virtual ~csBitArray ()
 Destructor.

size_t Length () const
 Return the number of stored bits.

void SetLength (size_t newSize)
 Set the number of stored bits.

csBitArray & operator= (const csBitArray &that)
 Copy from other array.

BitProxy operator[] (size_t pos)
 Return bit at position pos.

const BitProxy operator[] (size_t pos) const
 Return bit at position pos.

bool operator== (const csBitArray &that) const
 Equal to other array.

bool operator!= (const csBitArray &that) const
 Not equal to other array.

csBitArray & operator &= (const csBitArray &that)
 Bit-wise `and'.

csBitArray operator|= (const csBitArray &that)
 Bit-wise `or'.

csBitArray operator^= (const csBitArray &that)
 Bit-wise `xor'.

csBitArray operator~ () const
 Return complement bit array in which all bits are flipped from this one.

void Clear ()
 Set all bits to false.

void SetBit (size_t pos)
 Set the bit at position pos to true.

void ClearBit (size_t pos)
 Set the bit at position pos to false.

void FlipBit (size_t pos)
 Toggle the bit at position pos.

void Set (size_t pos, bool val)
 Set the bit at position pos to the given value.

bool IsBitSet (size_t pos) const
 Returns true if the bit at position pos is true.

bool AreSomeBitsSet (size_t pos, size_t count) const
 Checks whether at least one of count bits is set from position pos on.

bool AllBitsFalse () const
 Returns true iff all bits are false.

csBitArray & FlipAllBits ()
 Change value of all bits.

store_type * GetArrayBits ()
 Return the full array.

store_type GetSingleWord ()
 Gets quick access to the single-word (only useful when the bit array <= the word size of the machine.).

void SetSingleWord (store_type sw)
 Sets the single-word very simply (only useful when the bit array <= the word size of the machine.).


Friends

csBitArray operator & (const csBitArray &a1, const csBitArray &a2)
 Bit-wise `and'.

csBitArray operator| (const csBitArray &a1, const csBitArray &a2)
 Bit-wise `or'.

csBitArray operator^ (const csBitArray &a1, const csBitArray &a2)
 Bit-wise `xor'.


Detailed Description

A one-dimensional array of bits, similar to STL bitset.

Definition at line 34 of file bitarray.h.


Constructor & Destructor Documentation

csBitArray::csBitArray   [inline]
 

Defalut constructor.

Definition at line 147 of file bitarray.h.

csBitArray::csBitArray size_t    size [inline, explicit]
 

Construct with a size of size bits.

Definition at line 157 of file bitarray.h.

csBitArray::csBitArray const csBitArray &    that [inline]
 

Construct as duplicate of that (copy constructor).

Definition at line 168 of file bitarray.h.

virtual csBitArray::~csBitArray   [inline, virtual]
 

Destructor.

Definition at line 175 of file bitarray.h.


Member Function Documentation

bool csBitArray::AllBitsFalse   const [inline]
 

Returns true iff all bits are false.

Definition at line 365 of file bitarray.h.

bool csBitArray::AreSomeBitsSet size_t    pos,
size_t    count
const [inline]
 

Checks whether at least one of count bits is set from position pos on.

Definition at line 345 of file bitarray.h.

void csBitArray::Clear   [inline]
 

Set all bits to false.

Definition at line 302 of file bitarray.h.

void csBitArray::ClearBit size_t    pos [inline]
 

Set the bit at position pos to false.

Definition at line 315 of file bitarray.h.

csBitArray& csBitArray::FlipAllBits   [inline]
 

Change value of all bits.

Definition at line 374 of file bitarray.h.

void csBitArray::FlipBit size_t    pos [inline]
 

Toggle the bit at position pos.

Definition at line 322 of file bitarray.h.

store_type* csBitArray::GetArrayBits   [inline]
 

Return the full array.

Definition at line 384 of file bitarray.h.

store_type csBitArray::GetSingleWord   [inline]
 

Gets quick access to the single-word (only useful when the bit array <= the word size of the machine.).

Definition at line 393 of file bitarray.h.

bool csBitArray::IsBitSet size_t    pos const [inline]
 

Returns true if the bit at position pos is true.

Definition at line 335 of file bitarray.h.

size_t csBitArray::Length   const [inline]
 

Return the number of stored bits.

Definition at line 182 of file bitarray.h.

csBitArray& csBitArray::operator &= const csBitArray &    that [inline]
 

Bit-wise `and'.

Definition at line 247 of file bitarray.h.

References mNumBits, and mpStore.

bool csBitArray::operator!= const csBitArray &    that const [inline]
 

Not equal to other array.

Definition at line 241 of file bitarray.h.

csBitArray& csBitArray::operator= const csBitArray &    that [inline]
 

Copy from other array.

Definition at line 204 of file bitarray.h.

References mNumBits, and mpStore.

bool csBitArray::operator== const csBitArray &    that const [inline]
 

Equal to other array.

Definition at line 229 of file bitarray.h.

References mNumBits, and mpStore.

const BitProxy csBitArray::operator[] size_t    pos const [inline]
 

Return bit at position pos.

Definition at line 222 of file bitarray.h.

BitProxy csBitArray::operator[] size_t    pos [inline]
 

Return bit at position pos.

Definition at line 215 of file bitarray.h.

csBitArray csBitArray::operator^= const csBitArray &    that [inline]
 

Bit-wise `xor'.

Definition at line 265 of file bitarray.h.

References mNumBits, and mpStore.

csBitArray csBitArray::operator|= const csBitArray &    that [inline]
 

Bit-wise `or'.

Definition at line 256 of file bitarray.h.

References mNumBits, and mpStore.

csBitArray csBitArray::operator~   const [inline]
 

Return complement bit array in which all bits are flipped from this one.

Definition at line 274 of file bitarray.h.

void csBitArray::Set size_t    pos,
bool    val
[inline]
 

Set the bit at position pos to the given value.

Definition at line 329 of file bitarray.h.

void csBitArray::SetBit size_t    pos [inline]
 

Set the bit at position pos to true.

Definition at line 308 of file bitarray.h.

void csBitArray::SetLength size_t    newSize [inline]
 

Set the number of stored bits.

Remarks:
If the new size is larger than the old size, the newly added bits are cleared.

Definition at line 192 of file bitarray.h.

void csBitArray::SetSingleWord store_type    sw [inline]
 

Sets the single-word very simply (only useful when the bit array <= the word size of the machine.).

Definition at line 402 of file bitarray.h.


Friends And Related Function Documentation

csBitArray operator & const csBitArray &    a1,
const csBitArray &    a2
[friend]
 

Bit-wise `and'.

Definition at line 280 of file bitarray.h.

csBitArray operator^ const csBitArray &    a1,
const csBitArray &    a2
[friend]
 

Bit-wise `xor'.

Definition at line 292 of file bitarray.h.

csBitArray operator| const csBitArray &    a1,
const csBitArray &    a2
[friend]
 

Bit-wise `or'.

Definition at line 286 of file bitarray.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18