Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#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) |
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.
elm::genstruct::HashTable< K, T, H >::HashTable | ( | int | _size = 211 | ) |
elm::genstruct::HashTable< K, T, H >::~HashTable | ( | void | ) |
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.
key | Key of the item to add. |
value | Value of the item to add. |
Referenced by elm::genstruct::HashTable< const void *, int >::put().
void elm::genstruct::HashTable< K, T, H >::clear | ( | void | ) |
int elm::genstruct::HashTable< K, T, H >::count | ( | void | ) | const |
bool elm::genstruct::HashTable< K, T, H >::exists | ( | const K & | key | ) |
Referenced by elm::serial2::TextSerializer::onPointer().
Option<T> elm::genstruct::HashTable< K, T, H >::get | ( | const K & | key | ) |
const T elm::genstruct::HashTable< K, T, H >::get | ( | const K & | key, |
const T & | def_value | ||
) |
bool elm::genstruct::HashTable< K, T, H >::hasKey | ( | const K & | key | ) |
Test if there is an item with the given in the table.
key | Key to look for. |
Referenced by elm::serial2::XOMSerializer::beginObject(), elm::genstruct::HashTable< const void *, int >::exists(), elm::serial2::XOMSerializer::flush(), and elm::serial2::XOMSerializer::onPointer().
bool elm::genstruct::HashTable< K, T, H >::isEmpty | ( | void | ) | const |
Ref elm::genstruct::HashTable< K, T, H >::operator[] | ( | const K & | key | ) |
void elm::genstruct::HashTable< K, T, H >::put | ( | const K & | key, |
const T & | value | ||
) |
Put an item in the table. If there is already an item with the same key, it is replaced by the new item.
key | Key of the item to put in. |
value | Value of the item to put in. |
Referenced by elm::serial::TextSerializer::beginObject(), elm::serial::TextSerializer::delayObject(), elm::serial2::XOMSerializer::endObject(), elm::serial2::XOMUnserializer::flush(), elm::serial2::XOMSerializer::flush(), elm::serial2::TextSerializer::onPointer(), elm::serial2::XOMSerializer::onPointer(), and elm::genstruct::HashTable< const void *, int >::putAll().
void elm::genstruct::HashTable< K, T, H >::putAll | ( | const HashTable< K, T, H > & | htab | ) |
void elm::genstruct::HashTable< K, T, H >::remove | ( | const K & | key | ) |