Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

base::BitString Class Reference

Encapsulation of a bitstring. More...

#include <bitstring.h>

List of all members.

Public Member Functions

 BitString (uint32_t len)
 Constructor:.
 BitString (const BitString &arg)
 Copy constructor.
 ~BitString ()
 Destructor, deallocate memory.
size_t count () const
size_t indexTable (cindex_t *table) const
size_t intSize () const
size_t size () const
BitString & operator|= (const BitString &arg)
 arg is a uint32_t[n]
BitString & operator|= (const uint32_t *arg)
BitString & operator &= (const BitString &arg)
 arg is a uint32_t[n]
BitString & operator &= (const uint32_t *arg)
BitString & operator^= (const BitString &arg)
 arg is a uint32_t[n]
BitString & operator^= (const uint32_t *arg)
BitString & operator= (const BitString &arg)
 arg is a uint32_t[n]
BitString & operator= (const uint32_t *arg)
bool operator== (const BitString &arg)
 arg is a uint32_t[n]
bool operator== (const uint32_t *arg)
bool isEmpty () const
BitString & neg ()
 Negate all bits.
BitString & operator= (bit_t bit)
 Set all the bits with bit.
BitString & operator= (Bit &b)
BitString & operator+= (cindex_t index)
 Set a given bit (to 1).
BitString & operator-= (cindex_t index)
 Reset a given bit (to 0).
BitString & operator^= (cindex_t index)
 Toggle a given bit.
bit_t getBit (cindex_t index) const
 Read a given bit.
BitString & assignBit (cindex_t index, bit_t bit)
 Assign one bit (=bit).
BitString & assignBit (cindex_t index, Bit b)
BitString & addBit (cindex_t index, bit_t bit)
 Add one bit (|=bit).
BitString & addBit (cindex_t index, Bit b)
BitString & subBit (cindex_t index, bit_t bit)
 Subtract one bit (&=~bit).
BitString & subBit (cindex_t index, Bit b)
BitString & xorBit (cindex_t index, bit_t bit)
 Xor operation with one bit (^=bit).
BitString & xorBit (cindex_t index, Bit b)
Bit operator[] (cindex_t index)
 Easy access of bits: if bs is a BitString, you can do: bs[3] |= Bit::One.
std::ostream & prettyPrint (std::ostream &os) const
 Pretty print.
uint32_t * operator() ()
 Access to the bit string.
const uint32_t * operator() () const

Private Attributes

size_t n
uint32_t * bitString


Detailed Description

Encapsulation of a bitstring.


Constructor & Destructor Documentation

base::BitString::BitString (  uint32_t  len  )  [inline]
 

Constructor:.

Parameters:
len,: size in BITS of the bitstring.

base::BitString::BitString (  const BitString &  arg  )  [inline]
 

Copy constructor.

Parameters:
arg,: original bit string to copy.

base::BitString::~BitString (   )  [inline]
 

Destructor, deallocate memory.


Member Function Documentation

BitString& base::BitString::addBit (  cindex_t  index,
Bit  b
)  [inline]
 

BitString& base::BitString::addBit (  cindex_t  index,
bit_t  bit
)  [inline]
 

Add one bit (|=bit).

Parameters:
index,: index of the bit to add.
bit,: the bit to add.
Precondition:
index is in range of the bit string.

BitString& base::BitString::assignBit (  cindex_t  index,
Bit  b
)  [inline]
 

BitString& base::BitString::assignBit (  cindex_t  index,
bit_t  bit
)  [inline]
 

Assign one bit (=bit).

Parameters:
index,: index of the bit to assign.
bit,: the bit to assign.
Precondition:
index is in range of the bit string.

size_t base::BitString::count (   )  const [inline]
 

Returns:
the number of bits set

bit_t base::BitString::getBit (  cindex_t  index  )  const [inline]
 

Read a given bit.

Parameters:
index,: index of the bit to read.
Precondition:
index is in range of the bit string.

size_t base::BitString::indexTable (  cindex_t *  table  )  const [inline]
 

Returns:
the index table corresponding to this bit string and the number of bits set.
Parameters:
table,: where to write the table.

size_t base::BitString::intSize (   )  const [inline]
 

Returns:
the size in int of the bitstring.

bool base::BitString::isEmpty (   )  const [inline]
 

Returns:
true if there is no bit set, false otherwise.

BitString& base::BitString::neg (   )  [inline]
 

Negate all bits.

BitString& base::BitString::operator &= (  const uint32_t *  arg  )  [inline]
 

BitString& base::BitString::operator &= (  const BitString &  arg  )  [inline]
 

arg is a uint32_t[n]

const uint32_t* base::BitString::operator() (   )  const [inline]
 

uint32_t* base::BitString::operator() (   )  [inline]
 

Access to the bit string.

BitString& base::BitString::operator+= (  cindex_t  index  )  [inline]
 

Set a given bit (to 1).

Parameters:
index,: index of the bit to set.
Precondition:
index is in range of the bit string.

BitString& base::BitString::operator-= (  cindex_t  index  )  [inline]
 

Reset a given bit (to 0).

Parameters:
index,: index of the bit to reset.
Precondition:
index is in range of the bit string.

BitString& base::BitString::operator= (  Bit &  b  )  [inline]
 

BitString& base::BitString::operator= (  bit_t  bit  )  [inline]
 

Set all the bits with bit.

Parameters:
bit,: value of the bit to set (0 or 1).

BitString& base::BitString::operator= (  const uint32_t *  arg  )  [inline]
 

BitString& base::BitString::operator= (  const BitString &  arg  )  [inline]
 

arg is a uint32_t[n]

bool base::BitString::operator== (  const uint32_t *  arg  )  [inline]
 

bool base::BitString::operator== (  const BitString &  arg  )  [inline]
 

arg is a uint32_t[n]

Bit base::BitString::operator[] (  cindex_t  index  )  [inline]
 

Easy access of bits: if bs is a BitString, you can do: bs[3] |= Bit::One.

Returns:
a bit reference.
Parameters:
index,: index of the bit to access.
Precondition:
index is in range of the bit string.

BitString& base::BitString::operator^= (  cindex_t  index  )  [inline]
 

Toggle a given bit.

Parameters:
index,: index of the bit to toggle.
Precondition:
index is in range of the bit string.

BitString& base::BitString::operator^= (  const uint32_t *  arg  )  [inline]
 

BitString& base::BitString::operator^= (  const BitString &  arg  )  [inline]
 

arg is a uint32_t[n]

BitString& base::BitString::operator|= (  const uint32_t *  arg  )  [inline]
 

BitString& base::BitString::operator|= (  const BitString &  arg  )  [inline]
 

arg is a uint32_t[n]

std::ostream& base::BitString::prettyPrint (  std::ostream &  os  )  const [inline]
 

Pretty print.

Parameters:
os,: where to print.

size_t base::BitString::size (   )  const [inline]
 

Returns:
the size in bits of the bitstring.

BitString& base::BitString::subBit (  cindex_t  index,
Bit  b
)  [inline]
 

BitString& base::BitString::subBit (  cindex_t  index,
bit_t  bit
)  [inline]
 

Subtract one bit (&=~bit).

Parameters:
index,: index of the bit to add.
bit,: the bit to subtract.
Precondition:
index is in range of the bit string.

BitString& base::BitString::xorBit (  cindex_t  index,
Bit  b
)  [inline]
 

BitString& base::BitString::xorBit (  cindex_t  index,
bit_t  bit
)  [inline]
 

Xor operation with one bit (^=bit).

Parameters:
index,: index of the bit to "xor" with.
bit,: argument bit for the xor.
Precondition:
index is in range of the bit string.


Member Data Documentation

uint32_t* base::BitString::bitString [private]
 

size_t base::BitString::n [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Jun 30 00:02:30 2006 for Module base by  doxygen 1.4.2