]> pd.if.org Git - nbds/blob - include/map.h
357b66895f3b16ace6ae137226ab2599818e938a
[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
12 map_t *  map_alloc  (map_type_t map_type, const datatype_t *key_type);
13 uint64_t map_get    (map_t *map, void *key);
14 uint64_t map_set    (map_t *map, void *key, uint64_t new_val);
15 uint64_t map_add    (map_t *map, void *key, uint64_t new_val);
16 uint64_t map_cas    (map_t *map, void *key, uint64_t expected_val, uint64_t new_val);
17 uint64_t map_replace(map_t *map, void *key, uint64_t new_val);
18 uint64_t map_remove (map_t *map, void *key);
19 uint64_t map_count  (map_t *map);
20 void     map_print  (map_t *map);
21 void     map_free   (map_t *map);
22
23 #endif//MAP_H