feisty meow concerns codebase  2.140
structures::string_hash< contents > Class Template Reference

Implements a hash table indexed on character strings. More...

#include <string_hash.h>

Inheritance diagram for structures::string_hash< contents >:
Collaboration diagram for structures::string_hash< contents >:

Public Member Functions

 string_hash (int estimated_elements)
 
 ~string_hash ()
 
- Public Member Functions inherited from structures::hash_table< basis::astring, contents >
 hash_table (const hashing_algorithm &hasher, int estimated_elements)
 Creates a table using the "hasher" that is ready to store "estimated_elements". More...
 
virtual ~hash_table ()
 destroys any objects left in the hash_table. More...
 
 DEFINE_CLASS_NAME ("hash_table")
 
void rehash (int estimated_elements)
 resizes the hashing structures to optimise for a new size of "estimated_elements". More...
 
int elements () const
 the number of valid items we found by traversing the hash table. More...
 
int estimated_elements () const
 returns the size of table we're optimized for. More...
 
basis::outcome add (const basis::astring &key, contents *to_store)
 Stores "to_store" into the table given its "key" for hashing. More...
 
basis::outcome add (basis::astring *key, contents *to_store, bool check_dupes=true)
 specialized add for a pre-existing pointer "key". More...
 
basis::outcome fast_dangerous_add (const basis::astring &key, contents *to_store)
 Like the add method above, but doesn't check for duplicates. More...
 
bool find (const basis::astring &key, contents *&item_found) const
 locates the item specified by the "key", if possible. More...
 
contents * find (const basis::astring &key) const
 simplified form of above find() method. More...
 
contents * acquire (const basis::astring &key)
 retrieves the contents held for "key" out of the table. More...
 
bool zap (const basis::astring &key)
 removes the entry with the "key" specified. More...
 
void reset ()
 removes all entries in the table and returns it to a pristine state. More...
 
void apply (apply_function *to_apply, void *data_link)
 Invokes the function "to_apply" on every entry in the table. More...
 
bool verify () const
 returns true if the hash table is internally consistent. More...
 
internal_hash_array< basis::astring, contents > & table_access () const
 special accessor for the copy_hash_table method only. More...
 
- Public Member Functions inherited from basis::nameable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Additional Inherited Members

- Public Types inherited from structures::hash_table< basis::astring, contents >
enum  outcomes
 
typedef bool apply_function(const basis::astring &key, contents &current, void *data_link)
 the "apply_function" is what a user of the "apply" method must supply. More...
 
- Static Public Member Functions inherited from structures::hash_table< basis::astring, contents >
static int calculate_num_slots (int estimated_elements)
 a helper method that lets us know what n is for how many 2^n slots we should have. More...
 

Detailed Description

template<class contents>
class structures::string_hash< contents >

Implements a hash table indexed on character strings.

Definition at line 28 of file string_hash.h.

Constructor & Destructor Documentation

◆ string_hash()

template<class contents >
structures::string_hash< contents >::string_hash ( int  estimated_elements)
inline

Definition at line 31 of file string_hash.h.

◆ ~string_hash()

template<class contents >
structures::string_hash< contents >::~string_hash ( )
inline

Definition at line 34 of file string_hash.h.


The documentation for this class was generated from the following file: