6 typedef struct map map_t;
7 typedef struct map_iter map_iter_t;
8 typedef struct map_impl map_impl_t;
10 map_t * map_alloc (const map_impl_t *map_impl, const datatype_t *key_type);
11 uint64_t map_get (map_t *map, void *key);
12 uint64_t map_set (map_t *map, void *key, uint64_t new_val);
13 uint64_t map_add (map_t *map, void *key, uint64_t new_val);
14 uint64_t map_cas (map_t *map, void *key, uint64_t expected_val, uint64_t new_val);
15 uint64_t map_replace (map_t *map, void *key, uint64_t new_val);
16 uint64_t map_remove (map_t *map, void *key);
17 uint64_t map_count (map_t *map);
18 void map_print (map_t *map);
19 void map_free (map_t *map);
21 map_iter_t * map_iter_begin (map_t *map, void *key);
22 uint64_t map_iter_next (map_iter_t *iter, void **key);
23 void map_iter_free (map_iter_t *iter);
25 /////////////////////////////////////////////////////////////////////////////////////
27 #define CAS_EXPECT_DOES_NOT_EXIST ( 0)
28 #define CAS_EXPECT_EXISTS (-1)
29 #define CAS_EXPECT_WHATEVER (-2)
31 typedef void * (*map_alloc_t) (const datatype_t *);
32 typedef uint64_t (*map_cas_t) (map_impl_t *, void *, uint64_t, uint64_t);
33 typedef uint64_t (*map_get_t) (map_impl_t *, void *);
34 typedef uint64_t (*map_remove_t) (map_impl_t *, void *);
35 typedef uint64_t (*map_count_t) (map_impl_t *);
36 typedef void (*map_print_t) (map_impl_t *);
37 typedef void (*map_free_t) (map_impl_t *);
39 typedef map_iter_t * (*map_iter_begin_t) (map_impl_t *, void *);
40 typedef uint64_t (*map_iter_next_t) (map_iter_t *, void **);
41 typedef void (*map_iter_free_t) (map_iter_t *);
52 map_iter_begin_t iter_begin;
53 map_iter_next_t iter_next;
54 map_iter_free_t iter_free;