Iterators for hash tables.
More...
#include <ogdf/basic/Hashing.h>
List of all members.
Public Member Functions |
| | HashConstIterator () |
| | Creates a hash iterator pointing to no element.
|
| | HashConstIterator (HashElement< K, I > *pElement, HashElement< K, I > **pList, const Hashing< K, I, H > *pHashing) |
| | Creates a hash iterator pointing to element pElement in list pList of hash table pHashing.
|
| | HashConstIterator (const HashConstIterator< K, I, H > &it) |
| | Copy constructor.
|
| HashConstIterator & | operator= (const HashConstIterator< K, I, H > &it) |
| | Assignment operator.
|
| bool | valid () const |
| | Returns true if the hash iterator points to an element.
|
| const K & | key () const |
| | Returns the key of the hash element pointed to.
|
| const I & | info () const |
| | Returns the information of the hash element pointed to.
|
| HashConstIterator< K, I, H > & | operator++ () |
| | Moves this hash iterator to the next element (iterator gets invalid if no more elements).
|
Private Attributes |
| HashElement< K, I > * | m_pElement |
| | The hash element to which the iterator points.
|
| HashElement< K, I > ** | m_pList |
| | The list containg the hash element.
|
| const Hashing< K, I, H > * | m_pHashing |
| | The associated hash table.
|
Friends |
| bool | operator== (const HashConstIterator< K, I, H > &it1, const HashConstIterator< K, I, H > &it2) |
| | Equality operator.
|
| bool | operator!= (const HashConstIterator< K, I, H > &it1, const HashConstIterator< K, I, H > &it2) |
| | Inequality operator.
|
Detailed Description
template<class K, class I, class H = DefHashFunc<K>>
class ogdf::HashConstIterator< K, I, H >
Iterators for hash tables.
This class implements an iterator for iterating over all elements in a hash table. Hash iterators are provided by Hashing<K,I>::begin().
Example
The following code snippet demonstrates how to iterate over all elements of a hash table. First, the example fills a hash table with a tiny German–English dictionary, and then it iterates over the elements and prints the entries.
Hashing<String,String> H;
H.fastInsert("Hund","dog");
H.fastInsert("Katze","cat");
H.fastInsert("Maus","mouse");
HashConstIterator<String,String> it;
for(it = H.begin(); it.valid(); ++it)
cout << it.key() << " -> " << it.info() << endl;
Definition at line 464 of file Hashing.h.
Constructor & Destructor Documentation
template<class K, class I, class H = DefHashFunc<K>>
Creates a hash iterator pointing to no element.
Definition at line 471 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
Creates a hash iterator pointing to element pElement in list pList of hash table pHashing.
Definition at line 474 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
Member Function Documentation
template<class K, class I, class H = DefHashFunc<K>>
template<class K, class I, class H = DefHashFunc<K>>
Returns the key of the hash element pointed to.
Definition at line 494 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
template<class K, class I, class H = DefHashFunc<K>>
Assignment operator.
Definition at line 483 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
Friends And Related Function Documentation
template<class K, class I, class H = DefHashFunc<K>>
Inequality operator.
Definition at line 504 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
Equality operator.
Definition at line 500 of file Hashing.h.
Member Data Documentation
template<class K, class I, class H = DefHashFunc<K>>
The hash element to which the iterator points.
Definition at line 465 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
The associated hash table.
Definition at line 467 of file Hashing.h.
template<class K, class I, class H = DefHashFunc<K>>
The list containg the hash element.
Definition at line 466 of file Hashing.h.
The documentation for this class was generated from the following file: