00001 //$Id: Hashable.cpp 69051 2005-10-28 16:14:56Z ossama $ 00002 00003 #include "ace/Hashable.h" 00004 00005 #if !defined (__ACE_INLINE__) 00006 #include "ace/Hashable.inl" 00007 #endif /* __ACE_INLINE __ */ 00008 00009 00010 ACE_RCSID (ace, 00011 Hashable, 00012 "$Id: Hashable.cpp 69051 2005-10-28 16:14:56Z ossama $") 00013 00014 00015 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00016 00017 ACE_Hashable::~ACE_Hashable (void) 00018 { 00019 } 00020 00021 unsigned long 00022 ACE_Hashable::hash (void) const 00023 { 00024 // In doing the check below, we take chance of paying a performance 00025 // price when the hash value is zero. But, that will (hopefully) 00026 // happen far less often than a non-zero value, so this caching 00027 // strategy should pay off, esp. if hash computation is expensive 00028 // relative to the simple comparison. 00029 00030 if (this->hash_value_ == 0) 00031 this->hash_value_ = this->hash_i (); 00032 00033 return this->hash_value_; 00034 } 00035 00036 ACE_END_VERSIONED_NAMESPACE_DECL