![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/HashTable.h>
Inheritance diagram for HashTable< T, H, A >: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) |
Public Member Functions inherited from HashKey< T > | |
| t::hash | computeHash (const T &key) const |
| bool | isEqual (const T &key1, const T &key2) const |
Public Member Functions inherited from DefaultAllocatorDelegate | |
| 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 Public Member Functions inherited from HashKey< T > | |
| 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). |
References fast< T >::clear().
References fast< T >::clear(), and HashTable< T, H, A >::putAll().
References HashTable< T, H, A >::clear().
|
inline |
|
inline |
References HashTable< T, H, A >::add().
|
inline |
|
inline |
Referenced by HashMap< K, T, H, A, E >::allocator(), and HashSet< T, H, A >::allocator().
Remove all items of the table.
Referenced by HashTable< T, H, A >::~HashTable(), HashMap< K, T, H, A, E >::clear(), HashSet< T, H, A >::clear(), and HashTable< T, H, A >::copy().
|
inline |
References HashTable< T, H, A >::find().
Referenced by HashTable< T, H, A >::containsAll().
|
inline |
References HashTable< T, H, A >::find_const().
Referenced by HashTable< T, H, A >::containsAll_const().
|
inline |
References HashTable< T, H, A >::contains().
Referenced by HashTable< T, H, A >::equals().
|
inline |
References HashTable< T, H, A >::contains_const().
Referenced by HashTable< T, H, A >::equals_const().
References HashTable< T, H, A >::clear(), elm::io::p(), and HashTable< T, H, A >::putAll().
Referenced by HashSet< T, H, A >::copy(), and HashTable< T, H, A >::operator=().
|
inline |
Count the number of items in the table.
Referenced by HashMap< K, T, H, A, E >::count(), and HashSet< T, H, A >::count().
References HashTable< T, H, A >::containsAll().
Referenced by HashSet< T, H, A >::equals(), HashTable< T, H, A >::operator!=(), and HashTable< T, H, A >::operator==().
References HashTable< T, H, A >::containsAll_const().
|
inline |
Same as hasKey().
References HashTable< T, H, A >::hasKey().
|
inline |
References HashTable< T, H, A >::hasKey_const().
|
inlineprotected |
|
inlineprotected |
|
inline |
References HashTable< T, H, A >::find().
|
inline |
References HashTable< T, H, A >::find().
Referenced by HashMap< K, T, H, A, E >::fetch(), HashMap< K, T, H, A, E >::get(), and HashMap< K, T, H, A, E >::operator[]().
|
inline |
References HashTable< T, H, A >::find_const().
Referenced by HashMap< K, T, H, A, E >::get_const().
|
inline |
|
inline |
Referenced by HashMap< K, T, H, A, E >::hash(), and HashSet< T, H, A >::hash().
|
inline |
Test if a key is in the table.
| key | Tested key. |
References HashTable< T, H, A >::find().
Referenced by HashSet< T, H, A >::contains(), HashTable< T, H, A >::exists(), and HashMap< K, T, H, A, E >::hasKey().
|
inline |
References HashTable< T, H, A >::find_const().
Referenced by HashTable< T, H, A >::exists_const(), and HashMap< K, T, H, A, E >::hasKey_const().
HashTable::HashTable(const self_t& h); Clone constructor.
| h | Hash table to clone. |
Test if the table is empty.
Referenced by HashMap< K, T, H, A, E >::isEmpty(), HashSet< T, H, A >::isEmpty(), and HashTable< T, H, A >::operator bool().
|
inline |
References HashTable< T, H, A >::isEmpty().
References HashTable< T, H, A >::equals().
|
inline |
References HashTable< T, H, A >::add().
|
inline |
References HashTable< T, H, A >::remove().
References HashTable< T, H, A >::copy().
References HashTable< T, H, A >::equals().
|
inline |
Add a data in the table ensuring there is only one data with the corresponding key.
| data | Added data. |
References HashTable< T, H, A >::add(), and HashTable< T, H, A >::find().
Referenced by HashSet< T, H, A >::insert(), HashMap< K, T, H, A, E >::put(), and HashTable< T, H, A >::putAll().
|
inline |
Add the items of the given table to the current one.
| m | Added table. |
References HashTable< T, H, A >::put().
Referenced by HashTable< T, H, A >::HashTable(), and HashTable< T, H, A >::copy().
References elm::io::p().
|
inline |
|
inline |
References HashTable< T, H, A >::remove().