54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
#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 */
|