Public Member Functions | Private Member Functions | Private Attributes

chomp::homology::BitFields Class Reference

This class defines a simple table of bit fields with very limited functionality that is used for storing the information on the verified combinations of cubes' neighbors. More...

#include <known.h>

List of all members.

Public Member Functions

 BitFields ()
 The default constructor.
 ~BitFields ()
 The destructor.
void setkblimit (int limit=-1, int dim=-1)
 Sets the limit for the number of kilobytes used for BitFields.
int getkblimit (int dim=0) const
 Returns the current limit for the given dimension.
SetOfBitFieldsoperator[] (int dim)
 Returns the corresponding bit field set and allocates it if not used so far.
void forget (int dim=-1)
 Forgets the given bit field set or all the sets.

Private Member Functions

void extend (int n)
 Extends the table to the given length if necessary.
void allocate (int dim)
 Allocates the specific bit field set.

Private Attributes

SetOfBitFields ** tab
 The table of bit field sets for each dimension.
int len
 The length of the currently allocated table.
int * maxkb
 The memory limit for each table (in kilobytes), -1 for none.

Detailed Description

This class defines a simple table of bit fields with very limited functionality that is used for storing the information on the verified combinations of cubes' neighbors.

Definition at line 54 of file known.h.


Constructor & Destructor Documentation

chomp::homology::BitFields::BitFields (  )  [inline]

The default constructor.

Definition at line 99 of file known.h.

References len, maxkb, and tab.

{
        tab = NULL;
        len = 0;
        maxkb = NULL;
        return;
} /* BitFields::BitFields */

chomp::homology::BitFields::~BitFields (  ) 

The destructor.


Member Function Documentation

void chomp::homology::BitFields::allocate ( int  dim  )  [private]

Allocates the specific bit field set.

Referenced by operator[]().

void chomp::homology::BitFields::extend ( int  n  )  [private]

Extends the table to the given length if necessary.

Referenced by operator[]().

void chomp::homology::BitFields::forget ( int  dim = -1  ) 

Forgets the given bit field set or all the sets.

int chomp::homology::BitFields::getkblimit ( int  dim = 0  )  const

Returns the current limit for the given dimension.

SetOfBitFields * chomp::homology::BitFields::operator[] ( int  dim  )  [inline]

Returns the corresponding bit field set and allocates it if not used so far.

If no bit field set is in use, returns 0.

Definition at line 107 of file known.h.

References allocate(), extend(), len, maxkb, and tab.

{
        // make sure the dimension is positive
        if (dim <= 0)
                throw "Trying to get a bit field set of non-positive dim.";

        // extend the tables if necessary
        if (dim >= len)
                extend (dim + 1);

        // allocate the bit field set if necessary
        if (!tab [dim] && maxkb [dim])
                allocate (dim);

        // return the pointer to the requested bit field set
        return tab [dim];
} /* BitFields::operator [] */

void chomp::homology::BitFields::setkblimit ( int  limit = -1,
int  dim = -1 
)

Sets the limit for the number of kilobytes used for BitFields.

The limit applied to dimension < 0 is copied to all the others and can be retrieved as the limit for dimension 0. The limit for dim. 0 is the default if not defined otherwise.


Member Data Documentation

The length of the currently allocated table.

Definition at line 84 of file known.h.

Referenced by BitFields(), and operator[]().

The memory limit for each table (in kilobytes), -1 for none.

Definition at line 87 of file known.h.

Referenced by BitFields(), and operator[]().

The table of bit field sets for each dimension.

Definition at line 81 of file known.h.

Referenced by BitFields(), and operator[]().


The documentation for this class was generated from the following file: