This class defines a multivalued map. More...
#include <hashsets.h>
Public Member Functions | |
mvmap (int bequiet=1) | |
The default constructor. | |
~mvmap () | |
The destructor. | |
const domelement & | get (int_t n) const |
Retrieves the n-th element from the domain for reading only. | |
const hashedset< domelement > & | getdomain () const |
Retrieves the domain of the map for reading only. | |
const hashedset< imgelement > & | operator() (int_t n) const |
Retrieve the image of the n-th element for reading only. | |
const hashedset< imgelement > & | operator() (const domelement &x) const |
Retrieve the image of an element for reading only. | |
hashedset< imgelement > & | operator[] (int_t n) |
Returns the image of the n-th element for writing. | |
hashedset< imgelement > & | operator[] (const domelement &x) |
Returns the image of an element for writing. | |
int_t | size () const |
Returns the number of elements in the domain of the map. | |
bool | remove (const domelement &x) |
Removes an element from the domain of the map. | |
bool | removenum (int_t n) |
Removes the n-th element from the domain of the map. | |
void | remove (const hashedset< domelement > &x) |
Removes a set of elements from the domain of the map. | |
void | swap (mvmap< domelement, imgelement > &other) |
Swaps the internal data of two multivalued maps. | |
Public Attributes | |
int | quiet |
This variable indicates whether the map should be quiet. | |
Private Attributes | |
hashedset< domelement > | domain |
The domain of the map. | |
multitable< hashedset < imgelement > > | images |
The images of cubes from the domain. |
This class defines a multivalued map.
Each domain-type element is mapped into a hashed set of image-type elements. The images of elements can be accessed with the operator [] (for modifying) and operator () (for retrieval only). NOTE: Since the domain elements can be identified either by their value, or by their successive numbers, the domain cannot be a set of integers, because this would cause ambiguity.
Definition at line 938 of file hashsets.h.
chomp::homology::mvmap< domelement, imgelement >::mvmap | ( | int | bequiet = 1 |
) | [inline, explicit] |
The default constructor.
The argument 'bequiet' is passed to the hashed set which represents the domain of the map. If set to zero, makes the domain display statistics information.
Definition at line 1007 of file hashsets.h.
chomp::homology::mvmap< domelement, imgelement >::~mvmap | ( | ) | [inline] |
const domelement & chomp::homology::mvmap< domelement, imgelement >::get | ( | int_t | n | ) | const [inline] |
Retrieves the n-th element from the domain for reading only.
Definition at line 1020 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain, and chomp::homology::mvmap< domelement, imgelement >::size().
const hashedset< domelement > & chomp::homology::mvmap< domelement, imgelement >::getdomain | ( | ) | const [inline] |
Retrieves the domain of the map for reading only.
Definition at line 1029 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain.
{ return domain; } /* mvmap::getdomain */
const hashedset< imgelement > & chomp::homology::mvmap< domelement, imgelement >::operator() | ( | const domelement & | x | ) | const [inline] |
Retrieve the image of an element for reading only.
Throws an exception if the element is not in the domain.
Definition at line 1046 of file hashsets.h.
const hashedset< imgelement > & chomp::homology::mvmap< domelement, imgelement >::operator() | ( | int_t | n | ) | const [inline] |
Retrieve the image of the n-th element for reading only.
Throws an exception if the number is out of range.
Definition at line 1036 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain, chomp::homology::mvmap< domelement, imgelement >::images, and chomp::homology::mvmap< domelement, imgelement >::size().
hashedset< imgelement > & chomp::homology::mvmap< domelement, imgelement >::operator[] | ( | int_t | n | ) | [inline] |
Returns the image of the n-th element for writing.
Definition at line 1056 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain, chomp::homology::mvmap< domelement, imgelement >::images, and chomp::homology::mvmap< domelement, imgelement >::size().
hashedset< imgelement > & chomp::homology::mvmap< domelement, imgelement >::operator[] | ( | const domelement & | x | ) | [inline] |
Returns the image of an element for writing.
If the element is not in the domain, then it is added and a reference to its empty image is returned.
Definition at line 1066 of file hashsets.h.
bool chomp::homology::mvmap< domelement, imgelement >::remove | ( | const domelement & | x | ) | [inline] |
Removes an element from the domain of the map.
Returns true if removed, false if it was not in the domain.
Definition at line 1094 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain, and chomp::homology::mvmap< domelement, imgelement >::removenum().
void chomp::homology::mvmap< domelement, imgelement >::remove | ( | const hashedset< domelement > & | x | ) | [inline] |
Removes a set of elements from the domain of the map.
Definition at line 1101 of file hashsets.h.
bool chomp::homology::mvmap< domelement, imgelement >::removenum | ( | int_t | n | ) | [inline] |
Removes the n-th element from the domain of the map.
Definition at line 1079 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain, chomp::homology::mvmap< domelement, imgelement >::images, and chomp::homology::mvmap< domelement, imgelement >::size().
Referenced by chomp::homology::mvmap< domelement, imgelement >::remove().
: This procedure uses the specific way elements are removed from // a hashed set. If that way is changed, this procedure may not work anymore. { if ((n < 0) || (n >= domain. size ())) return false; domain. removenum (n); if (n != domain. size ()) images [n] = images [domain. size ()]; hashedset<imgelement> empty; images [domain. size ()] = empty; return true; } /* mvmap::removenum */
int_t chomp::homology::mvmap< domelement, imgelement >::size | ( | ) | const [inline] |
Returns the number of elements in the domain of the map.
Definition at line 1073 of file hashsets.h.
References chomp::homology::mvmap< domelement, imgelement >::domain.
Referenced by chomp::homology::mvmap< domelement, imgelement >::get(), chomp::homology::mvmap< domelement, imgelement >::operator()(), chomp::homology::mvmap< domelement, imgelement >::operator[](), and chomp::homology::mvmap< domelement, imgelement >::removenum().
void chomp::homology::mvmap< domelement, imgelement >::swap | ( | mvmap< domelement, imgelement > & | other | ) | [inline] |
Swaps the internal data of two multivalued maps.
Definition at line 1111 of file hashsets.h.
References chomp::multiwork::swap().
hashedset<domelement> chomp::homology::mvmap< domelement, imgelement >::domain [private] |
The domain of the map.
Definition at line 996 of file hashsets.h.
Referenced by chomp::homology::mvmap< domelement, imgelement >::get(), chomp::homology::mvmap< domelement, imgelement >::getdomain(), chomp::homology::mvmap< domelement, imgelement >::operator()(), chomp::homology::mvmap< domelement, imgelement >::operator[](), chomp::homology::mvmap< domelement, imgelement >::remove(), chomp::homology::mvmap< domelement, imgelement >::removenum(), and chomp::homology::mvmap< domelement, imgelement >::size().
multitable<hashedset<imgelement> > chomp::homology::mvmap< domelement, imgelement >::images [private] |
The images of cubes from the domain.
The order of these images is the same as the order of elements in the domain.
Definition at line 1000 of file hashsets.h.
Referenced by chomp::homology::mvmap< domelement, imgelement >::operator()(), chomp::homology::mvmap< domelement, imgelement >::operator[](), and chomp::homology::mvmap< domelement, imgelement >::removenum().
int chomp::homology::mvmap< domelement, imgelement >::quiet |
This variable indicates whether the map should be quiet.
If set to false, the map may display some additional information about hashing statistics, etc.
Definition at line 992 of file hashsets.h.