]> pd.if.org Git - nbds/blob - map/mlocal.h
refactor header files
[nbds] / map / mlocal.h
1 #ifndef MLOCAL_H
2 #define MLOCAL_H
3
4 #include "datatype.h"
5
6 #define CAS_EXPECT_DOES_NOT_EXIST ( 0)
7 #define CAS_EXPECT_EXISTS         (-1)
8 #define CAS_EXPECT_WHATEVER       (-2)
9
10 typedef void *   (*map_alloc_t)  (const datatype_t *);
11 typedef uint64_t (*map_cas_t)    (void *, void *, uint64_t, uint64_t);
12 typedef uint64_t (*map_get_t)    (void *, void *);
13 typedef uint64_t (*map_remove_t) (void *, void *);
14 typedef uint64_t (*map_count_t)  (void *);
15 typedef void     (*map_print_t)  (void *);
16 typedef void     (*map_free_t)   (void *);
17
18 typedef struct map_impl {
19     map_alloc_t  alloc;
20     map_cas_t    cas;
21     map_get_t    get;
22     map_remove_t remove;
23     map_count_t  count;
24     map_print_t  print;
25     map_free_t   free_;
26 } map_impl_t;
27
28 #endif//MLOCAL_H