UIOP_Endpoint.cpp

Go to the documentation of this file.
00001 #include "tao/Strategies/UIOP_Endpoint.h"
00002 #include "tao/Strategies/UIOP_Connection_Handler.h"
00003 
00004 #include "tao/ORB_Constants.h"
00005 
00006 #include "ace/OS_NS_string.h"
00007 
00008 
00009 #if TAO_HAS_UIOP == 1
00010 
00011 
00012 ACE_RCSID (Strategies,
00013            UIOP_Endpoint,
00014            "UIOP_Endpoint.cpp,v 1.11 2006/03/10 07:19:19 jtc Exp")
00015 
00016 
00017 #if !defined (__ACE_INLINE__)
00018 # include "tao/Strategies/UIOP_Endpoint.i"
00019 #endif /* __ACE_INLINE__ */
00020 
00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00022 
00023 TAO_UIOP_Endpoint::TAO_UIOP_Endpoint (const ACE_UNIX_Addr &addr,
00024                                       CORBA::Short priority)
00025   : TAO_Endpoint (TAO_TAG_UIOP_PROFILE, priority)
00026     , object_addr_ (addr)
00027     , next_ (0)
00028 {
00029 }
00030 
00031 TAO_UIOP_Endpoint::TAO_UIOP_Endpoint (void)
00032   : TAO_Endpoint (TAO_TAG_UIOP_PROFILE)
00033     , object_addr_ ()
00034     , next_ (0)
00035 {
00036 }
00037 
00038 TAO_UIOP_Endpoint::~TAO_UIOP_Endpoint (void)
00039 {
00040 }
00041 
00042 int
00043 TAO_UIOP_Endpoint::addr_to_string (char *buffer, size_t length)
00044 {
00045   if (length < (ACE_OS::strlen (this->rendezvous_point ()) + 1))
00046     return -1;
00047 
00048   ACE_OS::strcpy (buffer, this->rendezvous_point ());
00049 
00050   return 0;
00051 }
00052 
00053 TAO_Endpoint *
00054 TAO_UIOP_Endpoint::next (void)
00055 {
00056   return this->next_;
00057 }
00058 
00059 TAO_Endpoint *
00060 TAO_UIOP_Endpoint::duplicate (void)
00061 {
00062   TAO_UIOP_Endpoint *endpoint = 0;
00063   ACE_NEW_RETURN (endpoint,
00064                   TAO_UIOP_Endpoint (this->object_addr_,
00065                                      this->priority ()),
00066                   0);
00067 
00068   return endpoint;
00069 }
00070 
00071 CORBA::Boolean
00072 TAO_UIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
00073 {
00074   TAO_Endpoint *endpt = const_cast<TAO_Endpoint *> (other_endpoint);
00075 
00076   TAO_UIOP_Endpoint *endpoint = dynamic_cast<TAO_UIOP_Endpoint *> (endpt);
00077 
00078   if (endpoint == 0)
00079     return 0;
00080 
00081   return ACE_OS::strcmp (this->rendezvous_point (),
00082                          endpoint->rendezvous_point ()) == 0;
00083 }
00084 
00085 CORBA::ULong
00086 TAO_UIOP_Endpoint::hash (void)
00087 {
00088   if (this->hash_val_ != 0)
00089     return this->hash_val_;
00090 
00091   {
00092     ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00093                       guard,
00094                       this->addr_lookup_lock_,
00095                       this->hash_val_);
00096     // .. DCL
00097     if (this->hash_val_ != 0)
00098       return this->hash_val_;
00099 
00100     this->hash_val_ =
00101       ACE::hash_pjw (this->rendezvous_point ());
00102   }
00103 
00104   return this->hash_val_;
00105 }
00106 
00107 TAO_END_VERSIONED_NAMESPACE_DECL
00108 
00109 #endif  /* TAO_HAS_UIOP == 1 */

Generated on Thu Nov 9 13:39:31 2006 for TAO_Strategies by doxygen 1.3.6