--- parser3/src/include/pa_hash.h 2001/01/27 10:02:59 1.1 +++ parser3/src/include/pa_hash.h 2001/01/27 15:00:04 1.3 @@ -1,5 +1,5 @@ /* - $Id: pa_hash.h,v 1.1 2001/01/27 10:02:59 paf Exp $ + $Id: pa_hash.h,v 1.3 2001/01/27 15:00:04 paf Exp $ */ /* @@ -17,16 +17,16 @@ class Pool; -typedef String Key; -typedef void Value; - class Hash { public: + typedef String Key; + typedef void Value; + private: friend Pool; - // expand when there would be used this %% of size + // expand when used these %% of size enum { THRESHOLD_PERCENT=75 }; @@ -52,19 +52,24 @@ private: // main storage class Pair { + friend Hash; + uint code; Key key; Value *value; Pair *link; - Pair(uint acode, Key& akey, Value *avalue) : + + void *operator new(size_t size, Pool *apool); + + Pair(uint acode, Key& akey, Value *avalue, Pair *alink) : code(acode), key(akey), value(avalue), - link(0) {} - } **pair_refs; + link(alink) {} + } **refs; // new&constructors made private to enforce factory manufacturing at pool - static void *operator new(size_t size, Pool *apool); + void *operator new(size_t size, Pool *apool); Hash(Pool *apool); @@ -75,7 +80,6 @@ private: public: - Hash() { /* never */ } static uint generic_code(uint aresult, char *start, uint size); void put(Key& key, Value *value); Value* get(Key& key);