Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WvHashTable< T, K, Accessor, Comparator > Class Template Reference

#include <wvhashtable.h>

Inherits WvHashTableBase.

Collaboration diagram for WvHashTable< T, K, Accessor, Comparator >:

[legend]
List of all members.

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
class WvHashTable< T, K, Accessor, Comparator >


Public Types

typedef WvSorter< T, WvHashTableBase,
WvHashTableBase::IterBase > 
Sorter

Public Member Functions

 WvHashTable (unsigned _numslots)
 Creates a hash table.

WvList< T > * sl ()
virtual ~WvHashTable ()
void add (T *data, bool auto_free)
WvLink * getlink (const K &key)
T * operator[] (const K &key) const
void remove (const T *data)
void zap ()
size_t count () const
 Returns the number of elements in the hash table.

bool isempty () const
 Returns true if the hash table is empty.


Public Attributes

unsigned numslots
WvListBase * wvslots

Protected Types

typedef Comparator< K > MyComparator

Protected Member Functions

unsigned hash (const T *data)
virtual bool compare (const void *key, const void *elem) const
void setup ()
void shutdown ()
WvLink * prevlink (WvListBase *slots, const void *data, unsigned hash) const
void * genfind (WvListBase *slots, const void *data, unsigned hash) const

Member Typedef Documentation

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
typedef Comparator<K> WvHashTable< T, K, Accessor, Comparator >::MyComparator [protected]
 

Definition at line 175 of file wvhashtable.h.

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
typedef class WvSorter< T, WvHashTableBase, WvHashTableBase::IterBase > WvHashTable< T, K, Accessor, Comparator >::Sorter
 

Definition at line 233 of file wvhashtable.h.


Constructor & Destructor Documentation

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
WvHashTable< T, K, Accessor, Comparator >::WvHashTable (  unsigned  _numslots  )  [inline]
 

Creates a hash table.

"numslots" is the suggested number of slots

Definition at line 190 of file wvhashtable.h.

References WvHashTableBase::setup().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
virtual WvHashTable< T, K, Accessor, Comparator >::~WvHashTable (   )  [inline, virtual]
 

Definition at line 196 of file wvhashtable.h.

References WvHashTableBase::shutdown(), and WvHashTable< T, K, Accessor, Comparator >::sl().


Member Function Documentation

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
void WvHashTable< T, K, Accessor, Comparator >::add (  T *  data,
bool  auto_free
)  [inline]
 

Definition at line 199 of file wvhashtable.h.

References WvHashTable< T, K, Accessor, Comparator >::add(), and WvHashTable< T, K, Accessor, Comparator >::sl().

Referenced by WvHashTable< T, K, Accessor, Comparator >::add().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
virtual bool WvHashTable< T, K, Accessor, Comparator >::compare (  const void *  key,
const void *  elem
)  const [inline, protected, virtual]
 

Implements WvHashTableBase.

Definition at line 180 of file wvhashtable.h.

References WvHashTable< T, K, Accessor, Comparator >::compare().

Referenced by WvHashTable< T, K, Accessor, Comparator >::compare().

size_t WvHashTableBase::count (   )  const [inherited]
 

Returns the number of elements in the hash table.

Returns: the number of elements

Definition at line 79 of file wvhashtable.cc.

References WvListBase::count(), WvHashTableBase::count(), WvHashTableBase::numslots, and WvHashTableBase::wvslots.

Referenced by WvHashTableBase::count().

void * WvHashTableBase::genfind (  WvListBase *  slots,
const void *  data,
unsigned  hash
)  const [protected, inherited]
 

Definition at line 68 of file wvhashtable.cc.

References WvLink::data, WvHashTableBase::genfind(), WvLink::next, and WvHashTableBase::prevlink().

Referenced by WvHashTableBase::genfind().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
WvLink* WvHashTable< T, K, Accessor, Comparator >::getlink (  const K &  key  )  [inline]
 

Definition at line 202 of file wvhashtable.h.

References WvHashTable< T, K, Accessor, Comparator >::getlink(), WvLink::next, and WvHash().

Referenced by WvHashTable< T, K, Accessor, Comparator >::getlink().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
unsigned WvHashTable< T, K, Accessor, Comparator >::hash (  const T *  data  )  [inline, protected]
 

Definition at line 177 of file wvhashtable.h.

References WvHashTable< T, K, Accessor, Comparator >::hash(), and WvHash().

Referenced by WvHashTable< T, K, Accessor, Comparator >::hash().

bool WvHashTableBase::isempty (   )  const [inherited]
 

Returns true if the hash table is empty.

Returns: true if empty

Definition at line 89 of file wvhashtable.cc.

References WvListBase::isempty(), WvHashTableBase::numslots, and WvHashTableBase::wvslots.

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
T* WvHashTable< T, K, Accessor, Comparator >::operator[] (  const K &  key  )  const [inline]
 

Definition at line 205 of file wvhashtable.h.

References WvHash().

WvLink * WvHashTableBase::prevlink (  WvListBase *  slots,
const void *  data,
unsigned  hash
)  const [protected, inherited]
 

Definition at line 52 of file wvhashtable.cc.

References WvHashTableBase::compare(), WvListBase::IterBase::cur(), WvLink::data, WvListBase::IterBase::next(), WvLink::next, WvHashTableBase::numslots, WvHashTableBase::prevlink(), and WvListBase::IterBase::rewind().

Referenced by WvHashTableBase::genfind(), and WvHashTableBase::prevlink().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
void WvHashTable< T, K, Accessor, Comparator >::remove (  const T *  data  )  [inline]
 

Definition at line 208 of file wvhashtable.h.

References WvLink::next, WvHashTable< T, K, Accessor, Comparator >::remove(), and WvHashTable< T, K, Accessor, Comparator >::sl().

Referenced by WvHashTable< T, K, Accessor, Comparator >::remove().

void WvHashTableBase::setup (   )  [inline, protected, inherited]
 

Definition at line 98 of file wvhashtable.h.

Referenced by WvHashTable< T, K, Accessor, Comparator >::WvHashTable().

void WvHashTableBase::shutdown (   )  [inline, protected, inherited]
 

Definition at line 100 of file wvhashtable.h.

Referenced by WvHashTable< T, K, Accessor, Comparator >::~WvHashTable().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
WvList<T>* WvHashTable< T, K, Accessor, Comparator >::sl (   )  [inline]
 

Definition at line 193 of file wvhashtable.h.

Referenced by WvHashTable< T, K, Accessor, Comparator >::add(), WvHashTable< T, K, Accessor, Comparator >::remove(), WvHashTable< T, K, Accessor, Comparator >::zap(), and WvHashTable< T, K, Accessor, Comparator >::~WvHashTable().

template<class T, class K, class Accessor, template< class > class Comparator = OpEqComp>
void WvHashTable< T, K, Accessor, Comparator >::zap (   )  [inline]
 

Definition at line 215 of file wvhashtable.h.

References WvHashTable< T, K, Accessor, Comparator >::sl().


Member Data Documentation

unsigned WvHashTableBase::numslots [inherited]
 

Definition at line 107 of file wvhashtable.h.

Referenced by WvHashTableBase::count(), WvHashTableBase::isempty(), WvHashTableBase::IterBase::next(), WvHashTableBase::prevlink(), and WvHashTableBase::WvHashTableBase().

WvListBase* WvHashTableBase::wvslots [inherited]
 

Definition at line 108 of file wvhashtable.h.

Referenced by WvHashTableBase::count(), WvHashTableBase::isempty(), WvHashTableBase::IterBase::next(), and WvHashTableBase::IterBase::rewind().


The documentation for this class was generated from the following file:
Generated on Tue Oct 5 01:09:26 2004 for WvStreams by doxygen 1.3.7