#include <hash.h>
Public Member Functions | |
Hash (int sizeHint=8) | |
Object constructor; specify initial size of hash table or default to 8. | |
void | AddItem (int key, void *value) |
Add an item, based on key. | |
void * | GetItem (int key) |
Get the item associated with key. | |
void * | ReplaceItem (int key, void *value) |
Replace the item associated with key, returning old item. | |
int | Dump (OnDisk *pOnDisk) |
Dump the hash table to disk. | |
void | CallAll (void(*f)(int key, void *value)) |
Call function (*f)(key,value) for each hash table entry. | |
Classes | |
class | CollisionNode |
Class Hash implements a hash table. The hash table key is a 32-bit integer, such as an Id. Note: Keys must be unique.
TODO: Probably Hash should be a template. Then instead of using void * we could use a typed parameter.
Limitations:
Responsibilities:
|
Object constructor; specify initial size of hash table or default to 8.
|
|
Add an item, based on key.
|
|
Call function (*f)(key,value) for each hash table entry.
|
|
Dump the hash table to disk.
|
|
Get the item associated with key.
|
|
Replace the item associated with key, returning old item.
|