![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A efficient and flexible implementation of hash tables. More...
A efficient and flexible implementation of hash tables.
This file provides class HashTable. This class is both efficient and flexible: efficient because the access to elements is usually computed using a small amount of processor instructions, and flexible because several methods allow to fine tune the behavior of each hash table. For instance, a hashtable can allow or forbid different elements to have the same key. This behavior can be modified at any time during the execution of the program. Functions for hashing keys are defined in file HashFunc.h. Here again, these functions are quite flexible as they can be overloaded by the user to support new kind of keys. In addition to HashTable, the current file provides classes HashTableIteratorSafe and HashTableConstIteratorSafe (a.k.a. HashTable<>::iterator_safe and HashTable<>::const_iterator_safe) that allow safe parsing of the hash tables. By safe, we mean that whenever the element pointed to by such an iterator is removed from the hashtable, accessing it through the iterator (*iter) does not result in a segmentation fault but rather in an exception being thrown. This safety is ensured at a very low cost (actually, our experiments show that our HashTables and HashTable's safe iterators significantly outperform the standard library unordered_maps). Of course, if there is no possibility for an iterator to point to a deleted element, the user can use the "unsafe" iterators HashTableIterator and HashTableConstIterator (a.k.a. HashTable<>::iterator and HashTable<>::const_iterator). These iterators are slightly faster than their safe counterparts. However, as in the standard library, accessing through them a deleted element usually results in a mess (most probably a segfault).
Classes | |
class | gum::HashTableConst |
Parameters specifying the default behavior of the hashtables. More... | |
class | gum::HashTableBucket< Key, Val > |
A recipient for a pair of key value in a gum::HashTableList. More... | |
class | gum::HashTableList< Key, Val, Alloc > |
A chained list used by gum::HashTable. More... | |
class | gum::HashTable< Key, Val, Alloc > |
The class for generic Hash Tables. More... | |
class | gum::HashTableIteratorStaticEnd |
A class used to create the static iterator used by HashTables. More... | |
class | gum::HashTableConstIteratorSafe< Key, Val > |
Safe Const Iterators for hashtables. More... | |
class | gum::HashTableIteratorSafe< Key, Val > |
Safe Iterators for hashtables. More... | |
class | gum::HashTableConstIterator< Key, Val > |
Unsafe Const Iterators for hashtablesHashTableConstIterator provides a fast but unsafe way to parse HashTables. More... | |
class | gum::HashTableIterator< Key, Val > |
Unsafe Iterators for hashtablesHashTableIterator provides a fast but unsafe way to parse HashTables. More... | |
Functions | |
template<typename Key , typename Val , typename Alloc > | |
std::ostream & | gum::operator<< (std::ostream &s, const HashTableList< Key, Val, Alloc > &list) |
Prints the content of a gum::HashTableList in the stream. More... | |
template<typename Key , typename Val , typename Alloc > | |
std::ostream & | gum::operator<< (std::ostream &s, const HashTableList< Key *, Val, Alloc > &list) |
Prints the content of a gum::HashTableList with pointers key in the stream. More... | |
template<typename Key , typename Val , typename Alloc > | |
std::ostream & | gum::operator<< (std::ostream &s, const HashTable< Key, Val, Alloc > &table) |
Prints the content of a gum::HashTable in the stream. More... | |
template<typename Key , typename Val , typename Alloc > | |
std::ostream & | gum::operator<< (std::ostream &s, const HashTable< Key *, Val, Alloc > &table) |
Prints the content of a gum::HashTable with pointers key in the stream. More... | |
std::ostream & gum::operator<< | ( | std::ostream & | s, |
const HashTableList< Key, Val, Alloc > & | list | ||
) |
Prints the content of a gum::HashTableList in the stream.
Definition at line 1167 of file hashTable_tpl.h.
std::ostream & gum::operator<< | ( | std::ostream & | s, |
const HashTableList< Key *, Val, Alloc > & | list | ||
) |
Prints the content of a gum::HashTableList with pointers key in the stream.
Definition at line 1184 of file hashTable_tpl.h.
std::ostream & gum::operator<< | ( | std::ostream & | s, |
const HashTable< Key, Val, Alloc > & | table | ||
) |
Prints the content of a gum::HashTable in the stream.
Definition at line 1201 of file hashTable_tpl.h.
std::ostream & gum::operator<< | ( | std::ostream & | s, |
const HashTable< Key *, Val, Alloc > & | table | ||
) |
Prints the content of a gum::HashTable with pointers key in the stream.
Definition at line 1220 of file hashTable_tpl.h.