Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / Strategies / SCIOP_Endpoint.h
blob0ea264db14b8488e8032cf0a69d90f3597082ae5
1 // -*- C++ -*-
3 //===========================================================================
4 /**
5 * @file SCIOP_Endpoint.h
7 * SCIOP implementation of PP Framework Endpoint interface.
9 * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
10 * @author Keith O'Hara, Lockheed Martin ATL
12 //==========================================================================
15 #ifndef TAO_SCIOP_ENDPOINT_H
16 #define TAO_SCIOP_ENDPOINT_H
18 #include /**/ "ace/pre.h"
20 #include "tao/orbconf.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 # pragma once
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 #if TAO_HAS_SCIOP == 1
27 #include "tao/Endpoint.h"
28 #include "tao/Strategies/strategies_export.h"
29 #include "tao/CORBA_String.h"
30 #include "ace/INET_Addr.h"
31 #include "tao/IIOP_EndpointsC.h"
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 class TAO_SCIOP_Connection_Handler;
37 /**
38 * @class TAO_SCIOP_Endpoint
40 * @brief TAO_SCIOP_Endpoint
42 * SCIOP-specific implementation of PP Framework Endpoint interface.
44 class TAO_Strategies_Export TAO_SCIOP_Endpoint : public TAO_Endpoint
46 public:
47 // @todo Lose these friends!
48 friend class TAO_SCIOP_Profile;
49 friend class TAO_SSLIOP_Profile;
51 /// Default constructor.
52 TAO_SCIOP_Endpoint ();
54 /// Constructor. This is the most efficient constructor since it
55 /// does not require any address resolution processing.
56 TAO_SCIOP_Endpoint (const char *host,
57 CORBA::UShort port,
58 const ACE_INET_Addr &addr,
59 CORBA::Short priority = TAO_INVALID_PRIORITY);
61 /// Constructor.
62 TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
63 int use_dotted_decimal_addresses);
65 /// Constructor. This constructor is used when decoding endpoints.
66 TAO_SCIOP_Endpoint (const char *host,
67 CORBA::UShort port,
68 CORBA::Short priority);
70 /// Destructor.
71 ~TAO_SCIOP_Endpoint () = default;
73 // = Implementation of abstract TAO_Endpoint methods. See
74 // Endpoint.h for their documentation.
76 virtual TAO_Endpoint *next ();
77 virtual int addr_to_string (char *buffer, size_t length);
78 virtual TAO_Endpoint *duplicate ();
80 /// Return true if this endpoint is equivalent to @a other_endpoint. Two
81 /// endpoints are equivalent if their port and host are the same.
82 virtual CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
84 /// Return a hash value for this object.
85 virtual CORBA::ULong hash ();
87 // = SCIOP_Endpoint-specific methods.
89 /// Return a reference to the <object_addr>.
90 const ACE_INET_Addr &object_addr () const;
92 /// Return a pointer to the host string. This object maintains
93 /// ownership of this string.
94 const char *host () const;
96 /// Copy the string @a h into <host_> and return the resulting pointer.
97 /// This object maintains ownership of this string.
98 const char *host (const char *h);
100 /// Return the port number.
101 CORBA::UShort port () const;
103 /// Set the port number.
104 CORBA::UShort port (CORBA::UShort p);
106 /// Do we have a preferred local network for the target?
107 bool is_preferred_network () const;
109 /// Return the preferred network if any.
110 const char *preferred_network () const;
112 private:
113 /// Helper method for setting INET_Addr.
114 int set (const ACE_INET_Addr &addr,
115 int use_dotted_decimal_addresses);
117 /// Helper method for object_addr ().
118 void object_addr_i () const;
120 /// Generate preferred interfaces from the options passed in by the
121 /// user.
122 CORBA::ULong preferred_interfaces (TAO_ORB_Core *oc);
124 /// Canonical copy constructor
126 * In private section to prevent clients from invoking this
127 * accidentally. Clients should only use duplicate () to make a deep
128 * copy
130 TAO_SCIOP_Endpoint (const TAO_SCIOP_Endpoint &);
133 /// String representing the host name.
134 CORBA::String_var host_;
136 /// TCP port number.
137 CORBA::UShort port_;
139 /// Cached instance of <ACE_INET_Addr> for use in making
140 /// invocations, etc.
141 mutable ACE_INET_Addr object_addr_;
143 /// Flag to indicate if the address has been resolved and set.
144 mutable int object_addr_set_;
146 /// Preferred path for this endpoint.
147 TAO::IIOP_Endpoint_Info preferred_path_;
149 /// Is this endpoint created encodable as part of the IOR?
150 bool is_encodable_;
152 /// SCIOP Endpoints can be strung into a list. Return the next
153 /// endpoint in the list, if any.
154 TAO_SCIOP_Endpoint *next_;
157 TAO_END_VERSIONED_NAMESPACE_DECL
159 #if defined (__ACE_INLINE__)
160 # include "tao/Strategies/SCIOP_Endpoint.inl"
161 #endif /* __ACE_INLINE__ */
163 #endif /* TAO_HAS_SCIOP == 1 */
165 #include /**/ "ace/post.h"
166 #endif /* TAO_SCIOP_PROFILE_H */