Classes | Namespaces | Defines | Functions

hashsets.h File Reference

This file contains the definition of the container "hashedset" which can be used to represent a set of elements of arbitrary type. More...

#include "chomp/system/config.h"
#include "chomp/system/textfile.h"
#include "chomp/struct/multitab.h"
#include <cstdlib>
#include <ctime>
#include <iostream>

Go to the source code of this file.

Classes

class  chomp::homology::hashstat
 This is a small class used to gather and display hashing statistics for the hashing tables in the class "hashedset". More...
class  chomp::homology::hashedset< element >
 This is a template for a set of objects of the given type. More...
class  chomp::homology::mvmap< domelement, imgelement >
 This class defines a multivalued map. More...

Namespaces

namespace  chomp
 

This namespace contains the entire CHomP library interface.


namespace  chomp::homology
 

This namespace contains the core of the homology computation procedures and related classes and templates contained in the CHomP C++ library.


Defines

#define SMALL_SIZE   true
 This constant passed to the function 'write' makes the hashed set be displayed in a way that is appropriate for small sets: the entire set is enclosed in braces, and elements are written on one line separated by commas.
#define LARGE_SIZE   false
 This constant passed to the function 'write' makes the hashed set be displayed in a way that is appropriate for large sets: each element is displayed in a separate line, and the elements are preceded by a comment in which the number of elements is indicated and hashing statistics are written.
#define DEFHASHKEYS(type)
 This macro is used to define a hash key for any type that can be cast onto an unsigned inteter type, in particular, in the library it is used to define the hash key functions for int, long, and char, both signed and unsigned.

Functions

std::ostream & chomp::homology::operator<< (std::ostream &out, const hashstat &s)
 Shows hashing statistics in a concise and readable way to the output stream in the text format.
template<class stream , class element >
stream & chomp::homology::write (stream &out, const hashedset< element > &s, bool size)
 Writes the entire hashed set to an output stream in the text mode.
template<class element >
std::ostream & chomp::homology::operator<< (std::ostream &out, const hashedset< element > &s)
 Writes a hashed set to an output stream as a large one (each element is written on a separate line, with some comments at the beginning).
template<class stream , class element >
stream & chomp::homology::read (stream &in, hashedset< element > &s, bool size)
 Reads a hashed set from an input stream, either a small size style or a large one.
template<class element >
std::istream & chomp::homology::operator>> (std::istream &in, hashedset< element > &s)
 Reads a hashed set from an input stream in a large size style (each element occupies one line, any comments are ignored).
template<class element >
hashedset< element > & chomp::homology::operator+= (hashedset< element > &s, const hashedset< element > &u)
 Operator += adds one hashed set to another.
template<class element >
hashedset< element > & chomp::homology::operator-= (hashedset< element > &s, const hashedset< element > &u)
 Operator -= removes the contents of one set from another.
int_t chomp::homology::hashkey1 (const unsigned long &number)
 The first hash key for an unsigned int number.
int_t chomp::homology::hashkey2 (const unsigned long &number)
 The second hash key for an unsigned int number.
int_t chomp::homology::hashkey1 (const unsigned int &number)
int_t chomp::homology::hashkey2 (const unsigned int &number)
int_t chomp::homology::hashkey1 (const signed int &number)
int_t chomp::homology::hashkey2 (const signed int &number)
int_t chomp::homology::hashkey1 (const signed long &number)
int_t chomp::homology::hashkey2 (const signed long &number)
int_t chomp::homology::hashkey1 (const unsigned short &number)
int_t chomp::homology::hashkey2 (const unsigned short &number)
int_t chomp::homology::hashkey1 (const signed short &number)
int_t chomp::homology::hashkey2 (const signed short &number)
int_t chomp::homology::hashkey1 (const unsigned char &number)
int_t chomp::homology::hashkey2 (const unsigned char &number)
int_t chomp::homology::hashkey1 (const signed char &number)
int_t chomp::homology::hashkey2 (const signed char &number)
template<class T >
int_t chomp::homology::hashkey1 (const T &x)
 A template function that extracts the first hash key from an object which has the method "hashkey1".
template<class T >
int_t chomp::homology::hashkey2 (const T &x)
 A template function that extracts the second hash key from an object which has the method "hashkey2".
template<class domelement , class imgelement >
hashedset< imgelement > & chomp::homology::retrieveimage (const mvmap< domelement, imgelement > &m, hashedset< imgelement > &img)
 Adds images of all the elements from the domain of the map to 'img'.
template<class domelement , class imgelement >
hashedset< imgelement > & chomp::homology::creategraph (const mvmap< domelement, imgelement > &m, hashedset< imgelement > &graph)
 Adds a graph of a multivalued map to the given set.
template<class domelement , class imgelement >
std::istream & chomp::homology::readdomain (std::istream &in, hashedset< domelement > &dom, const mvmap< domelement, imgelement > &)
 Reads the domain of a multivalued map.
template<class domelement , class imgelement >
std::istream & chomp::homology::readimage (std::istream &in, hashedset< imgelement > &img, const mvmap< domelement, imgelement > &)
 Reads the image of a multivalued map.
template<class domelement , class imgelement >
std::istream & chomp::homology::readselective (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom1, const hashedset< domelement > &dom2)
 Reads a restriction of a multivalued map to the union of the given sets.
template<class domelement , class imgelement >
std::istream & chomp::homology::readrestriction (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom, const hashedset< imgelement > &img)
 Reads a restriction of a multivalued map to the two given sets.
template<class domelement , class imgelement >
std::istream & chomp::homology::readselective (std::istream &in, mvmap< domelement, imgelement > &m, const hashedset< domelement > &dom)
 Reads a restriction of a multivalued map to the given set.
template<class domelement , class imgelement >
std::ostream & chomp::homology::operator<< (std::ostream &out, const mvmap< domelement, imgelement > &m)
 Writes a multivalued map to the output stream.
template<class domelement , class imgelement >
std::istream & chomp::homology::operator>> (std::istream &in, mvmap< domelement, imgelement > &m)
 Reads a multivalued map from an input stream.

Detailed Description

This file contains the definition of the container "hashedset" which can be used to represent a set of elements of arbitrary type.

Hashing tables are used to access the elements in an efficient way.

Based on the container "hashedset", the container "mvmap" is also defined. It represents a multivalued map which maps each element in its domain to a set of elements contained in its codomain.

Author:
Pawel Pilarczyk

Definition in file hashsets.h.


Define Documentation

#define DEFHASHKEYS (   type  ) 
Value:
inline int_t hashkey1 (const type &number) \
{ return hashkey1 (static_cast<const unsigned long> (number)); } \
inline int_t hashkey2 (const type &number) \
{ return hashkey2 (static_cast<const unsigned long> (number)); }

This macro is used to define a hash key for any type that can be cast onto an unsigned inteter type, in particular, in the library it is used to define the hash key functions for int, long, and char, both signed and unsigned.

Definition at line 890 of file hashsets.h.

#define LARGE_SIZE   false

This constant passed to the function 'write' makes the hashed set be displayed in a way that is appropriate for large sets: each element is displayed in a separate line, and the elements are preceded by a comment in which the number of elements is indicated and hashing statistics are written.

Definition at line 762 of file hashsets.h.

Referenced by chomp::homology::operator<<(), chomp::homology::operator>>(), and chomp::homology::ReadCubes().

#define SMALL_SIZE   true

This constant passed to the function 'write' makes the hashed set be displayed in a way that is appropriate for small sets: the entire set is enclosed in braces, and elements are written on one line separated by commas.

Definition at line 755 of file hashsets.h.

Referenced by chomp::homology::operator<<(), chomp::homology::operator>>(), chomp::homology::read(), chomp::homology::ReadCubicalMap(), chomp::homology::readimage(), chomp::homology::readrestriction(), chomp::homology::readselective(), and chomp::homology::write().