2018-05-18 14:01:02 +00:00
|
|
|
#ifndef __HASHMAP_HASHMAP_H
|
|
|
|
#define __HASHMAP_HASHMAP_H
|
|
|
|
|
|
|
|
#include <linkedlist.h>
|
|
|
|
|
|
|
|
#define BUCKET_SIZE 64
|
|
|
|
|
|
|
|
struct hashmap {
|
|
|
|
struct ll buckets[BUCKET_SIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hashmap new_map();
|
2018-05-20 02:36:01 +00:00
|
|
|
void insert_map(struct hashmap *map, const char *key, const void *value);
|
|
|
|
const void *lookup_map(struct hashmap *map, const char *key);
|
2018-05-18 14:01:02 +00:00
|
|
|
int exists_map(struct hashmap *map, const char *key);
|
2018-05-20 02:36:01 +00:00
|
|
|
const void *remove_map(struct hashmap *map, const char *key);
|
|
|
|
void foreach_map(struct hashmap *map, void (*cb)(const char *key, const void *value));
|
2018-05-18 14:01:02 +00:00
|
|
|
|
|
|
|
#endif
|