137#ifndef __TOMMYHASHDYN_H
138#define __TOMMYHASHDYN_H
149#define TOMMY_HASHDYN_BIT 4
229 if (i->
index == hash && cmp(cmp_arg, i->
data) == 0)
286 return hashdyn->
count;
Hashtable container type.
Definition: tommyhashdyn.h:161
tommy_size_t count
Number of elements.
Definition: tommyhashdyn.h:165
tommy_uint_t bucket_bit
Bits used in the bit mask.
Definition: tommyhashdyn.h:166
tommy_hashdyn_node ** bucket
Hash buckets.
Definition: tommyhashdyn.h:162
tommy_size_t bucket_mask
Bit mask to access the buckets.
Definition: tommyhashdyn.h:164
tommy_size_t bucket_max
Number of buckets.
Definition: tommyhashdyn.h:163
Data structure node.
Definition: tommytypes.h:211
tommy_size_t index
Index of the node.
Definition: tommytypes.h:236
struct tommy_node_struct * next
Next node.
Definition: tommytypes.h:216
void * data
Pointer to the object containing the node.
Definition: tommytypes.h:228
Hash functions for the use with tommy_hashtable, tommy_hashdyn and tommy_hashlin.
void * tommy_hashdyn_search(tommy_hashdyn *hashdyn, tommy_search_func *cmp, const void *cmp_arg, tommy_hash_t hash)
Searches an element in the hashtable.
Definition: tommyhashdyn.h:223
TOMMY_API void * tommy_hashdyn_remove(tommy_hashdyn *hashdyn, tommy_search_func *cmp, const void *cmp_arg, tommy_hash_t hash)
Searches and removes an element from the hashtable.
TOMMY_API void tommy_hashdyn_foreach_arg(tommy_hashdyn *hashdyn, tommy_foreach_arg_func *func, void *arg)
Calls the specified function with an argument for each element in the hashtable.
TOMMY_API tommy_size_t tommy_hashdyn_memory_usage(tommy_hashdyn *hashdyn)
Gets the size of allocated memory.
tommy_hashdyn_node * tommy_hashdyn_bucket(tommy_hashdyn *hashdyn, tommy_hash_t hash)
Gets the bucket of the specified hash.
Definition: tommyhashdyn.h:208
TOMMY_API void tommy_hashdyn_foreach(tommy_hashdyn *hashdyn, tommy_foreach_func *func)
Calls the specified function for each element in the hashtable.
tommy_size_t tommy_hashdyn_count(tommy_hashdyn *hashdyn)
Gets the number of elements.
Definition: tommyhashdyn.h:284
TOMMY_API void tommy_hashdyn_done(tommy_hashdyn *hashdyn)
Deinitializes the hashtable.
TOMMY_API void * tommy_hashdyn_remove_existing(tommy_hashdyn *hashdyn, tommy_hashdyn_node *node)
Removes an element from the hashtable.
tommy_node tommy_hashdyn_node
Hashtable node.
Definition: tommyhashdyn.h:155
struct tommy_hashdyn_struct tommy_hashdyn
Hashtable container type.
TOMMY_API void tommy_hashdyn_init(tommy_hashdyn *hashdyn)
Initializes the hashtable.
TOMMY_API void tommy_hashdyn_insert(tommy_hashdyn *hashdyn, tommy_hashdyn_node *node, void *data, tommy_hash_t hash)
Inserts an element in the hashtable.
uint64_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:60
void tommy_foreach_func(void *obj)
Foreach function.
Definition: tommytypes.h:318
int tommy_search_func(const void *arg, const void *obj)
Search function for elements.
Definition: tommytypes.h:307
void tommy_foreach_arg_func(void *arg, void *obj)
Foreach function with an argument.
Definition: tommytypes.h:325
tommy_size_t tommy_hash_t
Type used in hashtables to store the hash of an object.
Definition: tommytypes.h:193
tommy_uint32_t tommy_uint_t
Generic unsigned integer type.
Definition: tommytypes.h:80