summaryrefslogtreecommitdiff
path: root/TAO/tao/Remote_Object_Proxy_Broker.cpp
blob: fd4bc75cde0aacd68ada140dd4b23804362a485f (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include "tao/Remote_Object_Proxy_Broker.h"
#include "tao/CORBA_String.h"
#include "tao/UB_String_Arguments.h"
#include "tao/Special_Basic_Arguments.h"
#include "tao/Invocation_Adapter.h"
#include "tao/IFR_Client_Adapter.h"
#include "tao/ORB_Core.h"
#include "tao/SystemException.h"

#include "ace/Dynamic_Service.h"

ACE_RCSID (tao,
           Remote_Object_Proxy_Broker,
           "$Id$")


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  CORBA::Boolean
  Remote_Object_Proxy_Broker::_is_a (CORBA::Object_ptr target,
                                     const char *type_id
                                     ACE_ENV_ARG_DECL)
  {
    TAO::Arg_Traits<ACE_InputCDR::to_boolean>::ret_val _tao_retval;
    TAO::Arg_Traits<char *>::in_arg_val _tao_id (type_id);

    TAO::Argument *_tao_signature [] =
      {
        &_tao_retval,
        &_tao_id
      };

    TAO::Invocation_Adapter tao_call (target,
                                      _tao_signature,
                                      2,
                                      "_is_a",
                                      5,
                                      0);

    tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (_tao_retval.excp ());

    return _tao_retval.retn ();
  }

#if (TAO_HAS_MINIMUM_CORBA == 0)

  CORBA::Boolean
  Remote_Object_Proxy_Broker::_non_existent (CORBA::Object_ptr target
                                             ACE_ENV_ARG_DECL)
  {
    TAO::Arg_Traits<ACE_InputCDR::to_boolean>::ret_val _tao_retval;

    TAO::Argument *_tao_signature [] =
      {
        &_tao_retval
      };

    TAO::Invocation_Adapter _tao_call (target,
                                       _tao_signature,
                                       1,
                                       "_non_existent",
                                       13,
                                       0);

    _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (_tao_retval.excp ());

    return _tao_retval.retn ();
  }

  CORBA::Object_ptr
  Remote_Object_Proxy_Broker::_get_component (CORBA::Object_ptr target
                                              ACE_ENV_ARG_DECL)
  {
    TAO::Arg_Traits<CORBA::Object>::ret_val _tao_retval;

    TAO::Argument *_tao_signature [] =
      {
        &_tao_retval
      };

    TAO::Invocation_Adapter _tao_call (target,
                                       _tao_signature,
                                       1,
                                       "_component",
                                       10,
                                       0);

    _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (_tao_retval.excp ());

    return _tao_retval.retn ();
  }

  CORBA::InterfaceDef_ptr
  Remote_Object_Proxy_Broker::_get_interface (CORBA::Object_ptr target
                                              ACE_ENV_ARG_DECL)
  {
    TAO_IFR_Client_Adapter *adapter =
      ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
        TAO_ORB_Core::ifr_client_adapter_name ()
      );

  if (adapter == 0)
    {
      ACE_THROW_RETURN (CORBA::INTF_REPOS (),
                        0);
    }

  return adapter->get_interface_remote (target
                                        ACE_ENV_ARG_PARAMETER);
  }

  char *
  Remote_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target
                                              ACE_ENV_ARG_DECL)
  {
    TAO::Arg_Traits< ::CORBA::Char *>::ret_val _tao_retval;

    TAO::Argument *_tao_signature [] =
      {
        &_tao_retval
      };

    TAO::Invocation_Adapter _tao_call (target,
                                       _tao_signature,
                                       1,
                                       "_repository_id",
                                       14,
                                       0);

    _tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);
    ACE_CHECK_RETURN (_tao_retval.excp ());

    return _tao_retval.retn ();
  }
#endif /* TAO_HAS_MINIMUM_CORBA == 0 */
}

// -----------------------------------------------------

TAO::Remote_Object_Proxy_Broker *
the_tao_remote_object_proxy_broker (void)
{
  static TAO::Remote_Object_Proxy_Broker the_broker;
  return &the_broker;
}

TAO_END_VERSIONED_NAMESPACE_DECL