]> begriffs open source - libderp/blob - include/hashmap.h
Don't skip the first hashmap bucket
[libderp] / include / hashmap.h
1 #ifndef LIBDERP_HASHMAP_H
2 #define LIBDERP_HASHMAP_H
3
4 #include "common.h"
5 #include "list.h"
6
7 #include <stdbool.h>
8 #include <stddef.h>
9
10 typedef struct hashmap hashmap;
11 typedef struct hm_iter hm_iter;
12
13 hashmap * hm_new(size_t, hashfn *, comparator *, void *cmp_aux);
14 void      hm_free(hashmap *);
15 void      hm_dtor(hashmap *, dtor *key_dtor, dtor *val_dtor, void *aux);
16 size_t    hm_length(const hashmap *);
17 bool      hm_is_empty(const hashmap *);
18 void *    hm_at(const hashmap *, const void *);
19 bool      hm_insert(hashmap *, void *key, void *val);
20 bool      hm_remove(hashmap *, void *);
21 void      hm_clear(hashmap *);
22
23 hm_iter*         hm_iter_begin(hashmap *);
24 struct map_pair* hm_iter_next(hm_iter *);
25 void             hm_iter_free(hm_iter *);
26
27 #endif