casacore
|
Hash function with state. More...
#include <HashMap.h>
Public Member Functions | |
virtual uInt | hash (const key &)=0 |
This function maps elements of key type to any integer. More... | |
virtual HashClass< key > * | clone () const =0 |
This function is used to make a deep copy. More... | |
HashClass () | |
virtual | ~HashClass () |
Hash function with state.
Public interface
This is basically a way of specifying a hash function, but it is implemented as a class. Thus it is called HashClass, similar to "hash function".
This class is used to specify a hash function. Sometimes a hash function may require state, it may be useful to create a hierarchy of hash functions, or it may be useful to create a class which provides for hashing as well as other functionality. This class can be used as a base class for any of these purposed. This class is intended for parameterization of HashMap.
The hash function maps the key type to any integer. This integer is then used by HashMap to select a bucket in the hash table.
If one wished to make a HashClass for integers, something like the following might be done:
There may be occasions when it is more convenient to use a class instead of a single function. This base class provides a starting point plus, and HashMap<k,v>
has the necessary hooks to make use of classes derived from this class.
casacore::HashClass< key >::HashClass | ( | ) |
|
virtual |
|
pure virtual |
This function is used to make a deep copy.
This means that the copy, which this function returns, contains all derived information.
|
pure virtual |
This function maps elements of key
type to any integer.
This integer is then used by HashMap to select a bucket in the hash table.