summaryrefslogtreecommitdiff
path: root/ace/Strategies.i
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-30 06:52:10 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-30 06:52:10 +0000
commit674cbe19e688fe5139296320514c96c2ec14f658 (patch)
treec09e4d5d602a2027199825e055d6e27c99acf6f3 /ace/Strategies.i
parent3e14ff8ac10b468d0db9e3aeb911194d994a4f26 (diff)
downloadATCD-674cbe19e688fe5139296320514c96c2ec14f658.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/Strategies.i')
-rw-r--r--ace/Strategies.i16
1 files changed, 16 insertions, 0 deletions
diff --git a/ace/Strategies.i b/ace/Strategies.i
index a0ef94ea2da..2d101275030 100644
--- a/ace/Strategies.i
+++ b/ace/Strategies.i
@@ -38,6 +38,7 @@ ACE_Recyclable::state (ACE_Recyclable::State new_state)
ACE_INLINE
ACE_Hashable::ACE_Hashable (void)
+ : hash_value_ (0)
{
}
@@ -46,6 +47,21 @@ ACE_Hashable::~ACE_Hashable (void)
{
}
+ACE_INLINE u_long
+ACE_Hashable::hash (void) const
+{
+ // In doing the check below, we take chance of paying a performance
+ // price when the hash value is zero. But, that will (hopefully)
+ // happen far less often than a non-zero value, so this caching
+ // strategy should pay off, esp. if hash computation is expensive
+ // relative to the simple comparison.
+
+ if (this->hash_value_ == 0)
+ ((ACE_Hashable *) this)->hash_value_ = this->hash_i ();
+
+ return this->hash_value_;
+}
+
ACE_INLINE
ACE_Refcountable::ACE_Refcountable (int refcount)
: refcount_ (refcount)