Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hashmap.h

00001 #ifndef HASHMAP_H
00002 #define HASHMAP_H
00003 
00004 /*
00005   Written from scratch 2001-08-02 sandro@w3.org.
00006   W3C license
00007 */
00008 
00009 #include "iter.h"
00010 
00026 struct hashmap_entry {
00027     struct hashmap_entry *next_in_bucket;
00028     void *value;
00029 };
00030 
00031 struct hashmap {
00032     struct hashmap_entry **table;
00033     unsigned used_slots;
00034     short table_size_index;  /* 0 is the smallest table, 1 is step larger... */
00035 };
00036 
00037 typedef struct hashmap Hashmap;
00038 
00042 void hashmap_open(Hashmap*, unsigned int initial_size);
00043 
00047 void hashmap_close(Hashmap*);
00048 
00058 void* hashmap_get(Hashmap*, void *key, void *key_end);
00059 
00067 void hashmap_put(Hashmap*, void *key, void *key_end, 
00068           void *data, void *data_end);
00069 
00079 void* hashmap_get_or_put(Hashmap*, 
00080                 void *key, void *key_end, 
00081                 void *data, void *data_end);
00082 
00091 int hashmap_remove(Hashmap*, void *key, void *key_end);
00092 
00104 void* hashmap_iterate(Hashmap*, iter* i, void** value);
00105 
00106 #endif
00107 

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.