#include <hashmap.h>
Inheritance diagram for hashmap< keyT, dataT, hasherT, mapT >:

Public Member Functions | |
| iterator | begin () |
| return the first element valid element | |
| iterator | end () |
| return the end iterator | |
| hashmap (unsigned int n=127, unsigned int lf=10) | |
| default constructor initialize the table of size n=127 | |
| unsigned int | size () const |
| to the users, they do no know about the vector size they just care the number of elements | |
| iterator | insert (keyT key, dataT data) |
| insert an item, this may cause expand to be called | |
| iterator | insert (std::pair< keyT, dataT > pa) |
| insert an item, calls insert(key, data) | |
| dataT & | operator[] (const keyT &key) |
| operation [] | |
| iterator | find (keyT v) |
| return an iterator points to the key, if not found return end | |
| bool | remove (keyT x) |
| remove a key | |
| bool | erase (keyT x) |
| erase a key, same as remove. | |
Protected Member Functions | |
| bool | needToRehash () |
| check the condition to see if we need to rehash | |
| void | rehash () |
| expand the table and rehash all keys when the table is too small | |
Protected Attributes | |
| hash_array | table |
| array that hold the actual values | |
| unsigned int | vectorSize |
| size of the vector | |
| unsigned int | tableSize |
| number of elements | |
| unsigned int | loadFactor |
| load factor controls how the rehash condition will be set. | |
| unsigned int | collision |
| debug | |
Private Types | |
| typedef std::map< keyT, dataT, mapT > | stdmap |
| typedef std::vector< stdmap > | hash_array |
|
|||||
|
|
|
|||||
|
|
|
||||||||||||||||
|
default constructor initialize the table of size n=127
|
|
|||||||||
|
return the first element valid element
Definition at line 99 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::rehash(). |
|
|||||||||
|
||||||||||
|
erase a key, same as remove.
|
|
||||||||||
|
return an iterator points to the key, if not found return end
Definition at line 179 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::operator[](). |
|
||||||||||
|
insert an item, calls insert(key, data)
|
|
||||||||||||||||
|
insert an item, this may cause expand to be called
Definition at line 136 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::insert(), hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::operator[](), and hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::rehash(). |
|
|||||||||
|
check the condition to see if we need to rehash
Definition at line 232 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::insert(). |
|
||||||||||
|
operation []
|
|
|||||||||
|
expand the table and rehash all keys when the table is too small
Definition at line 239 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::insert(). |
|
||||||||||
|
remove a key
Definition at line 195 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::erase(). |
|
|||||||||
|
to the users, they do no know about the vector size they just care the number of elements
|
|
|||||
|
debug
|
|
|||||
|
load factor controls how the rehash condition will be set.
Definition at line 226 of file hashmap.h. Referenced by hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::hashmap(), and hashmap< ADFSampleAddress, ADFSample, ADFSampleHasher, ADFSampleMap >::needToRehash(). |
|
|||||
|
|||||
|
|||||
1.3.4