#include <hashMap.h>
Public Types | |
| typedef ::std::pair< Key, T > | ValueType |
| typedef Key | KeyType |
|
typedef ::std::pair< Key, T > * | PointerType |
| typedef Node * | IteratorPosition |
Type definitions | |
|
typedef ForwardIterator< HashMap< Key, T >, ValueType, PointerType, IteratorTraits_ > | Iterator |
|
typedef ConstForwardIterator< HashMap< Key, T >, ValueType, PointerType, IteratorTraits_ > | ConstIterator |
Enums and Constants | |
| enum | { INITIAL_CAPACITY = 4, INITIAL_NUMBER_OF_BUCKETS = 3 } |
Public Member Functions | |
| Iterator | begin () throw () |
| Iterator | end () throw () |
| ConstIterator | begin () const throw () |
| ConstIterator | end () const throw () |
Constructors and Destructors | |
| HashMap (Size initial_capacity=INITIAL_CAPACITY, Size number_of_buckets=INITIAL_NUMBER_OF_BUCKETS) throw () | |
| Default constructor. | |
| HashMap (const HashMap &hash_map) throw () | |
| Copy Constructor. | |
| virtual | ~HashMap () throw () |
| Destructor. | |
| virtual void | clear () throw () |
| Clear the hash map. | |
| void | destroy () throw () |
| Clear the hash map. | |
Assignment | |
| void | set (const HashMap &hash_map) throw () |
| Assignment from another hash map. | |
| const HashMap & | operator= (const HashMap &hash_map) throw () |
| Assignment operator. | |
| void | get (HashMap &hash_map) const throw () |
| Assign the contents of this hash map to another map. | |
| void | swap (HashMap &hash_map) throw () |
| Swap the contents of two hash maps. | |
Accessors | |
| Size | getBucketSize () const throw () |
| Return the number of buckets. | |
| Size | getCapacity () const throw () |
| Return the capcacity of the hash map. | |
| Size | getSize () const throw () |
| Return the number of entries in the map. | |
| Size | size () const throw () |
| Return the number of entries in the map. | |
| Iterator | find (const Key &key) throw () |
Find the element whose key is key. | |
| ConstIterator | find (const Key &key) const throw () |
Find the element whose key is key. | |
| T & | operator[] (const Key &key) throw () |
Return a mutable reference to the element whose key is key. | |
| const T & | operator[] (const Key &key) const throw (typename HashMap<Key, T>::IllegalKey) |
Return a constant reference to the element whose key is key. | |
| ::std::pair< Iterator, bool > | insert (const ValueType &entry) throw () |
| Insert a new entry into the hash map. | |
| Iterator | insert (Iterator pos, const ValueType &entry) throw () |
| Insert a new entry into the hash map. | |
| Size | erase (const Key &key) throw () |
Erase element with key key. | |
| void | erase (Iterator pos) throw (Exception::IncompatibleIterators, Exception::InvalidIterator) |
| Erase element at a given position. | |
| void | erase (Iterator first, Iterator last) throw (Exception::IncompatibleIterators) |
| Erase a range of elements. | |
Miscellaneous | |
| void | host (Visitor< HashMap< Key, T > > &visitor) throw () |
| Host a visitor for all map entries. | |
Predicates | |
| bool | has (const Key &key) const throw () |
| Test whether the map contains the given key. | |
| bool | isEmpty () const throw () |
| Test whether the map is empty. | |
| bool | operator== (const HashMap &hash_map) const throw () |
| Compare two hash maps. | |
| bool | operator!= (const HashMap &hash_map) const throw () |
| Compare two hash maps. | |
Debugging and Diagnostics | |
| bool | isValid () const throw () |
| Return true if the hash map is consistent. | |
| virtual void | dump (::std::ostream &s=::std::cout, Size depth=0) const throw () |
| Dump the constent of this instance to an ostream. | |
Iternal iterators | |
| bool | apply (UnaryProcessor< ValueType > &processor) throw () |
| Apply a processor to the hashmap. | |
Protected Member Functions | |
| virtual Node * | newNode_ (const ValueType &value, Node *next) const throw () |
| virtual void | deleteNode_ (Node *node) const throw () |
| virtual HashIndex | hash (const Key &key) const throw () |
| virtual bool | needRehashing_ () const throw () |
| virtual void | rehash () throw () |
| void | deleteBuckets_ () throw () |
| HashIndex | hash_ (const Key &key) const throw () |
| void | rehash_ () throw () |
Protected Attributes | |
Attributes | |
| Size | size_ |
| The number of entries in the map. | |
| Size | capacity_ |
| The maximum number of entries before a resize operation is required. | |
| vector< Node * > | bucket_ |
| Buckets are stored as a vector of linked lists of Nodes. | |
Friends | |
| class | IteratorTraits_ |
|
|||||
|
|
|
||||||||||||||||
|
Default constructor. Create a new and empty hash map.
|
|
||||||||||
|
Copy Constructor.
|
|
|||||||||
|
Destructor.
|
|
||||||||||
|
Apply a processor to the hashmap.
|
|
|||||||||
|
Clear the hash map. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged. Reimplemented in Options. |
|
|||||||||
|
Clear the hash map. Remove all nodes from all buckets. The capacity and the number of buckets remain unchanged. Simply calls clear. Reimplemented in StringHashMap< Value >, StringHashMap< list< Position > >, StringHashMap< NameMap >, StringHashMap< JCAMPValue >, StringHashMap< Position >, StringHashMap< Atom::Type >, StringHashMap< Ring >, StringHashMap< CreateMethod >, StringHashMap< Index >, StringHashMap< List< String >::Iterator >, StringHashMap< float >, StringHashMap< RuleList >, StringHashMap< Vector3 >, StringHashMap< String >, StringHashMap< SectionIterator >, StringHashMap< vector< Position > >, StringHashMap< vector< Data > >, StringHashMap< CreationMethod >, StringHashMap< EmbeddableVector >, StringHashMap< block >, and StringHashMap< ColorRGBA >. |
|
||||||||||||||||
|
Dump the constent of this instance to an ostream.
|
|
||||||||||||||||
|
Erase a range of elements.
Erase all elements in the range |
|
||||||||||
|
Erase element at a given position.
|
|
||||||||||
|
Erase element with key
|
|
||||||||||
|
Find the element whose key is
|
|
||||||||||
|
Find the element whose key is
|
|
||||||||||
|
Assign the contents of this hash map to another map.
|
|
|||||||||
|
Return the capcacity of the hash map.
|
|
|||||||||
|
||||||||||
|
||||||||||
|
Host a visitor for all map entries.
|
|
||||||||||||||||
|
Insert a new entry into the hash map.
For STL compatibility. The value of |
|
||||||||||
|
|||||||||
|
|||||||||
|
Return true if the hash map is consistent. Condition: the number of entries in all buckets has to be equal the stored number of entries (getSize()). |
|
||||||||||
|
Compare two hash maps.
|
|
||||||||||
|
Assignment operator. Assign the contents of a hash map to another.
|
|
||||||||||
|
Compare two hash maps.
|
|
||||||||||
|
Return a constant reference to the element whose key is
|
|
||||||||||
|
Return a mutable reference to the element whose key is
If an element with the key
|
|
||||||||||
|
Assignment from another hash map.
|
|
|||||||||
|
Return the number of entries in the map.
|
|
||||||||||
|
Swap the contents of two hash maps.
|