WvStreams
Classes | Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | List of all members
WvHashTable< T, K, Accessor, Comparator > Class Template Reference
Inheritance diagram for WvHashTable< T, K, Accessor, Comparator >:
Inheritance graph
[legend]

Classes

class  Iter
 

Public Types

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

Public Member Functions

 WvHashTable (unsigned _numslots)
 Creates a hash table.
 
WvList< T > * sl ()
 
void add (T *data, bool autofree)
 
WvLink * getlink (const K &key)
 
T * operator[] (const K &key) const
 
bool get_autofree (const K &key) const
 Returns the state of autofree for the element associated with key.
 
bool get_autofree (const T *data) const
 
void set_autofree (const K &key, bool autofree)
 Sets the state of autofree for the element associated with key.
 
void set_autofree (const T *data, bool autofree)
 
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
 

Detailed Description

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

Definition at line 168 of file wvhashtable.h.

Member Typedef Documentation

◆ MyComparator

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 173 of file wvhashtable.h.

◆ Sorter

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 263 of file wvhashtable.h.

Constructor & Destructor Documentation

◆ WvHashTable()

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 188 of file wvhashtable.h.

◆ ~WvHashTable()

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

Definition at line 194 of file wvhashtable.h.

Member Function Documentation

◆ hash()

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

Definition at line 175 of file wvhashtable.h.

◆ compare()

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
inlineprotectedvirtual

Implements WvHashTableBase.

Definition at line 178 of file wvhashtable.h.

◆ sl()

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

Definition at line 191 of file wvhashtable.h.

◆ add()

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

Definition at line 197 of file wvhashtable.h.

◆ getlink()

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 200 of file wvhashtable.h.

◆ operator[]()

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 203 of file wvhashtable.h.

◆ get_autofree() [1/2]

template<class T , class K , class Accessor , template< class > class Comparator = OpEqComp>
bool WvHashTable< T, K, Accessor, Comparator >::get_autofree ( const K &  key) const
inline

Returns the state of autofree for the element associated with key.

Definition at line 209 of file wvhashtable.h.

◆ get_autofree() [2/2]

template<class T , class K , class Accessor , template< class > class Comparator = OpEqComp>
bool WvHashTable< T, K, Accessor, Comparator >::get_autofree ( const T *  data) const
inline

Definition at line 217 of file wvhashtable.h.

◆ set_autofree() [1/2]

template<class T , class K , class Accessor , template< class > class Comparator = OpEqComp>
void WvHashTable< T, K, Accessor, Comparator >::set_autofree ( const K &  key,
bool  autofree 
)
inline

Sets the state of autofree for the element associated with key.

Definition at line 225 of file wvhashtable.h.

◆ set_autofree() [2/2]

template<class T , class K , class Accessor , template< class > class Comparator = OpEqComp>
void WvHashTable< T, K, Accessor, Comparator >::set_autofree ( const T *  data,
bool  autofree 
)
inline

Definition at line 232 of file wvhashtable.h.

◆ remove()

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 237 of file wvhashtable.h.

◆ zap()

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

Definition at line 244 of file wvhashtable.h.

◆ setup()

void WvHashTableBase::setup ( )
inlineprotectedinherited

Definition at line 96 of file wvhashtable.h.

◆ shutdown()

void WvHashTableBase::shutdown ( )
inlineprotectedinherited

Definition at line 98 of file wvhashtable.h.

◆ prevlink()

WvLink * WvHashTableBase::prevlink ( WvListBase *  slots,
const void *  data,
unsigned  hash 
) const
protectedinherited

Definition at line 24 of file wvhashtable.cc.

◆ genfind()

void * WvHashTableBase::genfind ( WvListBase *  slots,
const void *  data,
unsigned  hash 
) const
protectedinherited

Definition at line 40 of file wvhashtable.cc.

◆ count()

size_t WvHashTableBase::count ( ) const
inherited

Returns the number of elements in the hash table.

Returns: the number of elements

Definition at line 51 of file wvhashtable.cc.

References WvHashTableBase::count().

Referenced by WvHashTableBase::count().

◆ isempty()

bool WvHashTableBase::isempty ( ) const
inherited

Returns true if the hash table is empty.

Returns: true if empty

Definition at line 61 of file wvhashtable.cc.

References WvHashTableBase::isempty().

Referenced by WvHashTableBase::isempty().

Member Data Documentation

◆ numslots

unsigned WvHashTableBase::numslots
inherited

Definition at line 107 of file wvhashtable.h.

◆ wvslots

WvListBase* WvHashTableBase::wvslots
inherited

Definition at line 108 of file wvhashtable.h.


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