1 #ifndef POINTER_HASH_CLASS
2 #define POINTER_HASH_CLASS
36 template <
class contents>
73 template <
class contents>
79 template <
class contents>
83 template <
class contents>
86 template <
class contents>
89 template <
class contents>
96 template <
class contents>
103 template <
class contents>
110 template <
class contents>
117 template <
class contents>
120 for (
int i = 0; i < _ids->elements(); i++) {
121 void *current = (*_ids)[i];
124 _ids->remove(current);
127 to_apply(current, *found, data_link);
Outcomes describe the state of completion for an operation.
Implements hashing into buckets for quick object access.
basis::outcome add(const key_type &key, contents *to_store)
Stores "to_store" into the table given its "key" for hashing.
contents * acquire(const key_type &key)
retrieves the contents held for "key" out of the table.
void reset()
removes all entries in the table and returns it to a pristine state.
bool find(const key_type &key, contents *&item_found) const
locates the item specified by the "key", if possible.
int estimated_elements() const
returns the size of table we're optimized for.
bool zap(const key_type &key)
removes the entry with the "key" specified.
A hash table for storing pointers.
const pointer_set & ids() const
bool zap(void *key)
overrides base zap() method plus keeps id list updated.
void apply(apply_function *to_apply, void *data_link)
operates on every item in the pointer_hash table.
bool apply_function(const void *&key, contents ¤t, void *data_link)
pointer_hash(int estimated_elements)
contents * acquire(void *key)
overrides base acquire() by ensuring that the ids stay up to date.
void ids(pointer_set &ids) const
provides the current list of valid identifiers.
basis::outcome add(void *key, contents *to_store)
overrides base add() and ensures that the id list stays up to date.
void reset()
overrides base reset() and ensures that the id list stays up to date.
A set of pointers that hides the platform's pointer size.
Implements a hashing algorithm based on the contents stored in an object.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
A dynamic container class that holds any kind of object via pointers.