Hash Class Reference

Implementation of a hash table. More...

#include <hash.h>

List of all members.

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


Detailed Description

Implementation of a hash table.

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:


Constructor & Destructor Documentation

Hash::Hash int  sizeHint = 8  ) 
 

Object constructor; specify initial size of hash table or default to 8.


Member Function Documentation

void Hash::AddItem int  key,
void *  value
 

Add an item, based on key.

void Hash::CallAll void(*)(int key, void *value)  f  ) 
 

Call function (*f)(key,value) for each hash table entry.

int Hash::Dump OnDisk pOnDisk  ) 
 

Dump the hash table to disk.

void * Hash::GetItem int  key  ) 
 

Get the item associated with key.

void * Hash::ReplaceItem int  key,
void *  value
 

Replace the item associated with key, returning old item.


The documentation for this class was generated from the following files:
Generated on Sun Oct 8 09:32:10 2006 for gabbie by  doxygen 1.4.6