This repository has been archived on 2026-04-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bhlib-old/include/bh/hashmap.h

54 lines
1.3 KiB
C
Raw Permalink Normal View History

#ifndef BH_HASHMAP_H
#define BH_HASHMAP_H
2024-04-13 14:52:29 +03:00
#include "bh.h"
2024-04-13 14:52:29 +03:00
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 */