#include <TValHashMapT.hh>
Public Methods | |
TValHashMapT () | |
Constructs an empty hash map. | |
TValHashMapT (const TValHashMapT< K, V, U > &map) | |
Copy constructor. | |
~TValHashMapT () | |
Destructor. | |
void | Apply (void(*fn)(const K *, V *, void *), void *d) |
Applies the user defined function to every key, value pair in self. | |
void | Clear () |
Removes all keys from self. | |
bool | Contains (const K &k) |
Check if there exists a key in self that compares equal to k. | |
int | Entries () |
Query number of keys in self. | |
bool | FindValue (const K &k, V &v) |
Find value associated with key. | |
bool | Insert (const K &k, const V &v) |
Insert a key, value pair to the collection. | |
bool | Remove (const K &k) |
Remove a key from the collection. | |
void | Shrink (bool flag) |
Enable or dissable shrinking of bucket array when keys are removed. | |
V & | operator[] (const K &k) |
Index operator. | |
TValHashMapT< K, V, U > & | operator= (const TValHashMapT< K, V, U > &map) |
Assignment operator. |
The class U should contain the static methods Hash and Equal to calculate the hash of K objects and to compare K objects for equality.
|
Applies the user defined function to every key, value pair in self.
|
|
Check if there exists a key in self that compares equal to k.
|
|
Query number of keys in self.
|
|
Find value associated with key. If the key is not found, v is not updated.
|
|
Insert a key, value pair to the collection.
|
|
Index operator. Returns a reference to the value associated with the key k. The value may be modified. |
|
Remove a key from the collection.
|
|
Enable or dissable shrinking of bucket array when keys are removed. This saves memory but costs some CPU time. It is enabled by default.
|