00001 // -*- C++ -*- 00002 // 00003 // $Id: Hashable.inl,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $ 00004 00005 00006 ACE_INLINE 00007 ACE_Hashable::ACE_Hashable (void) 00008 : hash_value_ (0) 00009 { 00010 } 00011 00012 ACE_INLINE 00013 ACE_Hashable::~ACE_Hashable (void) 00014 { 00015 } 00016 00017 ACE_INLINE unsigned long 00018 ACE_Hashable::hash (void) const 00019 { 00020 // In doing the check below, we take chance of paying a performance 00021 // price when the hash value is zero. But, that will (hopefully) 00022 // happen far less often than a non-zero value, so this caching 00023 // strategy should pay off, esp. if hash computation is expensive 00024 // relative to the simple comparison. 00025 00026 if (this->hash_value_ == 0) 00027 ((ACE_Hashable *) this)->hash_value_ = this->hash_i (); 00028 00029 return this->hash_value_; 00030 }
1.2.14 written by Dimitri van Heesch,
© 1997-2002