![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/HashTable.h>
Classes | |
class | Iter |
Public Types | |
typedef HashTable< T, H, A > | self_t |
Public Member Functions | |
HashTable (int _size=211) | |
HashTable (const self_t &h) | |
~HashTable (void) | |
const H & | hash () const |
H & | hash () |
const A & | allocator () const |
A & | allocator () |
const T * | get (const T &key) const |
const T * | get_const (const T &key) const |
bool | hasKey (const T &key) const |
bool | hasKey_const (const T &key) const |
bool | exists (const T &key) const |
bool | exists_const (const T &key) const |
void | put (const T &data) |
template<class CC > | |
void | putAll (const CC &c) |
bool | isEmpty (void) const |
operator bool () const | |
int | count (void) const |
bool | contains (const T &x) const |
bool | contains_const (const T &x) const |
template<class CC > | |
bool | containsAll (const CC &c) const |
template<class CC > | |
bool | containsAll_const (const CC &c) const |
Iter | begin () const |
Iter | end () const |
bool | equals (const HashTable< T > &h) const |
bool | equals_const (const HashTable< T > &h) const |
bool | operator== (const HashTable< T > &t) const |
bool | operator!= (const HashTable< T > &t) const |
void | clear (void) |
T * | add (const T &data) |
self_t & | operator+= (const T &x) |
template<class C > | |
void | addAll (const C &c) |
void | remove (const T &key) |
template<class C > | |
void | removeAll (const C &c) |
self_t & | operator-= (const T &x) |
void | remove (const Iter &i) |
void | copy (const HashTable< T, H > &t) |
self_t & | operator= (const HashTable< T, H > &c) |
T * | get (const T &key) |
![]() | |
t::hash | computeHash (const T &key) const |
bool | isEqual (const T &key1, const T &key2) const |
![]() | |
t::ptr | allocate (t::size size) const |
void | free (t::ptr p) const |
template<class T > | |
T * | alloc () const |
Protected Member Functions | |
node_t * | find (const T &key) const |
node_t * | find_const (const T &key) const |
Additional Inherited Members | |
![]() | |
static t::hash | hash (const T &key) |
static bool | equals (const T &key1, const T &key2) |
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.
This class is the basic implementation of hash table. To use it as a map, refer to HashMap. To use it as a set, refer to HashSet.
T | Type of stored data. |
A | Adapter to access key information (must implement concept::Adapter). |
M | Manager of the hash table providing hashing and allocation services. |
|
inline |
Build an hash table with the given size. Improved efficiency is obtained with prime number as sizes.
size | Table size (default to 211). |
|
inline |
Referenced by HashMap< elm::CString, void * >::add(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::addAll(), HashMap< elm::CString, void * >::fetch(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::operator+=(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::put().
|
inline |
|
inline |
|
inline |
Referenced by HashSet< T, H, A >::allocator(), and HashMap< elm::CString, void * >::allocator().
|
inline |
Remove all items of the table.
Referenced by HashMap< elm::CString, void * >::clear(), HashSet< T, H, A >::clear(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::copy(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::~HashTable().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Count the number of items in the table.
Referenced by HashSet< T, H, A >::count(), and HashMap< elm::CString, void * >::count().
|
inline |
Referenced by HashSet< T, H, A >::equals(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::operator!=(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::operator==().
|
inline |
|
inlineprotected |
Referenced by HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::contains(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::get(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::hasKey(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::put().
|
inlineprotected |
Referenced by HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::contains_const(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::get_const(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::hasKey_const().
|
inline |
|
inline |
|
inline |
Referenced by HashMap< elm::CString, void * >::get_const().
|
inline |
|
inline |
Referenced by HashSet< T, H, A >::hash(), and HashMap< elm::CString, void * >::hash().
|
inline |
Test if a key is in the table.
key | Tested key. |
Referenced by HashSet< T, H, A >::contains(), HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::exists(), and HashMap< elm::CString, void * >::hasKey().
|
inline |
HashTable::HashTable(const self_t& h); Clone constructor.
h | Hash table to clone. |
Test if the table is empty.
Referenced by HashSet< T, H, A >::isEmpty(), HashMap< elm::CString, void * >::isEmpty(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::operator bool().
|
inline |
|
inline |
|
inline |
|
inline |
Add a data in the table ensuring there is only one data with the corresponding key.
data | Added data. |
Referenced by HashSet< T, H, A >::insert(), HashMap< elm::CString, void * >::put(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::putAll().
|
inline |
Add the items of the given table to the current one.
m | Added table. |
Referenced by HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::copy(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::HashTable().
|
inline |
Referenced by HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::operator-=(), HashSet< T, H, A >::remove(), HashMap< elm::CString, void * >::remove(), and HashTable< Pair< const void *, bool >, AssocHashKey< const void *, bool, HashKey< const void * > >, DefaultAlloc >::removeAll().
|
inline |