Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Strategies / COIOP_Endpoint.cpp
blobc8ff7d3cbb921abba79cda013965525596741f1e
1 #include "tao/Strategies/COIOP_Endpoint.h"
3 #if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
5 #include "tao/Strategies/COIOP_Connection_Handler.h"
6 #include "tao/debug.h"
7 #include "tao/ORB_Constants.h"
9 #include "ace/OS_NS_stdio.h"
10 #include "ace/OS_NS_string.h"
12 #if !defined (__ACE_INLINE__)
13 # include "tao/Strategies/COIOP_Endpoint.inl"
14 #endif /* __ACE_INLINE__ */
16 #include "ace/os_include/os_netdb.h"
18 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
20 TAO_COIOP_Endpoint::TAO_COIOP_Endpoint (const ACE_Utils::UUID& uuid)
21 : TAO_Endpoint (TAO_TAG_COIOP_PROFILE)
22 , uuid_ (uuid)
23 , next_ (0)
27 TAO_COIOP_Endpoint::TAO_COIOP_Endpoint ()
28 : TAO_Endpoint (TAO_TAG_COIOP_PROFILE),
29 uuid_ (),
30 next_ (0)
34 int
35 TAO_COIOP_Endpoint::addr_to_string (char *buffer, size_t length)
37 const ACE_CString *str = uuid_.to_string ();
38 size_t const actual_len =
39 str->length ();
41 if (length < actual_len)
42 return -1;
44 ACE_OS::sprintf (buffer, "%s",
45 str->c_str());
47 return 0;
50 TAO_Endpoint *
51 TAO_COIOP_Endpoint::next ()
53 return 0;
56 TAO_Endpoint *
57 TAO_COIOP_Endpoint::duplicate ()
59 TAO_COIOP_Endpoint *endpoint = 0;
61 ACE_NEW_RETURN (endpoint,
62 TAO_COIOP_Endpoint (this->uuid_),
63 0);
65 return endpoint;
68 CORBA::Boolean
69 TAO_COIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
71 TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
73 TAO_COIOP_Endpoint *endpoint = dynamic_cast<TAO_COIOP_Endpoint *> (endpt);
74 if (endpoint == 0)
75 return false;
77 return (this->uuid_ == endpoint->uuid_);
80 CORBA::ULong
81 TAO_COIOP_Endpoint::hash ()
83 if (this->hash_val_ != 0)
84 return this->hash_val_;
87 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
88 guard,
89 this->addr_lookup_lock_,
90 this->hash_val_);
91 // .. DCL
92 if (this->hash_val_ != 0)
93 return this->hash_val_;
95 const ACE_CString *stringval = this->uuid_.to_string ();
96 this->hash_val_ =
97 stringval->hash ();
100 return this->hash_val_;
103 TAO_END_VERSIONED_NAMESPACE_DECL
105 #endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */