PointerHashTable< T > Class Template Reference

A HashTable for pointers only. <short description="">. More...

#include <PointerHashTable.hpp>

List of all members.


Public Member Functions

 PointerHashTable (int siz)
void put (T &elem, unsigned int key)
std::list< T > & get (unsigned int key)
void unlinkElementsForKey (const unsigned int key)
void freeElementsForKey (const unsigned int key)

Protected Member Functions

void freeElementsForPos (const unsigned int p)
 calls delete for every element assigned to

Detailed Description

template<class T>
class PointerHashTable< T >

A HashTable for pointers only. <short description="">.

Hashing is done with a simple MODULO operation. If a collision occurs, the element is inserted into an overflow list but only if it has the same key than all the other elements at that position.

Author:
Peter Schojer
Version:
Id
PointerHashTable.hpp,v 1.8 2006/01/20 15:37:17 mkropfbe Exp

Definition at line 60 of file PointerHashTable.hpp.


Member Function Documentation

template<class T>
void PointerHashTable< T >::freeElementsForPos const unsigned int  p  )  [inline, protected]
 

calls delete for every element assigned to

Parameters:
pos 
Definition at line 117 of file PointerHashTable.hpp.
00117 { 00118 unsigned int pos=p%size; 00119 if(!data[pos].empty()) { 00120 list<T>::iterator li; 00121 while(!data[pos].empty()) { 00122 li=data[pos].begin(); 00123 if(*li) 00124 delete (*li); 00125 data[pos].pop_front(); 00126 } 00127 } 00128 };


The documentation for this class was generated from the following file: