summaryrefslogtreecommitdiff
path: root/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h
blob: c2a786ea503e3c29832f08e536cb6c8249e13a81 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// -*- C++ -*-
//=============================================================================
/**
 *  @file     IIOPEndpointValue_i.h
 *
 *  Implementation of the IIOP-Specific endpoint policy value
 *
 *  @author  Phil Mesnier <mesnier_p@ociweb.com>
 */
//=============================================================================

#ifndef _TAO_IIOP_ENDPOINT_VALUE_I_H_
#define _TAO_IIOP_ENDPOINT_VALUE_I_H_

#include /**/ "ace/pre.h"

#include "tao/EndpointPolicy/EndpointPolicy_Export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/orbconf.h"

#if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)

#include "tao/EndpointPolicy/IIOPEndpointValueC.h"
#include "tao/EndpointPolicy/Endpoint_Value_Impl.h"
#include "tao/LocalObject.h"
#include "ace/INET_Addr.h"

// This is to remove "inherits via dominance" warnings from MSVC.
// MSVC is being a little too paranoid.
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif /* _MSC_VER */


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class IIOPEndpointValue_i
 *
 * @brief Implementation of the IIOP-Specific endpoint policy value
 *
 * This class is used by applications to create an instance of an
 * endpoint value for constructing an EndpointPolicy. While the
 * endpoint policy argument is of type
 * EndpointPolicy::EndpointValueBase, always use instances of this
 * type so that the endpoint policy framework is able to call the
 * equivalency test method.
 */

class TAO_EndpointPolicy_Export  IIOPEndpointValue_i :
  public virtual EndpointPolicy::IIOPEndpointValue,
  public virtual TAO_Endpoint_Value_Impl,
  public virtual ::CORBA::LocalObject
{
public:

  /// Default Constructor. It is acceptable to create an empty value
  /// and modify the state via the attributes.
  IIOPEndpointValue_i ();

  /// Value initializing constructor, this is typically for creation
  /// of one-off values.
  IIOPEndpointValue_i (const char *host, CORBA::UShort port);

  virtual ~IIOPEndpointValue_i (void);

  /// The is_equivalent test is used by the endpoint policy framework
  /// for testing if a target endpoint is the same as the endpoint
  /// defined by this value.
  CORBA::Boolean is_equivalent (const TAO_Endpoint * endpoint) const;

  /// The validate_acceptor method is used during EndpointPolicy
  /// creation to ensure there is an acceptor which provides this
  /// endpoint. Currently the test is limited to only validating that
  /// the acceptor's tag is consistent, as the interfaces do not yet
  /// exist for examining the eventual TAO_Endpoint values the
  /// acceptor would produce.
  CORBA::Boolean validate_acceptor (TAO_Acceptor *,
                                    bool is_multi_prot) const;

  /// Host attribute get/set operators.
  char * host (void);
  void host (const char * h);

  /// Port attribute get/set operators.
  CORBA::UShort port (void);
  void port (CORBA::UShort p);

  // Protocol tag get operator, inherited from EndpointValueBase
  CORBA::ULong protocol_tag (void);

private:
  CORBA::Boolean is_equivalent_i (CORBA::UShort port, const char *host) const;

  CORBA::String_var host_;
  CORBA::UShort     port_;

  ACE_INET_Addr addr_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */

#endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */

#include /**/ "ace/post.h"

#endif /* _TAO_IIOP_ENDPOINT_VALUE_I_H_ */