cctools
hash_table.h
Go to the documentation of this file.
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_delete(struct hash_table *h);
00058 
00064 int hash_table_size(struct hash_table *h);
00065 
00076 int hash_table_insert(struct hash_table *h, const char *key, const void *value);
00077 
00084 void *hash_table_lookup(struct hash_table *h, const char *key);
00085 
00092 void *hash_table_remove(struct hash_table *h, const char *key);
00093 
00101 void hash_table_firstkey(struct hash_table *h);
00102 
00111 int hash_table_nextkey(struct hash_table *h, char **key, void **value);
00112 
00118 unsigned hash_string(const char *s);
00119 
00120 #endif