#include <core/hashtable.h>
Collaboration diagram for neo::core::HashTable< Key, T, Cmp >:

Public Types | |
|
typedef HashTableIterator< Key, T, Cmp > | iterator |
| Iterator, sequential. | |
| typedef const iterator | const_iterator |
| Const iterator, sequential. | |
Public Member Functions | |
| HashTable (size_type size=7) | |
| Allocate storage and initialize hash table. | |
| HashTable (const HashTable< Key, T, Cmp > &table) | |
| Duplicate hash table. | |
| virtual | ~HashTable () |
| Deallocate storage. | |
| iterator | insert (const Key &key, const T &data) |
| Add key/value pair. | |
| void | erase (const Key &key) |
| Remove key. | |
| void | erase (const Key &key, const T &data) |
| Remove key. | |
| void | erase (const const_iterator &iter) |
| Remove element. | |
| void | eraseAll (const T &data, Array< Key > *p_keys=0) |
| Remove keys with matching data. | |
| iterator | find (const Key &key, unsigned int hash=0) |
| Find value for key. | |
| const_iterator | find (const Key &key, unsigned int hash=0) const |
| Find value for key. | |
| const T & | findRaw (const Key &key, unsigned int hash, const T &null) const |
| Find value for key. | |
| const_iterator | findKey (const T &data, const const_iterator &last=const_iterator()) const |
| Reverse lookup. | |
| iterator | begin () |
| Get iterator of first object. | |
| const_iterator | begin () const |
| Get iterator of first object. | |
| iterator | end () |
| Get iterator of first invalid object. | |
| const_iterator | end () const |
| Get iterator of first invalid object. | |
| size_type | size () const |
| Get number of objects. | |
| void | clear () |
| Clear all keys. | |
| void | swap (HashTable< Key, T, Cmp > &table) |
| Swap hashtables. | |
| T & | operator[] (const Key &key) |
| Access element by key. | |
| HashTable< Key, T, Cmp > & | operator= (const HashTable< Key, T, Cmp > &table) |
| Assign hash table. | |
| void | getMinMaxBucketSize (size_type *p_min, size_type *p_max) |
| Get min/max bucket size. | |
| size_type | getNumBuckets () const |
| Get number of buckets. | |
| neo::core::HashTable< Key, T, Cmp >::HashTable | ( | size_type | size = 7 |
) |
Allocate and initialize hash table with the specified number of buckets
| size | Number of buckets |
| neo::core::HashTable< Key, T, Cmp >::HashTable | ( | const HashTable< Key, T, Cmp > & | table | ) |
Duplicate hash table
| table | hashtable to duplicate |
| neo::core::HashTable< Key, T, Cmp >::~HashTable | ( | ) | [virtual] |
Deallocate storage
| HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::insert | ( | const Key & | key, | |
| const T & | data | |||
| ) | [inline] |
Add key value into hash table. The data will replace any value with the same key previously stored in the table
| key | Key name | |
| data | Value |
| void neo::core::HashTable< Key, T, Cmp >::erase | ( | const Key & | key | ) | [inline] |
Remove key from hash table and destruct associated object
| key | Key name |
| void neo::core::HashTable< Key, T, Cmp >::erase | ( | const Key & | key, | |
| const T & | data | |||
| ) | [inline] |
Remove key from hash table and destruct associated object if matching given reference value
| key | Key name | |
| data | Value to remove, key/value pair will only be removed if value match |
| void neo::core::HashTable< Key, T, Cmp >::erase | ( | const const_iterator & | iter | ) | [inline] |
Remove element by iterator from table and destruct associated object
| iter | Iterator for element |
| void neo::core::HashTable< Key, T, Cmp >::eraseAll | ( | const T & | data, | |
| Array< Key > * | p_keys = 0 | |||
| ) | [inline] |
Remove all keys and destruct associated object if object matches given reference value
| data | Data to remove | |
| p_keys | Optional pointer to array receiving keys for removed data entries |
| HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::find | ( | const Key & | key, | |
| unsigned int | hash = 0 | |||
| ) | [inline] |
Find value for key with optional precalculated hash value
| key | Key name | |
| hash | Hash value (zero if not precalculated) |
| const HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::find | ( | const Key & | key, | |
| unsigned int | hash = 0 | |||
| ) | const [inline] |
Find value for key with optional precalculated hash value
| key | Key name | |
| hash | Hash value (zero if not precalculated) |
| const T & neo::core::HashTable< Key, T, Cmp >::findRaw | ( | const Key & | key, | |
| unsigned int | hash, | |||
| const T & | null | |||
| ) | const [inline] |
Find value for key with optional precalculated hash value
| key | Key name | |
| hash | Hash value (zero if not precalculated) | |
| null | Value to return if not found |
| const HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::findKey | ( | const T & | data, | |
| const const_iterator & | last = const_iterator() | |||
| ) | const |
Reverse lookup. Find first key with data matching given search data. If a last found key element is given, search wíll begin for next key after last found key.
| data | Value to search for | |
| last | Last found element |
| HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::begin | ( | ) | [inline] |
Get iterator of first object (pointer to first object)
| const HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::begin | ( | ) | const [inline] |
Get iterator of first object (pointer to first object)
| HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::end | ( | ) | [inline] |
Get iterator of first invalid object (pointer to object after last object)
| const HashTable< Key, T, Cmp >::iterator neo::core::HashTable< Key, T, Cmp >::end | ( | ) | const [inline] |
Get iterator of first invalid object (pointer to object after last object)
| HashTable< Key, T, Cmp >::size_type neo::core::HashTable< Key, T, Cmp >::size | ( | ) | const [inline] |
Get number of objects stored in hash table
| void neo::core::HashTable< Key, T, Cmp >::clear | ( | ) | [inline] |
Clear whole hashtable
| void neo::core::HashTable< Key, T, Cmp >::swap | ( | HashTable< Key, T, Cmp > & | table | ) | [inline] |
Swap contents of two hashtables
| table | Hashtable to swap contents with |
| T & neo::core::HashTable< Key, T, Cmp >::operator[] | ( | const Key & | key | ) | [inline] |
Access the data element by key. If no value was previously associated with key a new key-value pair with default data is associated with the key and inserted in the table.
| key | Key |
| HashTable< Key, T, Cmp > & neo::core::HashTable< Key, T, Cmp >::operator= | ( | const HashTable< Key, T, Cmp > & | table | ) |
Assign hash table from reference
| table | Hashtable to copy values from |
1.5.1