#include <htable.h>


Public Member Functions | |
| htable (int n, int kl=0) | |
| Creates an hash table. | |
| ~htable () | |
| Destroys an and hash table. | |
| void | set_keylen (int kl) |
| address | Hash (const T key) |
| Computes the hash function. | |
| int | Comp (const T Key1, const T Key2) |
| Compares the keys of two entries. | |
| T | find (T item) |
| Searches for an item. | |
| T | insert (T item) |
| T | scan (HT_ACTION action) |
| Scans the content. | |
| void | stat () |
| Prints statistics. | |
| void | map (std::ostream &co=std::cout, int cols=80) |
| Print a map of memory use. | |
| int | used () |
| Returns amount of used memory. | |
| template<> | |
| void | set_keylen (int kl) |
| template<> | |
| address | Hash (char *key) |
| template<> | |
| int | Comp (char *key1, char *key2) |
Definition at line 57 of file htable.h.
Creates an hash table.
Definition at line 110 of file htable.h.
References BlockSize, and htable< T >::set_keylen().

| int htable< char * >::Comp | ( | char * | key1, | |
| char * | key2 | |||
| ) | [inline] |
Definition at line 97 of file htable.cpp.
Compares the keys of two entries.
Referenced by htable< T >::find(), and htable< T >::insert().

Searches for an item.
Definition at line 132 of file htable.h.
References htable< T >::Comp(), htable< T >::Hash(), entry< T >::key, entry< T >::next, and NULL.
Referenced by dictionary::encode(), ngramcache::get(), and dictionary::getcode().


Computes the hash function.
Referenced by htable< T >::find(), and htable< T >::insert().

Definition at line 158 of file htable.h.
References mempool::allocate(), htable< T >::Comp(), htable< T >::Hash(), entry< T >::key, entry< T >::next, and NULL.
Referenced by ngramcache::add(), dictionary::dictionary(), dictionary::encode(), dictionary::grow(), dictionary::load(), and dictionary::sort().


Print a map of memory use.
| void htable< char * >::set_keylen | ( | int | kl | ) | [inline] |
Definition at line 41 of file htable.cpp.
Prints statistics.
Definition at line 258 of file htable.h.
References htable< T >::used().

Returns amount of used memory.
Definition at line 101 of file htable.h.
Referenced by ngramcache::stat(), htable< T >::stat(), and dictionary::stat().

1.5.9