summaryrefslogtreecommitdiff
path: root/TAO/tao/Private_Connection_Descriptor.cpp
blob: ca7cf708ba62c3fe07d9bac01938f217ff124bca (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//$Id$

#include "tao/Private_Connection_Descriptor.h"

#if (TAO_HAS_RT_CORBA == 1)

#if !defined (__ACE_INLINE__)
# include "tao/Private_Connection_Descriptor.inl"
#endif /* __ACE_INLINE__ */

ACE_RCSID(tao, Private_Connection_Descriptor, "$Id$")


TAO_Private_Connection_Descriptor::~TAO_Private_Connection_Descriptor (void)
{
}


TAO_Connection_Descriptor_Interface *
TAO_Private_Connection_Descriptor::duplicate (void)
{
  // Get a copy of the underlying endpoint.
  TAO_Endpoint *endp = this->endpoint_->duplicate ();
  if (endp == 0)
    return 0;

  // Construct a copy of our class
  TAO_Private_Connection_Descriptor *desc = 0;
  ACE_NEW_RETURN (desc,
                  TAO_Private_Connection_Descriptor (endp,
                                                     this->object_id_,
                                                     1),
                  0);
  return desc;
}


CORBA::Boolean
TAO_Private_Connection_Descriptor::is_equivalent (
    const TAO_Connection_Descriptor_Interface *rhs)
{
  // Do away with const first.
  TAO_Connection_Descriptor_Interface *r =
    ACE_const_cast (TAO_Connection_Descriptor_Interface *,
                    rhs);

  TAO_Private_Connection_Descriptor *other_desc =
    ACE_dynamic_cast (TAO_Private_Connection_Descriptor *,
                      r);

  if (other_desc == 0)
    return 0;

  return (this->endpoint_->is_equivalent (other_desc->endpoint_)
          && this->object_id_ == other_desc->object_id_);
}


u_long
TAO_Private_Connection_Descriptor::hash (void) const
{
  return (this->endpoint_->hash () + this->object_id_);
}

#endif /* TAO_HAS_RT_CORBA == 1 */