summaryrefslogtreecommitdiff
path: root/TAO/tao/Remote_Object_Proxy_Broker.cpp
blob: 0cb98e0f718e5bbca4f7852e301bb60470bdb62c (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
#include "Remote_Object_Proxy_Broker.h"
#include "UB_String_Arguments.h"
#include "Special_Basic_Arguments.h"
#include "Invocation_Adapter.h"
#include "IFR_Client_Adapter.h"
#include "ORB_Core.h"
#include "SystemException.h"

#include "ace/Dynamic_Service.h"

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

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);
  }

#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;
}