42 #include "EST_THash.h"
44 template<
class K,
class V>
52 for(
int i=0; i<size;i++)
55 p_hash_function = hash_function;
58 template<
class K,
class V>
65 template<
class K,
class V>
68 if (p_buckets != NULL)
70 for(
unsigned int i=0; i<p_num_buckets;i++)
73 for(p=p_buckets[i]; p != NULL; p=n)
84 template<
class K,
class V>
95 template<
class K,
class V>
100 b = (*p_hash_function)(key, p_num_buckets);
102 b = DefaultHashFunction((
void *)&key,
sizeof(key), p_num_buckets);
106 for(p=p_buckets[b]; p!=NULL; p=p->next)
113 template<
class K,
class V>
118 b = (*p_hash_function)(key, p_num_buckets);
120 b = DefaultHashFunction((
void *)&key,
sizeof(key), p_num_buckets);
124 for(p=p_buckets[b]; p!=NULL; p=p->next)
135 template<
class K,
class V>
139 for(
unsigned int b=0; b<p_num_buckets; b++)
142 for(p=p_buckets[b]; p!=NULL; p=p->next)
153 template<
class K,
class V>
156 for(
unsigned int i=0; i<p_num_buckets; i++)
160 for(p=p_buckets[i]; p!=NULL; p=p->next)
166 template<
class K,
class V>
171 b = (*p_hash_function)(key, p_num_buckets);
173 b = DefaultHashFunction((
void *)&key,
sizeof(key), p_num_buckets);
178 for(p=p_buckets[b]; p!=NULL; p=p->next)
188 p->next = p_buckets[b];
194 template<
class K,
class V>
199 b = (*p_hash_function)(rkey, p_num_buckets);
201 b = DefaultHashFunction((
void *)&rkey,
sizeof(rkey), p_num_buckets);
205 for (p = &(p_buckets[b]); *p!=NULL; p=&((*p)->next))
206 if ( (*p)->k == rkey )
216 cerr <<
"THash: no item labelled \"" << rkey <<
"\"" << endl;
220 template<
class K,
class V>
227 template<
class K,
class V>
230 for(
unsigned int i=0; i<p_num_buckets; i++)
231 if (all || p_buckets[i])
235 for(p=p_buckets[i]; p!=NULL; p=p->next)
236 stream <<
"[" << p->
k <<
"],(" << p->
v <<
") ";
241 template<
class K,
class V>
245 p_num_entries = from.p_num_entries;
246 p_num_buckets = from.p_num_buckets;
247 p_hash_function = from.p_hash_function;
249 if (p_buckets != NULL)
255 for(
unsigned int b=0; b<p_num_buckets; b++)
261 n->next = p_buckets[b];