csHashReversible< T, K, KeyHandler, ReverseKeyHandler > Class Template Reference
A csHash<> that maintains a reverse hash for indexing keys by values. More...
#include <csutil/hashr.h>
Inheritance diagram for csHashReversible< T, K, KeyHandler, ReverseKeyHandler >:

Public Member Functions | |
csHashReversible (int size=23, int grow_rate=5, int max_size=20000) | |
Construct a hash table with an array of the given size, which for optimisation reasons should be a prime number. | |
void | Put (const K &key, const T &value) |
Add an element to the hash and reverse table. | |
const K * | GetKeyPointer (const T &key) const |
Get a pointer to the first key matching the given value, or 0 if there is none. | |
const K & | GetKey (const T &key, const K &fallback) const |
Get the first key matching the given value, or fallback if there is none. |
Detailed Description
template<class T, class K = uint32, class KeyHandler = csIntegralHashKeyHandler<K>, class ReverseKeyHandler = csIntegralHashKeyHandler<T>>
class csHashReversible< T, K, KeyHandler, ReverseKeyHandler >
A csHash<> that maintains a reverse hash for indexing keys by values.
Definition at line 33 of file hashr.h.
Constructor & Destructor Documentation
|
Construct a hash table with an array of the given size, which for optimisation reasons should be a prime number. Grow_rate is the rate at which the hash table grows: Size doubles once there are size/grow_rate collisions. It will not grow after it reaches max_size. Here are a few primes: 7, 11, 19, 29, 59, 79, 101, 127, 151, 199, 251, 307, 401, 503, 809, 1009, 1499, 2003, 3001, 5003, 12263, 25247, 36923, 50119, 70951, 90313, 104707. For a bigger list go to http://www.utm.edu/research/primes/ |
Member Function Documentation
|
Get the first key matching the given value, or
Definition at line 77 of file hashr.h. References csHash< T, K, KeyHandler >::Get(). |
|
Get a pointer to the first key matching the given value, or 0 if there is none.
Definition at line 68 of file hashr.h. References csHash< T, K, KeyHandler >::GetElementPointer(). |
|
Add an element to the hash and reverse table.
Reimplemented from csHash< T, K, KeyHandler >. Definition at line 58 of file hashr.h. References csHash< T, K, KeyHandler >::Put(). |
The documentation for this class was generated from the following file:
- csutil/hashr.h
Generated for Crystal Space by doxygen 1.3.9.1