The Original CHomP Software
|
A container for elements placed in a table (like a vector) that is actually built of many smaller tables. More...
#include <multitab.h>
Public Member Functions | |
multitable (int piecesize=0) | |
The default constructor for a table with the given size of each piece (should be a power of 2 or is rounded up). More... | |
multitable (const multitable< element > &m) | |
The copy constructor. More... | |
multitable< element > & | operator= (const multitable< element > &m) |
The assignment operator. More... | |
~multitable () | |
The destructor. More... | |
element & | operator[] (int_t n) |
Returns a reference of an element for reading/writing. More... | |
const element & | operator() (int_t n) const |
Returns a reference of an element for reading only. More... | |
const element & | operator[] (int_t n) const |
Returns a reference of an element for reading only. More... | |
void | allocate (int_t n) |
Allocates the table for holding 'n' elements. More... | |
void | fill (const element &e, int_t n) |
Fills the table from 0 to the given index with the given element. More... | |
void | swap (multitable< element > &other) |
Swaps data with another multitable object. More... | |
Private Member Functions | |
void | increase (int_t n) |
Increases the number of pieces to the desired one. More... | |
Private Attributes | |
int_t | npieces |
The number of pieces ready to allocate. More... | |
int | shiftbits |
The number of bits to shift the index of an element in the table. More... | |
int | offsetmask |
The mask to get the offset of an element in a table piece. More... | |
element ** | tab |
The actual tables. More... | |
A container for elements placed in a table (like a vector) that is actually built of many smaller tables.
This may be important for good memory allocation. The table extends automatically upon use of elements that are outside the range of its indices.
Definition at line 64 of file multitab.h.
|
inline |
The default constructor for a table with the given size of each piece (should be a power of 2 or is rounded up).
Definition at line 126 of file multitab.h.
References DEFAULTPIECESIZE.
chomp::homology::multitable< element >::multitable | ( | const multitable< element > & | m | ) |
The copy constructor.
Definition at line 140 of file multitab.h.
References chomp::homology::multitable< element >::npieces, chomp::homology::multitable< element >::shiftbits, and chomp::homology::multitable< element >::tab.
|
inline |
void chomp::homology::multitable< element >::allocate | ( | int_t | n | ) |
Allocates the table for holding 'n' elements.
The table is still able to grow further if necessary.
Definition at line 390 of file multitab.h.
void chomp::homology::multitable< element >::fill | ( | const element & | e, |
int_t | n | ||
) |
Fills the table from 0 to the given index with the given element.
Definition at line 414 of file multitab.h.
|
private |
Increases the number of pieces to the desired one.
Definition at line 450 of file multitab.h.
|
inline |
Returns a reference of an element for reading only.
Throws an error message if the index is out of range.
Definition at line 369 of file multitab.h.
multitable< element > & chomp::homology::multitable< element >::operator= | ( | const multitable< element > & | m | ) |
The assignment operator.
Definition at line 167 of file multitab.h.
|
inline |
Returns a reference of an element for reading/writing.
If the index is out of range, the table is automatically extended.
Definition at line 340 of file multitab.h.
|
inline |
Returns a reference of an element for reading only.
Throws an error message if the index is out of range.
Definition at line 384 of file multitab.h.
|
inline |
Swaps data with another multitable object.
Definition at line 440 of file multitab.h.
References chomp::multiwork::swap().
|
private |
The number of pieces ready to allocate.
Definition at line 106 of file multitab.h.
Referenced by chomp::homology::multitable< element >::multitable().
|
private |
The mask to get the offset of an element in a table piece.
Definition at line 113 of file multitab.h.
|
private |
The number of bits to shift the index of an element in the table.
Definition at line 110 of file multitab.h.
Referenced by chomp::homology::multitable< element >::multitable().
|
private |
The actual tables.
Definition at line 116 of file multitab.h.
Referenced by chomp::homology::multitable< element >::multitable().