36 #ifndef __EST_THASH_H__ 
   37 #define __EST_THASH_H__ 
   43 #include "EST_String.h" 
   44 #include "EST_system.h" 
   46 #include "EST_TIterator.h" 
   48 #include "instantiate/EST_THashI.h" 
   49 #include "instantiate/EST_TStringHashI.h" 
   63   static unsigned int DefaultHash(
const void *data, 
size_t size, 
unsigned int n);
 
   66   static  unsigned int StringHash(
const EST_String &key, 
unsigned int size);
 
   74 template<
class K, 
class V>
 
   95 template<
class K, 
class V>
 
  100   static V Dummy_Value;
 
  104   unsigned int p_num_entries;
 
  107   unsigned int p_num_buckets;
 
  113   unsigned int (*p_hash_function)(
const K &key, 
unsigned int size);
 
  120         unsigned int (*hash_function)(
const K &key, 
unsigned int size)= NULL);
 
  132   unsigned int num_entries(
void)
 const  
  133     { 
return p_num_entries; };
 
  136   int present(
const K &key) 
const;
 
  141   V &val(
const K &key, 
int &found) 
const;
 
  144   V &
val(
const K &key)
 const {
int x; 
return val(key, x); }
 
  146   const K &key(
const V &val, 
int &found) 
const;
 
  147   const K &key(
const V &val)
 const {
int x; 
return key(val, x); }
 
  153   void map(
void (*func)(K&, V&));
 
  156   int add_item(
const K &key, 
const V &value, 
int no_search = 0);
 
  159   int remove_item(
const K &rkey, 
int quiet = 0);
 
  165   void dump(ostream &stream, 
int all=0);
 
  182   void skip_blank(IPointer &ip)
 const  
  184       while (ip.p==NULL && ip.b<p_num_buckets)
 
  185     {ip.b++; ip.p = ip.b<p_num_buckets?p_buckets[ip.b]:0; } 
 
  189   void point_to_first(IPointer &ip)
 const  
  190     { ip.b=0; ip.p = ip.b<p_num_buckets?p_buckets[ip.b]:0; 
 
  194   void move_pointer_forwards(IPointer &ip)
 const  
  235   void skip_blank(IPointer_k &ip)
 const  
  237       while (ip.p==NULL && ip.b<p_num_buckets)
 
  238     {ip.b++; ip.p = ip.b<p_num_buckets?p_buckets[ip.b]:0; } 
 
  242   void point_to_first(IPointer_k &ip)
 const  
  243     { ip.b=0; ip.p = ip.b<p_num_buckets?p_buckets[ip.b]:0; 
 
  247   void move_pointer_forwards(IPointer_k &ip)
 const  
  257   K &
points_at(
const IPointer_k &ip) { 
return (ip.p)->k; }
 
  323 inline static unsigned int DefaultHashFunction(
const void *data, 
size_t size, 
unsigned int n)
 
  326   const char *p = (
const char *)data;
 
  327   for(; size>0 ; p++, size--)