#include <chomp/struct/bitsets.h>
Public Member Functions | |
BitSets (int _nsets, int _nelem) | |
Constructor of a family of empty sets. | |
BitSets (const BitSets &s) | |
Copy constructor. | |
BitSets & | operator= (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. |
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.
chomp::homology::BitSets::BitSets | ( | int | _nsets, | |
int | _nelem | |||
) | [inline] |
chomp::homology::BitSets::BitSets | ( | const BitSets & | s | ) | [inline] |
chomp::homology::BitSets::~BitSets | ( | ) | [inline] |
void chomp::homology::BitSets::add | ( | int | n, | |
int | e | |||
) | [inline] |
void chomp::homology::BitSets::remove | ( | int | n, | |
int | e | |||
) | [inline] |
bool chomp::homology::BitSets::check | ( | int | n, | |
int | e | |||
) | const [inline] |
void chomp::homology::BitSets::addset | ( | int | n, | |
int | m | |||
) | [inline] |
int chomp::homology::BitSets::get | ( | int | n, | |
int | start = 0 | |||
) | const [inline] |
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] |
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().