|
| Hashing (const Hashing< K, I, H > &h)=default |
| Copy constructor. More...
|
|
| Hashing (int minTableSize=256, const H &hashFunc=H()) |
| Creates a hash table for given initial table size minTableSize . More...
|
|
| ~Hashing () |
| Destruction. More...
|
|
HashConstIterator< K, I, H > | begin () const |
| Returns an hash iterator to the first element in the list of all elements. More...
|
|
void | clear () |
| Removes all elements from the hash table. More...
|
|
void | del (const K &key) |
| Removes the element with key key from the hash table (does nothing if no such element). More...
|
|
bool | empty () const |
| Returns true iff the table is empty, i.e., contains no elements. More...
|
|
HashElement< K, I > * | fastInsert (const K &key, const I &info) |
| Inserts a new element with key key and information info into the hash table. More...
|
|
HashElement< K, I > * | insert (const K &key, const I &info) |
| Inserts a new element with key key and information info into the hash table. More...
|
|
HashElement< K, I > * | insertByNeed (const K &key, const I &info) |
| Inserts a new element with key key and information info into the hash table. More...
|
|
HashElement< K, I > * | lookup (const K &key) const |
| Returns the hash element with key key in the hash table; returns nullptr if no such element exists. More...
|
|
bool | member (const K &key) const |
| Returns true iff the hash table contains an element with key key . More...
|
|
Hashing< K, I, H > & | operator= (const Hashing< K, I, H > &hashing)=default |
| Assignment operator. More...
|
|
int | size () const |
| Returns the number of elements in the hash table. More...
|
|
template<class K, class I, class H = DefHashFunc<K>>
class ogdf::Hashing< K, I, H >
Hashing with chaining and table doubling.
The class Hashing<K,I> implements a hashing table which realizes a mapping from a key type K to an information type I.
The class requires three template parameters:
- Template Parameters
-
K | is the type of keys. |
I | is the type of information. |
H | is the hash function type. The hash function type argument is optional; its default uses the class DefHashFunc. |
Hash function classes have to define int hash(const E &key)
or int hash(E key)
.
Definition at line 264 of file Hashing.h.
template<class K , class I , class H = DefHashFunc<K>>
Inserts a new element with key key
and information info
into the hash table.
This is a faster version of insert() that assumes that no element with key key
is already contained in the hash table.
Definition at line 351 of file Hashing.h.
template<class K , class I , class H = DefHashFunc<K>>
Returns the first element in the list of all elements in the hash table.
This function is used by hash iterators for iterating over all elements in the hash table.
- Parameters
-
pList | is assigned the list containing the first element. |
- Returns
- a pointer to the first element or
nullptr
if hash table is empty.
Definition at line 378 of file Hashing.h.
template<class K , class I , class H = DefHashFunc<K>>
Inserts a new element with key key
and information info
into the hash table.
The new element will only be inserted if no element with key key
is already contained; if such an element already exists the information of this element will be changed to info
.
Definition at line 316 of file Hashing.h.
template<class K , class I , class H = DefHashFunc<K>>
Inserts a new element with key key
and information info
into the hash table.
The new element will only be inserted if no element with key key
is already contained; if such an element already exists the information of this element remains unchanged.
Definition at line 335 of file Hashing.h.
template<class K , class I , class H = DefHashFunc<K>>
Returns the successor of pElement
in the list of all elements in the hash table.
This function is used by hash iterators for iterating over all elements in the hash table.
- Parameters
-
pList | is assigned the list containing the first element. |
pElement | points to an element in the has table. |
- Returns
- a pointer to the first element or
nullptr
if hash table is empty.
Definition at line 391 of file Hashing.h.