Public Member Functions | |
Dictionary () | |
void | Add (Collider c) |
void | Add (const std::string phrase) |
void | Report () const |
void | ReportExpectedCollisions () const |
void | Time () |
void | TimeOne (const int hindex) |
Private Attributes | |
std::vector< Collider > | m_hashes |
unsigned long | m_nphrases |
std::vector< std::string > | m_words |
Word list and hashers to test
Definition at line 194 of file hash-example.cc.
|
inline |
|
inline |
Add a Collider containing a hash function
Definition at line 204 of file hash-example.cc.
References m_hashes.
Referenced by main(), and ns3::Hash::Example::DictFiles::ReadInto().
|
inline |
Add a string to the dictionary
[in] | phrase | the string to add |
Definition at line 214 of file hash-example.cc.
References m_hashes, m_nphrases, and m_words.
|
inline |
Print the collisions for each Collider
Definition at line 296 of file hash-example.cc.
References m_hashes, and ReportExpectedCollisions().
Referenced by main().
|
inline |
Report the expected number of collisions
See, e.g., http://www.math.dartmouth.edu/archive/m19w03/public_html/Section6-5.pdf
where n is the number of entries in the table, and k is the number of buckets.
This form is numerically unstable for low collision rates. Expanding for large we get
For simplicity, we'll use the first two terms of the second form.
Definition at line 273 of file hash-example.cc.
References m_nphrases.
Referenced by Report().
|
inline |
Report the execution time of each hash across the entire Dictionary
Definition at line 344 of file hash-example.cc.
References m_hashes, and TimeOne().
Referenced by main().
|
inline |
Time and report the execution of one hash across the entire Dictionary
[in] | hindex | index of the hash Collider to use |
Definition at line 313 of file hash-example.cc.
References ns3::Hasher::clear(), ns3::Hasher::GetHash32(), m_hashes, m_nphrases, m_words, visualizer.core::start(), and visualizer.higcontainer::w.
Referenced by Time().
|
private |
|
private |
Number of strings hashed
Definition at line 363 of file hash-example.cc.
Referenced by Add(), ReportExpectedCollisions(), and TimeOne().
|
private |
List of unique words
Definition at line 365 of file hash-example.cc.
Referenced by Add(), Dictionary(), and TimeOne().