Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SimpleHashTable< R > Class Template Reference

A simple "linear probing and insertion" hashtable. More...

#include <simplehash.h>

Inheritance diagram for SimpleHashTable:

Inheritance graph
[legend]
Collaboration diagram for SimpleHashTable< R >:

Collaboration graph
[legend]
List of all members.

Public Methods

 SimpleHashTable (uint32 size)
uint32 IntHash (uint32 key)
Find (ptrdiff_t key)
bool Insert (ptrdiff_t key, R value) throw (overflow_error)
 Inserts a key,value pair into the hash. Returns false if we try to insert a duplicate key, and returns an exception if hash is full. More...

uint32 GetCount ()
uint32 Size ()
void Clear ()

Private Attributes

uint32 size_
uint32 count
SimpleHashPair< R > * table

Detailed Description

template<class R>
class SimpleHashTable< R >

A simple "linear probing and insertion" hashtable.

This simplistic hashtable is designed as a replacement for the STL hashtable, which uses too much memory. The hashtable implements algorithm L in Knuth, Vol.3, p.526 and also uses Knuth's hash function.

Definition at line 46 of file simplehash.h.


Constructor & Destructor Documentation

template<class R>
SimpleHashTable< R >::SimpleHashTable uint32    size
 

Definition at line 66 of file simplehash.h.

References SimpleHashTable< R >::count, SimpleHashTable< R >::size_, SimpleHashTable< R >::table, and uint32.


Member Function Documentation

template<class R>
void SimpleHashTable< R >::Clear  
 

Definition at line 74 of file simplehash.h.

References SimpleHashTable< R >::count, SimpleHashTable< R >::size_, and SimpleHashTable< R >::table.

template<class R>
R SimpleHashTable< R >::Find ptrdiff_t    key
 

Definition at line 80 of file simplehash.h.

References SimpleHashTable< R >::IntHash(), SimpleHashTable< R >::size_, SimpleHashTable< R >::table, and uint32.

Referenced by WebNode::NormalizeRawLinks().

template<class R>
uint32 SimpleHashTable< R >::GetCount   [inline]
 

Definition at line 54 of file simplehash.h.

template<class R>
bool SimpleHashTable< R >::Insert ptrdiff_t    key,
  value
throw (overflow_error)
 

Inserts a key,value pair into the hash. Returns false if we try to insert a duplicate key, and returns an exception if hash is full.

Definition at line 96 of file simplehash.h.

References uint32.

template<class R>
uint32 SimpleHashTable< R >::IntHash uint32    key
 

Definition at line 117 of file simplehash.h.

References uint32.

Referenced by SimpleHashTable< R >::Find().

template<class R>
uint32 SimpleHashTable< R >::Size   [inline]
 

Definition at line 55 of file simplehash.h.


Member Data Documentation

template<class R>
uint32 SimpleHashTable< R >::count [private]
 

Definition at line 60 of file simplehash.h.

Referenced by SimpleHashTable< R >::Clear(), SimpleHashTable< char * >::GetCount(), and SimpleHashTable< R >::SimpleHashTable().

template<class R>
uint32 SimpleHashTable< R >::size_ [private]
 

Definition at line 59 of file simplehash.h.

Referenced by SimpleHashTable< R >::Clear(), SimpleHashTable< R >::Find(), SimpleHashTable< R >::SimpleHashTable(), and SimpleHashTable< char * >::Size().

template<class R>
SimpleHashPair<R>* SimpleHashTable< R >::table [private]
 

Definition at line 61 of file simplehash.h.

Referenced by SimpleHashTable< R >::Clear(), SimpleHashTable< R >::Find(), and SimpleHashTable< R >::SimpleHashTable().


Generated on Wed May 29 11:37:28 2002 for MarkovPR by doxygen1.2.15