aboutsummaryrefslogtreecommitdiff
path: root/include/BH/Hashmap.h
blob: bd188eada59f904e0a5407827e856933d53e0ef7 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef BH_HASHMAP_H
#define BH_HASHMAP_H


#include "Common.h"


typedef struct BH_Hashmap BH_Hashmap;


BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal,
                          BH_HashCallback hash);


void BH_HashmapFree(BH_Hashmap *hashmap);


void BH_HashmapClear(BH_Hashmap *hashmap);


int BH_HashmapReserve(BH_Hashmap *hashmap,
                      size_t size);


int BH_HashmapInsert(BH_Hashmap *hashmap,
                     void *key,
                     void *value);


void BH_HashmapRemove(BH_Hashmap *hashmap,
                      void *key);


int BH_HashmapAt(BH_Hashmap *hashmap,
                 void *key,
                 void **value);


int BH_HashmapEmpty(BH_Hashmap *hashmap);


size_t BH_HashmapSize(BH_Hashmap *hashmap);


size_t BH_HashmapCapacity(BH_Hashmap *hashmap);


float BH_HashmapFactor(BH_Hashmap *hashmap);


void BH_HashmapSetFactor(BH_Hashmap *hashmap,
                         float factor);


void *BH_HashmapIterAt(BH_Hashmap *hashmap,
                       void *key);


void *BH_HashmapIterNext(BH_Hashmap *hashmap,
                         void *iter);


void BH_HashmapIterRemove(BH_Hashmap *hashmap,
                          void *iter);


void *BH_HashmapIterKey(void *iter);


void *BH_HashmapIterValue(void *iter);


#endif /* BH_HASHMAP_H */