e4cba2d93d7f3344497491159990d00b4f209473
[nbds] / include / list.h
1 #ifndef LIST_H
2 #define LIST_H
3
4 #include "map.h"
5
6 typedef struct ll list_t;
7 typedef struct ll_iter ll_iter_t;
8
9 list_t * ll_alloc   (const datatype_t *key_type);
10 uint64_t ll_cas     (list_t *ll, void *key, uint64_t expected_val, uint64_t new_val);
11 uint64_t ll_lookup  (list_t *ll, void *key);
12 uint64_t ll_remove  (list_t *ll, void *key);
13 uint64_t ll_count   (list_t *ll);
14 void     ll_print   (list_t *ll);
15 void     ll_free    (list_t *ll);
16 void *   ll_min_key (list_t *sl);
17
18 ll_iter_t *ll_iter_start (list_t *ll, void *key);
19 ll_iter_t *ll_iter_next  (ll_iter_t *iter);
20 uint64_t   ll_iter_val   (ll_iter_t *iter);
21 void *     ll_iter_key   (ll_iter_t *iter);
22
23 static const map_impl_t ll_map_impl = { 
24     (map_alloc_t)ll_alloc, (map_cas_t)ll_cas, (map_get_t)ll_lookup, (map_remove_t)ll_remove, 
25     (map_count_t)ll_count, (map_print_t)ll_print, (map_free_t)ll_free
26 };
27
28 #endif//LIST_H