X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Fhashtable.h;h=0a9ea209fe7ad5a8707fb1981b75235df8831e7d;hp=9a32abc94746fc2bb966013572f7b209c688af4f;hb=329b5ab58cde015f4faec1879d3106f635294dd6;hpb=9d72edf41ce3a2ddbbe2d44afc23ef5ec53339c3 diff --git a/include/hashtable.h b/include/hashtable.h index 9a32abc..0a9ea20 100644 --- a/include/hashtable.h +++ b/include/hashtable.h @@ -4,8 +4,9 @@ #include "map.h" typedef struct ht hashtable_t; +typedef struct ht_iter ht_iter_t; -hashtable_t *ht_alloc (const datatype_t *key_type); +hashtable_t * ht_alloc (const datatype_t *key_type); uint64_t ht_cas (hashtable_t *ht, void *key, uint64_t expected_val, uint64_t val); uint64_t ht_get (hashtable_t *ht, void *key); uint64_t ht_remove (hashtable_t *ht, void *key); @@ -13,9 +14,14 @@ uint64_t ht_count (hashtable_t *ht); void ht_print (hashtable_t *ht); void ht_free (hashtable_t *ht); +ht_iter_t * ht_iter_begin (hashtable_t *ht, void *key); +uint64_t ht_iter_next (ht_iter_t *iter, void **key_ptr); +void ht_iter_free (ht_iter_t *iter); + static const map_impl_t ht_map_impl = { (map_alloc_t)ht_alloc, (map_cas_t)ht_cas, (map_get_t)ht_get, (map_remove_t)ht_remove, - (map_count_t)ht_count, (map_print_t)ht_print, (map_free_t)ht_free + (map_count_t)ht_count, (map_print_t)ht_print, (map_free_t)ht_free, (map_iter_begin_t)ht_iter_begin, + (map_iter_next_t)ht_iter_next, (map_iter_free_t)ht_iter_free }; #endif//HASHTABLE_H