Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::genstruct::HashTable< K, T, H > Class Template Reference

#include <elm/genstruct/HashTable.h>

Classes

class  Iterator
 
class  KeyIterator
 
class  PairIterator
 
class  SameKeyIterator
 

Public Member Functions

 HashTable (int _size=211)
 
 ~HashTable (void)
 
bool isEmpty (void) const
 
int count (void) const
 
Option< T > get (const K &key)
 
const T get (const K &key, const T &def_value)
 
bool hasKey (const K &key)
 
bool exists (const K &key)
 
Ref operator[] (const K &key)
 
void put (const K &key, const T &value)
 
void add (const K &key, const T &value)
 
void putAll (const HashTable< K, T, H > &htab)
 
void remove (const K &key)
 
void clear (void)
 

Detailed Description

template<class K, class T, class H = HashKey<K>>
class elm::genstruct::HashTable< K, T, H >

This class provides an hashing table implementation as an array of linked list. A small caching feature put to the head of the linked list last accessed items.

Parameters
KType of the keys.
TType of stored data.
HClass implementing hash concept (default to HashKey).

Constructor & Destructor Documentation

template<class K, class T, class H = HashKey<K>>
elm::genstruct::HashTable< K, T, H >::HashTable ( int  _size = 211)
template<class K, class T, class H = HashKey<K>>
elm::genstruct::HashTable< K, T, H >::~HashTable ( void  )

Member Function Documentation

template<class K, class T, class H = HashKey<K>>
void elm::genstruct::HashTable< K, T, H >::add ( const K &  key,
const T &  value 
)

Add an item to the table. If an item already exists with the same key, it is only hidden and may appear again if the added item is removed.

Parameters
keyKey of the item to add.
valueValue of the item to add.

Referenced by elm::genstruct::HashTable< const void *, int >::put().

template<class K, class T, class H = HashKey<K>>
void elm::genstruct::HashTable< K, T, H >::clear ( void  )
template<class K, class T, class H = HashKey<K>>
int elm::genstruct::HashTable< K, T, H >::count ( void  ) const
template<class K, class T, class H = HashKey<K>>
bool elm::genstruct::HashTable< K, T, H >::exists ( const K &  key)
template<class K, class T, class H = HashKey<K>>
const T elm::genstruct::HashTable< K, T, H >::get ( const K &  key,
const T &  def_value 
)
template<class K, class T, class H = HashKey<K>>
bool elm::genstruct::HashTable< K, T, H >::hasKey ( const K &  key)

Test if there is an item with the given in the table.

Parameters
keyKey to look for.
Returns
True if the key found, false else.

Referenced by elm::serial2::XOMSerializer::beginObject(), elm::genstruct::HashTable< const void *, int >::exists(), elm::serial2::XOMSerializer::flush(), and elm::serial2::XOMSerializer::onPointer().

template<class K, class T, class H = HashKey<K>>
bool elm::genstruct::HashTable< K, T, H >::isEmpty ( void  ) const
template<class K, class T, class H = HashKey<K>>
Ref elm::genstruct::HashTable< K, T, H >::operator[] ( const K &  key)
template<class K, class T, class H = HashKey<K>>
void elm::genstruct::HashTable< K, T, H >::put ( const K &  key,
const T &  value 
)
template<class K, class T, class H = HashKey<K>>
void elm::genstruct::HashTable< K, T, H >::putAll ( const HashTable< K, T, H > &  htab)
template<class K, class T, class H = HashKey<K>>
void elm::genstruct::HashTable< K, T, H >::remove ( const K &  key)

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