Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Hashable Class Reference

ACE_Hashable. More...

#include <Hashable.h>

Inheritance diagram for ACE_Hashable:

Inheritance graph
[legend]
List of all members.

Public Methods

virtual ~ACE_Hashable (void)
 Destructor. More...

virtual unsigned long hash (void) const
 Computes and returns hash value. This "caches" the hash value to improve performance. More...


Protected Methods

 ACE_Hashable (void)
 Protected constructor. More...

virtual unsigned long hash_i (void) const=0
 This is the method that actually performs the non-cached hash computation. More...


Protected Attributes

unsigned long hash_value_
 Pre-computed hash-value. More...


Detailed Description

ACE_Hashable.

Definition at line 30 of file Hashable.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_Hashable::~ACE_Hashable void    [virtual]
 

Destructor.

Definition at line 13 of file Hashable.inl.

00014 {
00015 }

ACE_INLINE ACE_Hashable::ACE_Hashable void    [protected]
 

Protected constructor.

Definition at line 7 of file Hashable.inl.

00008   : hash_value_ (0)
00009 {
00010 }


Member Function Documentation

ACE_INLINE unsigned long ACE_Hashable::hash void    const [virtual]
 

Computes and returns hash value. This "caches" the hash value to improve performance.

Definition at line 18 of file Hashable.inl.

References hash_i, and hash_value_.

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 }

virtual unsigned long ACE_Hashable::hash_i void    const [protected, pure virtual]
 

This is the method that actually performs the non-cached hash computation.

Implemented in ACE_Refcounted_Hash_Recyclable.

Referenced by hash.


Member Data Documentation

unsigned long ACE_Hashable::hash_value_ [protected]
 

Pre-computed hash-value.

Definition at line 52 of file Hashable.h.

Referenced by hash.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:48:57 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002