00001 /* 00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin 00003 Copyright (C) 2005- The University of Notre Dame 00004 This software is distributed under the GNU General Public License. 00005 See the file COPYING for details. 00006 */ 00007 00008 #ifndef HASH_TABLE_H 00009 #define HASH_TABLE_H 00010 00042 typedef unsigned (*hash_func_t) (const char *key); 00043 00050 struct hash_table *hash_table_create(int buckets, hash_func_t func); 00051 00057 void hash_table_clear(struct hash_table *h); 00058 00059 00065 void hash_table_delete(struct hash_table *h); 00066 00072 int hash_table_size(struct hash_table *h); 00073 00084 int hash_table_insert(struct hash_table *h, const char *key, const void *value); 00085 00092 void *hash_table_lookup(struct hash_table *h, const char *key); 00093 00100 void *hash_table_remove(struct hash_table *h, const char *key); 00101 00109 void hash_table_firstkey(struct hash_table *h); 00110 00119 int hash_table_nextkey(struct hash_table *h, char **key, void **value); 00120 00126 unsigned hash_string(const char *s); 00127 00128 #endif