libdacav 0.9.0
|
Hash table implementation. More...
Go to the source code of this file.
Typedefs | |
typedef struct dhash | dhash_t |
Opaque type for hash table. | |
typedef uintptr_t(* | dhash_cb_t )(const void *key) |
Callback for hashing of a generic object. | |
typedef struct pair | dhash_pair_t |
Opaque structure that contains the <key,value> pair. | |
Enumerations | |
enum | dhash_result_t { DHASH_FOUND = 0, DHASH_NOTFOUND = 1 } |
Return values for hash lookup functions. More... | |
Functions | |
const void * | dhash_key (dhash_pair_t *p) |
Given a dhash_pair_t element, returns the corresponding key. | |
void * | dhash_val (dhash_pair_t *p) |
Given a dhash_pair_t element, returns the corresponding value. | |
dhash_t * | dhash_new (unsigned nbuckets, dhash_cb_t hf, dcmp_cb_t cmp, const dcprm_t *key_cprm, const dcprm_t *val_cprm) |
Complete constructor for a hash table. | |
void | dhash_free (dhash_t *htab) |
Destructor for a hash table. | |
dhash_result_t | dhash_insert (dhash_t *htab, const void *key, const void *value) |
Value insertion procedure. | |
dhash_result_t | dhash_search_default (dhash_t *htab, const void *key, void **found, dcreate_cb_t create, void *ctx) |
Search for a value by providing a key. | |
dhash_result_t | dhash_search (dhash_t *htab, const void *key, void **found) |
Search for a value by providing a key. | |
dhash_result_t | dhash_delete (dhash_t *htab, const void *key, void **found) |
Delete the value associated to the given key. | |
diter_t * | dhash_iter_new (dhash_t *t) |
Build an iterator for the hash table. | |
void | dhash_iter_free (diter_t *i) |
Destroy the iterator. |
Hash table implementation.