chomp::homology::BitSets Class Reference

This class uses bit representation to store many small sets. More...

#include <chomp/struct/bitsets.h>

List of all members.

Public Member Functions

 BitSets (int _nsets, int _nelem)
 Constructor of a family of empty sets.
 BitSets (const BitSets &s)
 Copy constructor.
BitSetsoperator= (const BitSets &s)
 Assignment operator.
 ~BitSets ()
 Destructor.
void add (int n, int e)
 Adds an element to the given set.
void remove (int n, int e)
 Removes an element from the given set.
bool check (int n, int e) const
 Checks if an element belongs to the given set.
void addset (int n, int m)
 Adds the entire set 'm' to the set 'n'.
int get (int n, int start=0) const
 Retrieves an element >= 'start' in the given set.

Private Attributes

int nsets
 The number of sets.
int nelem
 The maximal number of elements in each set.
int nbytes
 The number of bytes used for each set.
unsigned char * bits
 The memory buffer for storing the bits.


Detailed Description

This class uses bit representation to store many small sets.

Each of the sets can contain integer numbers from 0 to the limit specified in the constructor. The number of sets must also be given in the constructor. A contiguous chunk of memory is used to store the bits that represent the sets. This class is not fool-proof, so use it carefully. Minimal interface, sorry.

Definition at line 58 of file bitsets.h.


Constructor & Destructor Documentation

chomp::homology::BitSets::BitSets ( int  _nsets,
int  _nelem 
) [inline]

Constructor of a family of empty sets.

The number of the sets and the maximal number of elements in each set must be provided at initialization.

Definition at line 108 of file bitsets.h.

References bits, nbytes, and nsets.

chomp::homology::BitSets::BitSets ( const BitSets s  )  [inline]

Copy constructor.

Definition at line 118 of file bitsets.h.

References bits, nbytes, and nsets.

chomp::homology::BitSets::~BitSets (  )  [inline]

Destructor.

Definition at line 141 of file bitsets.h.

References bits.


Member Function Documentation

BitSets & chomp::homology::BitSets::operator= ( const BitSets s  )  [inline]

Assignment operator.

Definition at line 128 of file bitsets.h.

References bits, nbytes, nelem, and nsets.

void chomp::homology::BitSets::add ( int  n,
int  e 
) [inline]

Adds an element to the given set.

Definition at line 147 of file bitsets.h.

References bits, and nbytes.

void chomp::homology::BitSets::remove ( int  n,
int  e 
) [inline]

Removes an element from the given set.

Definition at line 155 of file bitsets.h.

References bits, and nbytes.

bool chomp::homology::BitSets::check ( int  n,
int  e 
) const [inline]

Checks if an element belongs to the given set.

Definition at line 162 of file bitsets.h.

References bits, and nbytes.

void chomp::homology::BitSets::addset ( int  n,
int  m 
) [inline]

Adds the entire set 'm' to the set 'n'.

Definition at line 168 of file bitsets.h.

References bits, and nbytes.

int chomp::homology::BitSets::get ( int  n,
int  start = 0 
) const [inline]

Retrieves an element >= 'start' in the given set.

Returns -1 if none.

Definition at line 177 of file bitsets.h.

References bits, nbytes, and nelem.


Member Data Documentation

int chomp::homology::BitSets::nsets [private]

The number of sets.

Definition at line 93 of file bitsets.h.

Referenced by BitSets(), and operator=().

int chomp::homology::BitSets::nelem [private]

The maximal number of elements in each set.

Definition at line 96 of file bitsets.h.

Referenced by get(), and operator=().

int chomp::homology::BitSets::nbytes [private]

The number of bytes used for each set.

Definition at line 99 of file bitsets.h.

Referenced by add(), addset(), BitSets(), check(), get(), operator=(), and remove().

unsigned char* chomp::homology::BitSets::bits [private]

The memory buffer for storing the bits.

Definition at line 102 of file bitsets.h.

Referenced by add(), addset(), BitSets(), check(), get(), operator=(), remove(), and ~BitSets().


The documentation for this class was generated from the following file:
Generated on Wed Nov 21 11:08:42 2007 for The Uniform Expansion Software by  doxygen 1.5.3