summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Replica_Hash.inl
blob: dedec714bf53e0edc758aa5655e9095274d0fb76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// -*- C++ -*-
//
// $Id$

ACE_INLINE CORBA::ULong
TAO_LB_Replica_Hash::operator() (
  const CORBA::Object_ptr &replica) const
{
  CORBA::ULong max = 4294967295UL;  // Maximum 32-bit unsigned integer
  return replica->_hash (max);
}

ACE_INLINE CORBA::ULong
TAO_LB_Location_Hash::operator() (
  const TAO_LoadBalancing::Location &location) const
{
  CORBA::ULong hash = 0;

  size_t location_length = location.length ();

  for (size_t i = 0; i < location_length; ++i)
    hash += (ACE::hash_pjw (location[i].id)
             ACE::hash_pjw (location[i].kind));

  return hash;
}