]> pd.if.org Git - nbds/blobdiff - include/map.h
all structures are parameterized by the datatype for the key
[nbds] / include / map.h
index 71d0ddee0b90e9c45547fb3576a1c58cb32736b3..42a5a1d2e8c2ebf1d2d196dc14506259e9aa466c 100644 (file)
@@ -1,19 +1,17 @@
 #ifndef MAP_H
 #define MAP_H
 
+#include "datatype.h"
+
 typedef struct map map_t;
 
 typedef const struct map_impl *map_type_t;
 
-typedef int      (*cmp_fun_t)   (void *, void *);
-typedef void *   (*clone_fun_t) (void *);
-typedef uint32_t (*hash_fun_t)  (void *);
-
 extern map_type_t MAP_TYPE_HASHTABLE;
 extern map_type_t MAP_TYPE_SKIPLIST;
 extern map_type_t MAP_TYPE_LIST;
 
-map_t *  map_alloc  (map_type_t map_type, cmp_fun_t cmp_fun, hash_fun_t hash_fun, clone_fun_t clone_fun);
+map_t *  map_alloc  (map_type_t map_type, const datatype_t *key_type);
 uint64_t map_get    (map_t *map, void *key);
 uint64_t map_set    (map_t *map, void *key, uint64_t new_val);
 uint64_t map_add    (map_t *map, void *key, uint64_t new_val);