libdacav 0.9.0
/home/dacav/Projects/libdacav/libdacav/dacav/dacavhash.h File Reference

Hash table implementation. More...

#include <dacav/dacav.h>
#include <stdint.h>

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_tdhash_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_tdhash_iter_new (dhash_t *t)
 Build an iterator for the hash table.
void dhash_iter_free (diter_t *i)
 Destroy the iterator.

Detailed Description

Hash table implementation.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator