The Original CHomP Software
|
This class defines a set of bit fields of the same length which are to be stored in a contiguous piece of memory to avoid multiple memory allocation/deallocation. More...
#include <bitfield.h>
Public Member Functions | |
SetOfBitFields (int_t len, int_t maxelem) | |
The constructor of a set of a fixed maximal number of bit fields, each of the same length. More... | |
~SetOfBitFields () | |
The destructor. More... | |
int | add (const BitField &b, int value) |
Adds a bit field to the set. More... | |
int | check (const BitField &b) const |
Returns the value of the given bit field value or return -1 if the bit field is not in the set. More... | |
int | used (void) const |
Returns the number of bit fields contained in the set. More... | |
void | forget () |
Forgets all the bit fields and deallocates the memory. More... | |
Private Attributes | |
int | avail |
The number of bit fields that still can be stored. More... | |
int | usedcount |
The number of bit fields used. More... | |
int_t | size |
The actual size of the table. More... | |
int_t | length |
The length of bit fields. More... | |
BitField * | bf |
The table of bit fields. More... | |
BitField | values |
The values of bit fields. More... | |
unsigned char * | buf |
The memory buffer used for bit fields. More... | |
unsigned char * | bufcur |
The current position in the buffer. More... | |
This class defines a set of bit fields of the same length which are to be stored in a contiguous piece of memory to avoid multiple memory allocation/deallocation.
Each bit field in the set is assigned a value 1 or 0. Hashing is used for quick retrieval of the values of bit fields.
Definition at line 244 of file bitfield.h.
The constructor of a set of a fixed maximal number of bit fields, each of the same length.
The set is initially empty.
|
inline |
The destructor.
Definition at line 298 of file bitfield.h.
int chomp::homology::SetOfBitFields::add | ( | const BitField & | b, |
int | value | ||
) |
Adds a bit field to the set.
If it already was there then returns its value. If there is no room available for the bit field then returns -1. Otherwise returns 2.
int chomp::homology::SetOfBitFields::check | ( | const BitField & | b | ) | const |
Returns the value of the given bit field value or return -1 if the bit field is not in the set.
|
inline |
Forgets all the bit fields and deallocates the memory.
Definition at line 314 of file bitfield.h.
|
inline |
Returns the number of bit fields contained in the set.
Definition at line 309 of file bitfield.h.
References usedcount.
|
private |
The number of bit fields that still can be stored.
Definition at line 271 of file bitfield.h.
Referenced by forget().
|
private |
The table of bit fields.
Definition at line 283 of file bitfield.h.
Referenced by forget(), and ~SetOfBitFields().
|
private |
The memory buffer used for bit fields.
Definition at line 289 of file bitfield.h.
Referenced by forget(), and ~SetOfBitFields().
|
private |
The current position in the buffer.
Definition at line 292 of file bitfield.h.
|
private |
The length of bit fields.
Definition at line 280 of file bitfield.h.
Referenced by forget(), and ~SetOfBitFields().
|
private |
|
private |
|
private |
The values of bit fields.
Definition at line 286 of file bitfield.h.
Referenced by forget(), and ~SetOfBitFields().