16 #ifndef LY_HASH_TABLE_H_
17 #define LY_HASH_TABLE_H_
47 LIBYANG_API_DECL uint32_t
lyht_hash_multi(uint32_t hash,
const char *key_part,
size_t len);
61 LIBYANG_API_DECL uint32_t
lyht_hash(
const char *key,
size_t len);
119 LIBYANG_API_DECL
void lyht_free(
struct ly_ht *ht,
void (*val_free)(
void *val_p));
131 LIBYANG_API_DECL
LY_ERR lyht_find(
const struct ly_ht *ht,
void *val_p, uint32_t hash,
void **match_p);
ly_bool(* lyht_value_equal_cb)(void *val1_p, void *val2_p, ly_bool mod, void *cb_data)
Callback for checking hash table values equivalence.
LIBYANG_API_DECL LY_ERR lyht_insert(struct ly_ht *ht, void *val_p, uint32_t hash, void **match_p)
Insert a value into a hash table.
LIBYANG_API_DECL uint32_t lyht_get_fixed_size(uint32_t item_count)
Get suitable size of a hash table for a fixed number of items.
uint8_t ly_bool
Type to indicate boolean value.
LIBYANG_API_DECL LY_ERR lyht_insert_with_resize_cb(struct ly_ht *ht, void *val_p, uint32_t hash, lyht_value_equal_cb resize_val_equal, void **match_p)
Insert a value into hash table. Same functionality as lyht_insert() but allows to specify a temporary...
LIBYANG_API_DECL LY_ERR lyht_remove_with_resize_cb(struct ly_ht *ht, void *val_p, uint32_t hash, lyht_value_equal_cb resize_val_equal)
Remove a value from a hash table. Same functionality as lyht_remove() but allows to specify a tempora...
LIBYANG_API_DECL LY_ERR lyht_find_next(const struct ly_ht *ht, void *val_p, uint32_t hash, void **match_p)
Find another equal value in the hash table.
LIBYANG_API_DECL lyht_value_equal_cb lyht_set_cb(struct ly_ht *ht, lyht_value_equal_cb new_val_equal)
Set hash table value equal callback.
LIBYANG_API_DECL uint32_t lyht_hash_multi(uint32_t hash, const char *key_part, size_t len)
Compute hash from (several) string(s).
LIBYANG_API_DECL LY_ERR lyht_find(const struct ly_ht *ht, void *val_p, uint32_t hash, void **match_p)
Find a value in a hash table.
LIBYANG_API_DECL void * lyht_set_cb_data(struct ly_ht *ht, void *new_cb_data)
Set hash table value equal callback user data.
LIBYANG_API_DECL LY_ERR lyht_insert_no_check(struct ly_ht *ht, void *val_p, uint32_t hash, void **match_p)
Insert a value into a hash table, without checking whether the value has already been inserted...
LIBYANG_API_DECL LY_ERR lyht_find_next_with_collision_cb(const struct ly_ht *ht, void *val_p, uint32_t hash, lyht_value_equal_cb collision_val_equal, void **match_p)
Find another equal value in the hash table. Same functionality as lyht_find_next() but allows to spec...
LIBYANG_API_DECL struct ly_ht * lyht_dup(const struct ly_ht *orig)
Make a duplicate of an existing hash table.
LIBYANG_API_DECL struct ly_ht * lyht_new(uint32_t size, uint16_t val_size, lyht_value_equal_cb val_equal, void *cb_data, uint16_t resize)
Create new hash table.
LIBYANG_API_DECL LY_ERR lyht_remove(struct ly_ht *ht, void *val_p, uint32_t hash)
Remove a value from a hash table.
LIBYANG_API_DECL uint32_t lyht_hash(const char *key, size_t len)
Compute hash from a string.
LIBYANG_API_DECL LY_ERR lyht_find_with_val_cb(const struct ly_ht *ht, void *val_p, uint32_t hash, lyht_value_equal_cb val_equal, void **match_p)
Find a value in a hash table but use a custom val_equal callback.
Logger manipulation routines and error definitions.
LY_ERR
libyang's error codes returned by the libyang functions.
LIBYANG_API_DECL void lyht_free(struct ly_ht *ht, void(*val_free)(void *val_p))
Free a hash table.