00001 #ifndef HASHMAP_H
00002 #define HASHMAP_H
00003
00004
00005
00006
00007
00008
00009 #include "iter.h"
00010
00026 struct hashmap_entry {
00027 struct hashmap_entry *next_in_bucket;
00028 void *value;
00029 };
00030
00031 struct hashmap {
00032 struct hashmap_entry **table;
00033 unsigned used_slots;
00034 short table_size_index;
00035 };
00036
00037 typedef struct hashmap Hashmap;
00038
00042 void hashmap_open(Hashmap*, unsigned int initial_size);
00043
00047 void hashmap_close(Hashmap*);
00048
00058 void* hashmap_get(Hashmap*, void *key, void *key_end);
00059
00067 void hashmap_put(Hashmap*, void *key, void *key_end,
00068 void *data, void *data_end);
00069
00079 void* hashmap_get_or_put(Hashmap*,
00080 void *key, void *key_end,
00081 void *data, void *data_end);
00082
00091 int hashmap_remove(Hashmap*, void *key, void *key_end);
00092
00104 void* hashmap_iterate(Hashmap*, iter* i, void** value);
00105
00106 #endif
00107