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"
9 #include "tao/Invocation_Adapter.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_IFR_Client_Adapter_Impl::~TAO_IFR_Client_Adapter_Impl ()
19 TAO_IFR_Client_Adapter_Impl::interfacedef_cdr_insert (
21 CORBA::InterfaceDef_ptr object_type
)
23 return cdr
<< object_type
;
27 TAO_IFR_Client_Adapter_Impl::interfacedef_any_insert (
29 CORBA::InterfaceDef_ptr object_type
)
31 (*any
) <<= object_type
;
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 (
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 ();
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
[] =
85 TAO::Invocation_Adapter
_tao_call (
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)
107 TAO_IFR_Client_Adapter_Impl::create_operation_list (
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
)
124 TAO::Unknown_IDL_Type
*unk
= 0;
126 TAO::Unknown_IDL_Type (params
[i
].type
.in ()));
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
;
136 case CORBA::PARAM_OUT
:
137 flags
= CORBA::ARG_OUT
;
139 case CORBA::PARAM_INOUT
:
140 flags
= CORBA::ARG_INOUT
;
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"),
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