Teuchos Package Browser (Single Doxygen Collection) Version of the Day
|
Templated hashtable class. More...
#include <Teuchos_Hashtable.hpp>
Public Member Functions | |
Hashtable (int capacity=101, double rehashDensity=0.8) | |
Create an empty Hashtable. | |
bool | containsKey (const Key &key) const |
Check for the presence of a key. | |
const Value & | get (const Key &key) const |
Get the value indexed by key. | |
void | put (const Key &key, const Value &value) |
Put a new (key, value) pair in the table. | |
void | remove (const Key &key) |
Remove from the table the element given by key. | |
int | size () const |
Get the number of elements in the table. | |
void | arrayify (Array< Key > &keys, Array< Value > &values) const |
Get lists of keys and values in Array form. | |
double | avgDegeneracy () const |
Return the average degeneracy (average number of entries per hash code). | |
double | density () const |
Return the density of the hashtable (num entries / capacity) | |
void | setRehashDensity (double rehashDensity) |
Set the density at which to do a rehash. | |
std::string | toString () const |
Write to a std::string. | |
Private Member Functions | |
void | rehash () |
int | nextPrime (int newCap) const |
void | accumulateAvgFill (int n) const |
Private Attributes | |
Array< Array< HashPair< Key, Value > > > | data_ |
int | count_ |
int | capacity_ |
Value | mostRecentValue_ |
Key | mostRecentKey_ |
size_t | nHits_ |
double | avgDegeneracy_ |
double | rehashDensity_ |
Related Functions | |
(Note that these are not member functions.) | |
template<class Key , class Value > | |
std::ostream & | operator<< (std::ostream &os, const Hashtable< Key, Value > &h) |
Write Hashtable to a stream. | |
Templated hashtable class.
Definition at line 80 of file Teuchos_Hashtable.hpp.
|
inline |
Create an empty Hashtable.
Definition at line 145 of file Teuchos_Hashtable.hpp.
|
inline |
Check for the presence of a key.
Definition at line 157 of file Teuchos_Hashtable.hpp.
|
inline |
Get the value indexed by key.
Definition at line 282 of file Teuchos_Hashtable.hpp.
|
inline |
Put a new (key, value) pair in the table.
Definition at line 176 of file Teuchos_Hashtable.hpp.
|
inline |
Remove from the table the element given by key.
Definition at line 309 of file Teuchos_Hashtable.hpp.
|
inline |
Get the number of elements in the table.
Definition at line 100 of file Teuchos_Hashtable.hpp.
|
inline |
Get lists of keys and values in Array form.
Definition at line 228 of file Teuchos_Hashtable.hpp.
|
inline |
Return the average degeneracy (average number of entries per hash code).
Definition at line 106 of file Teuchos_Hashtable.hpp.
|
inline |
Return the density of the hashtable (num entries / capacity)
Definition at line 109 of file Teuchos_Hashtable.hpp.
|
inline |
Set the density at which to do a rehash.
|
inline |
Write to a std::string.
Definition at line 244 of file Teuchos_Hashtable.hpp.
|
inlineprivate |
Definition at line 210 of file Teuchos_Hashtable.hpp.
|
inlineprivate |
|
inlineprivate |
Definition at line 334 of file Teuchos_Hashtable.hpp.
|
related |
Write Hashtable to a stream.
Definition at line 341 of file Teuchos_Hashtable.hpp.
|
private |
Definition at line 124 of file Teuchos_Hashtable.hpp.
|
private |
Definition at line 125 of file Teuchos_Hashtable.hpp.
|
private |
Definition at line 126 of file Teuchos_Hashtable.hpp.
|
mutableprivate |
Definition at line 127 of file Teuchos_Hashtable.hpp.
|
mutableprivate |
Definition at line 128 of file Teuchos_Hashtable.hpp.
|
mutableprivate |
Definition at line 130 of file Teuchos_Hashtable.hpp.
|
mutableprivate |
Definition at line 131 of file Teuchos_Hashtable.hpp.
|
private |
Definition at line 132 of file Teuchos_Hashtable.hpp.