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

CBitField Class Reference

#include <BitField.h>

List of all members.

Public Types

typedef CBitField::CBFIterator bf_iterator

Public Member Functions

 CBitField ()
 CBitField (long lBits)
 CBitField (const CBitField &param)
virtual ~CBitField ()
void load (FILE *file)
void save (FILE *file)
long bits (void)
void setBit (long lBit, bool bSet)
void zero (void)
bool getBit (long lBit) const
void negate (void)
CBitFieldoperator &= (const CBitField &param)
CBitFieldoperator|= (const CBitField &param)
CBitFieldoperator^= (const CBitField &param)
CBitFieldoperator= (const CBitField &param)
CBitFieldpartialCopy (const CBitField &param)
bool operator== (const CBitField &param)
bool operator!= (const CBitField &param)
CBitProxy operator[] (long pos)
const CBitProxy operator[] (long pos) const
long getSet (void)
long countSet (void)
void setSize (long lNewBits)

Friends

class CBitProxy
class CBFIterator

Classes

class  CBFIterator
class  CBitProxy


Detailed Description

class implementing a bitfield of variable size

an iterator and proxy for [] use is also provided as local classes

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 27 of file BitField.h.


Member Typedef Documentation

typedef class CBitField::CBFIterator CBitField::bf_iterator
 

a iterator class for bitfields ... the typedef shit is just because there is somewhere an iterator struct in std ... so we had to do something to stop the compiler nagging around

if you are accessing data in the bitfield sequentially, using the iterators is significantly faster than using random access methods!

Author:
Johannes Lampel <johannes@lampel.net>


Constructor & Destructor Documentation

CBitField::CBitField  )  [inline]
 

standard constructor

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 252 of file BitField.h.

CBitField::CBitField long  lBits  )  [inline]
 

intialized bitfield with a given count of bits

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 263 of file BitField.h.

CBitField::CBitField const CBitField param  )  [inline]
 

copy constructor

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 276 of file BitField.h.

References m_lBits, and m_plData.


Member Function Documentation

long CBitField::bits void   )  [inline]
 

Returns:
the number of bits in this bitfield
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 309 of file BitField.h.

long CBitField::countSet void   )  [inline]
 

Returns:
number of bits set
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 613 of file BitField.h.

References CBitField::CBFIterator::getBit(), CBitField::CBFIterator::initialize(), and CBitField::CBFIterator::inRange().

bool CBitField::getBit long  lBit  )  const [inline]
 

returns the value of a specified bit

Parameters:
lBit position
Returns:
value of the specified bit
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 360 of file BitField.h.

Referenced by CBitField::CBitProxy::operator bool(), and CBitField::CBitProxy::operator=().

long CBitField::getSet void   )  [inline]
 

Returns:
the index of the first bit set
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 583 of file BitField.h.

References CBitField::CBFIterator::getBit(), CBitField::CBFIterator::getPos(), CBitField::CBFIterator::initialize(), CBitField::CBFIterator::inRange(), and CBitField::CBFIterator::setPos().

void CBitField::load FILE *  file  ) 
 

load bitfield from a file specified by parameter

Parameters:
file file
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 21 of file BitField.cpp.

void CBitField::negate void   )  [inline]
 

negate the whole bitfield

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 379 of file BitField.h.

CBitField& CBitField::operator &= const CBitField param  )  [inline]
 

bitwise AND operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 405 of file BitField.h.

References m_lBits, and m_plData.

bool CBitField::operator!= const CBitField param  )  [inline]
 

negate the == operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 553 of file BitField.h.

CBitField& CBitField::operator= const CBitField param  )  [inline]
 

copy operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 462 of file BitField.h.

References m_lBits, and m_plData.

bool CBitField::operator== const CBitField param  )  [inline]
 

compare operator. This doesnt work by comparing each bit for itself, but the total array elements. this is usually 32 times faster.

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 512 of file BitField.h.

References m_lBits, and m_plData.

const CBitProxy CBitField::operator[] long  pos  )  const [inline]
 

[] const operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 573 of file BitField.h.

References CBitProxy.

CBitProxy CBitField::operator[] long  pos  )  [inline]
 

[] operator using the CBitProxy class as return parameter this way we can intuitively use the []

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 563 of file BitField.h.

References CBitProxy.

CBitField& CBitField::operator^= const CBitField param  )  [inline]
 

bitwise XOR operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 443 of file BitField.h.

References m_lBits, and m_plData.

CBitField& CBitField::operator|= const CBitField param  )  [inline]
 

bitwise OR operator

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 424 of file BitField.h.

References m_lBits, and m_plData.

CBitField& CBitField::partialCopy const CBitField param  )  [inline]
 

copy all that you can get ... still not finished I guess, but I'm not sure

Todo:
check
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 482 of file BitField.h.

References m_lBits, and m_plData.

void CBitField::save FILE *  file  ) 
 

saves bitfield to some file

Parameters:
file file
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 29 of file BitField.cpp.

void CBitField::setBit long  lBit,
bool  bSet
[inline]
 

sets a bit

Parameters:
lBit position of the bit to change
bSet the value to which the bit should be changed
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 321 of file BitField.h.

Referenced by CBitField::CBitProxy::operator=().

void CBitField::setSize long  lNewBits  )  [inline]
 

sets the size of the bitfield to a new one

Parameters:
lNewBits new size in bits
Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 633 of file BitField.h.

Referenced by CClassifiedVoxelFieldRLEPosition::encode().

void CBitField::zero void   )  [inline]
 

reset bitfield vector

Author:
Johannes Lampel <johannes@lampel.net>

Definition at line 345 of file BitField.h.


The documentation for this class was generated from the following files:
Generated on Sat Sep 24 15:47:01 2005 for vvis by  doxygen 1.4.3-20050530