aboutsummaryrefslogtreecommitdiff
path: root/include/bh/hashmap.h
blob: e57c03d394f63b897d7ab129cd8d01f03fd7d62e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef BH_HASHMAP_H
#define BH_HASHMAP_H

#include "bh.h"

typedef struct bh_hashmap_s bh_hashmap_t;

bh_hashmap_t *bh_hashmap_new(bh_equal_cb_t equal,
                             bh_hash_cb_t hash);

void bh_hashmap_free(bh_hashmap_t *hashmap);

void bh_hashmap_clear(bh_hashmap_t *hashmap);

int bh_hashmap_reserve(bh_hashmap_t *hashmap,
                        size_t size);

int bh_hashmap_insert(bh_hashmap_t *hashmap,
                      void *key,
                      void *value);

void bh_hashmap_remove(bh_hashmap_t *hashmap,
                       void *key);

void *bh_hashmap_at(bh_hashmap_t *hashmap,
                    void *key,
                    int *exists);

int bh_hashmap_empty(bh_hashmap_t *hashmap);

size_t bh_hashmap_size(bh_hashmap_t *hashmap);

size_t bh_hashmap_capacity(bh_hashmap_t *hashmap);

float bh_hashmap_factor(bh_hashmap_t *hashmap);

void bh_hashmap_set_factor(bh_hashmap_t *hashmap,
                           float factor);

void *bh_hashmap_iter_at(bh_hashmap_t *hashmap,
                         void *key);

void *bh_hashmap_iter_next(bh_hashmap_t *hashmap,
                           void *iter);

void bh_hashmap_iter_remove(bh_hashmap_t *hashmap,
                            void *iter);

void *bh_hashmap_iter_key(void *iter);

void *bh_hashmap_iter_value(void *iter);

#endif /* BH_HASHMAP_H */