|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Generic hash table with collision resolution by separate chaining and buckets without virtual destructor. More...
#include <tpl_lhash.H>
Public Types | |
| using | Base = GenLhashTable< Key, LhashBucket< Key >, Cmp > |
Public Types inherited from Aleph::GenLhashTable< Key, BucketType, Cmp > | |
| using | Bucket = BucketType |
| using | Hash_Fct = std::function< size_t(const Key &)> |
| using | Hash_Fct_Ptr = size_t(*)(const Key &) |
| using | Key_Type = Key |
| using | Item_Type = Key |
Additional Inherited Members | |
Public Member Functions inherited from Aleph::GenLhashTable< Key, BucketType, Cmp > | |
| Cmp & | get_compare () |
| const Cmp & | get_compare () const |
| GenLhashTable (size_t table_size=Primes::DefaultPrime, Hash_Fct_Ptr hash_fct=Aleph::dft_hash_fct< Key >, Cmp cmp=Cmp(), float lower_alpha=hash_default_lower_alpha, float upper_alpha=hash_default_upper_alpha, bool remove_all_buckets=true, bool with_resize=true) | |
| Instantiate a generic hash table. | |
| void | swap (GenLhashTable &other) noexcept |
| GenLhashTable (const GenLhashTable &)=delete | |
| GenLhashTable & | operator= (const GenLhashTable &)=delete |
| GenLhashTable (GenLhashTable &&other) noexcept | |
| GenLhashTable & | operator= (GenLhashTable &&other) noexcept |
| void | empty () noexcept |
| Empties the hash table; frees memory of all buckets. | |
| Hash_Fct | get_hash_fct () const noexcept |
| void | set_hash_fct (Hash_Fct fct) noexcept |
| Set the internal hash function. | |
| void | set_hash_fct (Hash_Fct_Ptr fct) noexcept |
| float | current_alpha () const noexcept |
| return the current table load | |
| Bucket * | insert (Bucket *bucket) |
| Inserts bucket into the table and returns its address if the key is not already in the table; otherwise returns nullptr. | |
| Bucket * | search_or_insert (Bucket *bucket) |
| Bucket * | search (const Key &key) const noexcept |
| Search in the table for a bucket with key. | |
| Bucket * | remove (Bucket *bucket) noexcept |
| Removes bucket from the table. | |
| size_t | resize (const size_t new_size) |
| Resizes the hash table to new_size and re-locates keys. | |
| virtual | ~GenLhashTable () |
| Frees the table memory and, if remove_all_buckets is true (specified in the constructor), also frees memory of all buckets. | |
| Bucket * | search_next (Bucket *bucket) const |
| Returns the next bucket that collides with bucket. | |
| const size_t & | capacity () const noexcept |
| Returns the table capacity. | |
| const size_t & | size () const noexcept |
| Returns the number of elements contained in the table. | |
| const size_t & | get_num_busy_slots () const noexcept |
| Returns the number of occupied entries in the array. | |
| constexpr bool | is_empty () const noexcept |
Public Member Functions inherited from HashStats< GenLhashTable< Key, BucketType, Cmp > > | |
| Stats | stats () const |
| Computes statistics about chain length distribution. | |
| void | print_stats (const Stats &stats) const |
| Prints statistics to standard output. | |
| void | set_upper_alpha (float __upper_alpha) |
| Sets the upper load factor threshold. | |
| void | set_lower_alpha (float __lower_alpha) |
| Sets the lower load factor threshold. | |
| constexpr float | get_lower_alpha () const noexcept |
| Returns the lower load factor threshold. | |
| constexpr float | get_upper_alpha () const noexcept |
| Returns the upper load factor threshold. | |
Protected Member Functions inherited from Aleph::GenLhashTable< Key, BucketType, Cmp > | |
| GenLhashTable (const size_t table_size, Hash_Fct hash_f, Cmp cpm_fct, const float lower, const float upper, const bool remove_all, const bool resize) | |
| template<typename HashFunc , typename SearchKey > | |
| Bucket * | search_with_custom_hash (HashFunc hash_func, const SearchKey &search_key) const noexcept |
| Helper method for derived classes to perform custom heterogeneous searches. | |
Protected Attributes inherited from Aleph::GenLhashTable< Key, BucketType, Cmp > | |
| Hash_Fct | hash_fct |
| size_t | len |
| Cmp | cmp |
| float | lower_alpha |
| float | upper_alpha |
Generic hash table with collision resolution by separate chaining and buckets without virtual destructor.
The LhashTable type implements a generic hash table with collision resolution by separate chaining where buckets do not have a virtual destructor.
| Key | indexing key type of the table. |
| Cmp | key comparison class; must return true if keys are equal. |
Definition at line 808 of file tpl_lhash.H.
| using Aleph::LhashTable< Key, Cmp >::Base = GenLhashTable<Key, LhashBucket<Key>, Cmp> |
Definition at line 810 of file tpl_lhash.H.