00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __LWES_HASH_H
00021 #define __LWES_HASH_H
00022
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00038 struct lwes_hash
00039 {
00040 void **bins;
00041 int total_bins;
00042 int assigned_entries;
00043 };
00044
00045 struct lwes_hash_element
00046 {
00047 char * key;
00048 void * value;
00049 struct lwes_hash_element *next;
00050 };
00051
00056 struct lwes_hash_enumeration
00057 {
00058 int index;
00059 int elements_given;
00060 int size_at_start;
00061
00062 struct lwes_hash *enum_hash;
00063 struct lwes_hash_element *current;
00064 };
00065
00073 struct lwes_hash *
00074 lwes_hash_create
00075 (void);
00076
00077 struct lwes_hash *
00078 lwes_hash_create_with_bins
00079 (int total_bins);
00080
00081 int
00082 lwes_hash_destroy
00083 (struct lwes_hash* hash);
00084
00085 int
00086 lwes_hash_is_empty
00087 (struct lwes_hash* hash);
00088
00089 int
00090 lwes_hash_size
00091 (struct lwes_hash* hash);
00092
00093 int
00094 lwes_hash_rehash
00095 (struct lwes_hash* hash);
00096
00097 int
00098 lwes_hash_put
00099 (struct lwes_hash* hash,
00100 char *key,
00101 void *value);
00102
00103 void *
00104 lwes_hash_get
00105 (struct lwes_hash* hash,
00106 const char *key);
00107
00108 void *
00109 lwes_hash_remove
00110 (struct lwes_hash* hash,
00111 const char *key);
00112
00113 int
00114 lwes_hash_contains_key
00115 (struct lwes_hash* hash,
00116 const char *key);
00117
00118 int
00119 lwes_hash_keys
00120 (struct lwes_hash * hash,
00121 struct lwes_hash_enumeration *enumeration);
00122
00123 int
00124 lwes_hash_enumeration_has_more_elements
00125 (struct lwes_hash_enumeration *enumeration);
00126
00127 char *
00128 lwes_hash_enumeration_next_element
00129 (struct lwes_hash_enumeration *enumeration);
00130
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134
00135 #endif