Public Member Functions | Protected Member Functions | Protected Attributes

ACE_Hashable Class Reference

ACE_Hashable. More...

#include <Hashable.h>

Inheritance diagram for ACE_Hashable:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~ACE_Hashable (void)
 Destructor.
virtual unsigned long hash (void) const

Protected Member Functions

 ACE_Hashable (void)
 Protected constructor.
virtual unsigned long hash_i (void) const =0

Protected Attributes

unsigned long hash_value_
 Pre-computed hash-value.

Detailed Description

ACE_Hashable.

Definition at line 31 of file Hashable.h.


Constructor & Destructor Documentation

virtual ACE_Hashable::~ACE_Hashable ( void   )  [virtual]

Destructor.

ACE_Hashable::ACE_Hashable ( void   )  [inline, protected]

Protected constructor.

Definition at line 9 of file Hashable.inl.

  : hash_value_ (0)
{
}


Member Function Documentation

unsigned long ACE_Hashable::hash ( void   )  const [virtual]

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

Definition at line 22 of file Hashable.cpp.

{
  // 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)
    this->hash_value_ = this->hash_i ();

  return this->hash_value_;
}

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

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


Member Data Documentation

unsigned long ACE_Hashable::hash_value_ [mutable, protected]

Pre-computed hash-value.

Definition at line 53 of file Hashable.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines