66 #ifdef KAZLIB_SIDEEFFECT_DEBUG 76 #define HASH_IMPLEMENTATION 81 #define HASHCOUNT_T_MAX ULONG_MAX 86 #define HASH_VAL_T_MAX ULONG_MAX 103 #ifndef HASH_MIN_SIZE 104 #define HASH_MIN_SIZE ((hashcount_t)4) 110 #ifndef HASH_MAX_SIZE 111 #define HASH_MAX_SIZE ((hashcount_t)HASHCOUNT_T_MAX) 151 #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) 152 struct hnode_t *next;
153 struct hnode_t **pself;
269 #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) 304 #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) 373 #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) 379 #define hash_isfull(H) ((H)->count == (H)->maxcount) 385 #define hash_isempty(H) ((H)->count == 0) 391 #define hash_count(H) ((H)->count) 397 #define hash_size(H) ((H)->nchains) 403 #define hnode_get(N) ((N)->data) 409 #define hnode_getkey(N) ((N)->key) 416 #define hnode_put(N, V) ((N)->data = (V)) 418 #endif // !HASH_IMPLEMENTATION 423 #endif // _RNR_HASH_H int(* hash_comp_t)(const void *key1, const void *key2)
User comparison function override type.
hashcount_t nchains
Note 6.
hashcount_t maxsize
Note 3.
void hash_set_self_verify(bool_t selfverify)
Enable (disable) automatic self-checks during hash table modification operatations.
void hnode_delete(hnode_t *node)
Destroy a dynamically allocated node.
hashcount_t minsize
Note 2.
void hash_scan_begin(hscan_t *scan, hash_t *hash)
Reset the hash scanner (iterator).
void hash_node_insert(hash_t *hash, hnode_t *node, void *key)
Insert a node into the hash table.
void hash_node_delete(hash_t *hash, hnode_t *node)
Unlink and delete a hash node from the hash table.
hash_comp_t compare
Note 9.
hash_val_t(* hash_fun_t)(const void *key)
User hashing function type.
hnode_t * hnode_create(void *data)
Create a hash table node dynamically and assign it the given data.
hnode_t * hnode_init(hnode_t *node, void *data)
Initialize a client-supplied hash node.
hashcount_t highmark
Note 4.
hash_t * hash_table_init(hash_t *hash, hashcount_t minsize, hashcount_t maxsize, hash_comp_t compfun, hash_fun_t hashfun, hnode_data_free_t freedatafun, hnode_t **table, hashcount_t nchains)
Initialize a user supplied hash table.
unsigned long hashcount_t
maximum hash table size type
void hnode_destroy(hnode_t *node, hnode_data_free_t freedatafun)
Hash node and user data deallocator.
bool_t hash_insert(hash_t *hash, void *key, void *data)
Insert user data with the given key into the hash table.
void(* hnode_data_free_t)(void *key, void *data)
User node data deallocator function.
#define C_DECLS_BEGIN
C declaration block begin in C.
hnode_t * hash_lookup(hash_t *hash, const void *key)
Find a node in the hash table and return a pointer to it.
unsigned long hash_val_t
hashed value return type
void hash_table_destroy(hash_t *hash)
Delete the hash table, all of its entries, and all of the user data.
hashcount_t lowmark
Note 5.
RoadNarrows Robotics common configuration file.
hnode_t * hash_node_fast_unlink(hash_t *hash, hnode_t *node)
Fast version to unlink the given node from the hash table.
#define C_DECLS_END
C declaration block end in C.
hnode_t * hash_scan_next(hscan_t *scan)
Retrieve the next node from the hash table.
hnode_data_free_t freenodedata
Note 11.
Hash table control structure.
void hash_table_delete(hash_t *hash)
Frees a dynamic hash table structure.
struct hash_t hash_t
Hash table control structure.
Hash chain node structure.
int hash_table_verify(hash_t *hash)
Verify hash table consistency.
hash_t * hash_table_create(bool_t isdynamic, hashcount_t minsize, hashcount_t maxsize, hash_comp_t compfun, hash_fun_t hashfun, hnode_data_free_t freedatafun)
Create a dynamic hash table.
hnode_t * hash_node_unlink(hash_t *hash, hnode_t *node)
Unlink the given node from the hash table.
struct hscan_t hscan_t
Hash scanner structure.
struct hnode_t hnode_t
Hash chain node structure.
bool_t hash_delete(hash_t *hash, void *key)
Unlink and delete a hash node with the given key from the hash table.