Merge pull request #2218 from jwillemsen/jwi-pthreadsigmask
[ACE_TAO.git] / TAO / tao / Strategies / UIOP_Endpoint.cpp
blobfff5aa8b3a7c8a903440aff1512d97e9436b61af
1 #include "tao/Strategies/UIOP_Endpoint.h"
2 #include "tao/Strategies/UIOP_Connection_Handler.h"
3 #include "tao/ORB_Constants.h"
4 #include "ace/OS_NS_string.h"
6 #if TAO_HAS_UIOP == 1
8 #if !defined (__ACE_INLINE__)
9 # include "tao/Strategies/UIOP_Endpoint.inl"
10 #endif /* __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_UIOP_Endpoint::TAO_UIOP_Endpoint (const ACE_UNIX_Addr &addr,
15 CORBA::Short priority)
16 : TAO_Endpoint (TAO_TAG_UIOP_PROFILE, priority)
17 , object_addr_ (addr)
18 , next_ (0)
22 TAO_UIOP_Endpoint::TAO_UIOP_Endpoint ()
23 : TAO_Endpoint (TAO_TAG_UIOP_PROFILE)
24 , object_addr_ ()
25 , next_ (0)
29 int
30 TAO_UIOP_Endpoint::addr_to_string (char *buffer, size_t length)
32 if (length < (ACE_OS::strlen (this->rendezvous_point ()) + 1))
33 return -1;
35 ACE_OS::strcpy (buffer, this->rendezvous_point ());
37 return 0;
40 TAO_Endpoint *
41 TAO_UIOP_Endpoint::next ()
43 return this->next_;
46 TAO_Endpoint *
47 TAO_UIOP_Endpoint::duplicate ()
49 TAO_UIOP_Endpoint *endpoint = 0;
50 ACE_NEW_RETURN (endpoint,
51 TAO_UIOP_Endpoint (this->object_addr_,
52 this->priority ()),
53 0);
55 return endpoint;
58 CORBA::Boolean
59 TAO_UIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
61 TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
63 TAO_UIOP_Endpoint *endpoint = dynamic_cast<TAO_UIOP_Endpoint *> (endpt);
65 if (endpoint == 0)
66 return 0;
68 return ACE_OS::strcmp (this->rendezvous_point (),
69 endpoint->rendezvous_point ()) == 0;
72 CORBA::ULong
73 TAO_UIOP_Endpoint::hash ()
75 if (this->hash_val_ != 0)
76 return this->hash_val_;
79 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
80 guard,
81 this->addr_lookup_lock_,
82 this->hash_val_);
83 // .. DCL
84 if (this->hash_val_ != 0)
85 return this->hash_val_;
87 this->hash_val_ =
88 ACE::hash_pjw (this->rendezvous_point ());
91 return this->hash_val_;
94 TAO_END_VERSIONED_NAMESPACE_DECL
96 #endif /* TAO_HAS_UIOP == 1 */