Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tao / IFR_Client / IFR_Client_Adapter_Impl.cpp
blobf4dafe938a265c4f979284bb721945abb6a5a778
1 #include "tao/IFR_Client/IFR_Client_Adapter_Impl.h"
2 #include "tao/IFR_Client/IFR_BasicC.h"
4 #include "tao/AnyTypeCode/NVList.h"
5 #include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
7 #include "tao/ORB_Core.h"
8 #include "tao/ORB.h"
9 #include "tao/Invocation_Adapter.h"
10 #include "tao/Stub.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_IFR_Client_Adapter_Impl::~TAO_IFR_Client_Adapter_Impl ()
18 CORBA::Boolean
19 TAO_IFR_Client_Adapter_Impl::interfacedef_cdr_insert (
20 TAO_OutputCDR &cdr,
21 CORBA::InterfaceDef_ptr object_type)
23 return cdr << object_type;
26 void
27 TAO_IFR_Client_Adapter_Impl::interfacedef_any_insert (
28 CORBA::Any *any,
29 CORBA::InterfaceDef_ptr object_type)
31 (*any) <<= object_type;
34 void
35 TAO_IFR_Client_Adapter_Impl::dispose (CORBA::InterfaceDef_ptr orphan)
37 ::CORBA::release (orphan);
40 CORBA::InterfaceDef_ptr
41 TAO_IFR_Client_Adapter_Impl::get_interface (
42 CORBA::ORB_ptr orb,
43 const char *repo_id)
45 CORBA::Object_var obj =
46 orb->resolve_initial_references ("InterfaceRepository");
48 if (CORBA::is_nil (obj.in ()))
50 throw ::CORBA::INTF_REPOS ();
53 CORBA::Repository_var repo =
54 CORBA::Repository::_narrow (obj.in ()
57 if (CORBA::is_nil (repo.in ()))
59 throw ::CORBA::INTF_REPOS ();
62 CORBA::Contained_var result = repo->lookup_id (repo_id);
64 if (CORBA::is_nil (result.in ()))
66 return CORBA::InterfaceDef::_nil ();
68 else
70 return CORBA::InterfaceDef::_narrow (result.in ());
74 CORBA::InterfaceDef_ptr
75 TAO_IFR_Client_Adapter_Impl::get_interface_remote (
76 CORBA::Object_ptr target)
78 TAO::Arg_Traits<CORBA::InterfaceDef>::ret_val _tao_retval;
80 TAO::Argument *_tao_signature [] =
82 &_tao_retval
85 TAO::Invocation_Adapter _tao_call (
86 target,
87 _tao_signature,
89 "_interface",
90 10,
91 0);
93 try
95 _tao_call.invoke (0, 0);
97 catch (const ::CORBA::OBJECT_NOT_EXIST&)
99 return CORBA::InterfaceDef::_nil ();
102 return _tao_retval.retn ();
105 #if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
106 void
107 TAO_IFR_Client_Adapter_Impl::create_operation_list (
108 CORBA::ORB_ptr orb,
109 CORBA::OperationDef_ptr opDef,
110 CORBA::NVList_ptr &result)
112 // Create an empty NVList.
113 orb->create_list (0, result);
115 // Get the parameters (if any) from the OperationDef, and for each
116 // parameter add a corresponding entry to the result.
117 CORBA::ParDescriptionSeq_var params = opDef->params ();
119 CORBA::ULong paramCount = params->length ();
121 for (CORBA::ULong i = 0; i < paramCount; ++i)
123 CORBA::Any value;
124 TAO::Unknown_IDL_Type *unk = 0;
125 ACE_NEW (unk,
126 TAO::Unknown_IDL_Type (params[i].type.in ()));
127 value.replace (unk);
129 // Convert the parameter mode to an arg mode
130 CORBA::Flags flags = 0;
131 switch(params[i].mode)
133 case CORBA::PARAM_IN:
134 flags = CORBA::ARG_IN;
135 break;
136 case CORBA::PARAM_OUT:
137 flags = CORBA::ARG_OUT;
138 break;
139 case CORBA::PARAM_INOUT:
140 flags = CORBA::ARG_INOUT;
141 break;
142 default:
143 // Shouldn't happen
144 throw ::CORBA::INTERNAL();
147 // Add an argument to the NVList.
148 result->add_value (params[i].name.in (), value, flags);
152 #endif /*TAO_HAS_MINIMUM_CORBA*/
153 // *********************************************************************
155 // Initialization and registration of dynamic service object.
158 TAO_IFR_Client_Adapter_Impl::Initializer ()
160 TAO_ORB_Core::ifr_client_adapter_name ("Concrete_IFR_Client_Adapter");
162 return ACE_Service_Config::process_directive (ace_svc_desc_TAO_IFR_Client_Adapter_Impl);
166 ACE_STATIC_SVC_DEFINE (
167 TAO_IFR_Client_Adapter_Impl,
168 ACE_TEXT ("Concrete_IFR_Client_Adapter"),
169 ACE_SVC_OBJ_T,
170 &ACE_SVC_NAME (TAO_IFR_Client_Adapter_Impl),
171 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
175 ACE_FACTORY_DEFINE (TAO_IFR_CLIENT, TAO_IFR_Client_Adapter_Impl)
176 TAO_END_VERSIONED_NAMESPACE_DECL