]>
git.datanom.net - hashtable.git/blob - hashtable.h
8 #define TABLESIZE (1<<20)
10 typedef uint64_t (*HashFunc
)(const void*);
11 typedef bool (*EqualFunc
)(const void*, const void*);
12 typedef void (*FreeFunc
)(void*);
13 typedef void (*PrintFunc
)(void*);
14 typedef struct _Hashtable Hashtable
;
15 typedef void (*ForeachFunc
)(void*, void*, void*);
17 typedef struct _HashtableIter
{
26 typedef struct _List
{
32 uint64_t int_hash(const void*);
33 uint64_t str_hash(const void*);
34 uint64_t ptr_hash(const void*);
35 bool int_equal(const void*, const void*);
36 bool str_equal(const void*, const void*);
37 bool ptr_equal(const void*, const void*);
39 Hashtable
* hash_table_create(HashFunc hf
, EqualFunc ef
);
40 Hashtable
* hash_table_create_notify(HashFunc hf
, EqualFunc ef
, FreeFunc ff
);
41 Hashtable
* hash_table_create_full(HashFunc hf
, EqualFunc ef
, uint32_t size
, FreeFunc ff
, PrintFunc pf
);
42 void hash_table_destroy(Hashtable
* ht
);
43 void hash_table_print(Hashtable
* ht
);
44 bool hash_table_insert(Hashtable
* ht
, const void* key
, void* obj
);
45 void* hash_table_lookup(Hashtable
* ht
, const void* key
);
46 void* hash_table_delete(Hashtable
* ht
, const void* key
);
47 List
* hash_table_keys(Hashtable
* ht
);
48 List
* hash_table_values(Hashtable
* ht
);
49 void hash_table_list_free(List
* list
);
50 void hash_table_foreach(Hashtable
* ht
, ForeachFunc
, void* userdata
);
51 void hash_table_iter_init(HashtableIter
* iter
, Hashtable
* ht
);
52 bool hash_table_iter_next(HashtableIter
* iter
, void** key
, void** value
);
53 bool hash_table_contains(Hashtable
* ht
, const void* key
);
54 uint64_t hash_table_size(Hashtable
* ht
);
55 bool hash_table_replace(Hashtable
* ht
, void* key
, void* value
);
56 void hash_table_set_print_func(Hashtable
* ht
, PrintFunc pf
);
This page took 0.060681 seconds and 6 git commands to generate.