]> pd.if.org Git - nbds/blob - include/map.h
update todo list
[nbds] / include / map.h
1 #ifndef MAP_H
2 #define MAP_H
3
4 #include "datatype.h"
5
6 typedef struct map map_t;
7
8 typedef const struct map_impl *map_type_t;
9
10 extern map_type_t MAP_TYPE_HASHTABLE;
11 extern map_type_t MAP_TYPE_SKIPLIST;
12 extern map_type_t MAP_TYPE_LIST;
13
14 map_t *  map_alloc  (map_type_t map_type, const datatype_t *key_type);
15 uint64_t map_get    (map_t *map, void *key);
16 uint64_t map_set    (map_t *map, void *key, uint64_t new_val);
17 uint64_t map_add    (map_t *map, void *key, uint64_t new_val);
18 uint64_t map_cas    (map_t *map, void *key, uint64_t expected_val, uint64_t new_val);
19 uint64_t map_replace(map_t *map, void *key, uint64_t new_val);
20 uint64_t map_remove (map_t *map, void *key);
21 uint64_t map_count  (map_t *map);
22 void     map_print  (map_t *map);
23 void     map_free   (map_t *map);
24
25 #endif//MAP_H