cctools
hash_table.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef HASH_TABLE_H
9 #define HASH_TABLE_H
10 
42 typedef unsigned (*hash_func_t) (const char *key);
43 
50 struct hash_table *hash_table_create(int buckets, hash_func_t func);
51 
57 void hash_table_delete(struct hash_table *h);
58 
64 int hash_table_size(struct hash_table *h);
65 
76 int hash_table_insert(struct hash_table *h, const char *key, const void *value);
77 
84 void *hash_table_lookup(struct hash_table *h, const char *key);
85 
92 void *hash_table_remove(struct hash_table *h, const char *key);
93 
101 void hash_table_firstkey(struct hash_table *h);
102 
111 int hash_table_nextkey(struct hash_table *h, char **key, void **value);
112 
118 unsigned hash_string(const char *s);
119 
120 #endif