Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tao / Messaging / AMI_Arguments_Converter_Impl.cpp
blob8b11fede503c6d2b22535fb31ca19b99cf7d324b
1 // -*- C++ -*-
2 #include "tao/Messaging/AMI_Arguments_Converter_Impl.h"
3 #include "tao/operation_details.h"
4 #include "tao/SystemException.h"
5 #include "tao/Pluggable_Messaging_Utils.h"
6 #include "tao/Reply_Dispatcher.h"
7 #include "tao/CDR.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 void
12 TAO_AMI_Arguments_Converter_Impl::convert_request (
13 TAO_ServerRequest & server_request,
14 TAO::Argument * const args[],
15 size_t nargs)
17 // The AMI requests on client side just has the in and inout arguments,
18 // Since the argument list in the client side is used by server side
19 // in collocation case and the server expects the full list of arguments
20 // and not just the inout arguments we need to expand the client arguments
21 // to be list of Arguments.
23 TAO_OutputCDR output;
24 this->dsi_convert_request (server_request, output);
26 TAO_InputCDR input (output);
27 errno = 0;
28 for (CORBA::ULong j = 1; j < nargs; ++j)
30 if (!(args[j]->demarshal (input)))
32 TAO_InputCDR::throw_skel_exception (errno);
36 TAO_Operation_Details* details
37 = const_cast <TAO_Operation_Details*> (server_request.operation_details ());
39 details->use_stub_args (false);
42 void
43 TAO_AMI_Arguments_Converter_Impl::dsi_convert_request (
44 TAO_ServerRequest & server_request,
45 TAO_OutputCDR & output)
47 // The AMI requests on client side just has the in and inout arguments
48 CORBA::ULong const nrarg = server_request.operation_details ()->args_num ();
50 for (CORBA::ULong i = 1; i < nrarg; ++i)
52 if (!(server_request.operation_details ()->args()[i])->marshal (output))
54 throw ::CORBA::BAD_PARAM ();
59 void
60 TAO_AMI_Arguments_Converter_Impl::convert_reply (
61 TAO_ServerRequest & server_request,
62 TAO::Argument * const args[],
63 size_t nargs)
65 if (server_request.operation_details ()->reply_dispatcher ())
67 TAO_OutputCDR output;
68 errno = 0;
69 for (CORBA::ULong j = 0; j < nargs; ++j)
71 if (!(args[j]->marshal (output)))
73 TAO_OutputCDR::throw_skel_exception (errno);
76 TAO_InputCDR input (output);
77 this->dsi_convert_reply (server_request, input);
81 void
82 TAO_AMI_Arguments_Converter_Impl::dsi_convert_reply (
83 TAO_ServerRequest & server_request,
84 TAO_InputCDR & input)
86 if (server_request.operation_details ()->reply_dispatcher ())
88 TAO_Pluggable_Reply_Params params (0);
89 params.reply_status (GIOP::NO_EXCEPTION);
90 params.input_cdr_ = &input;
91 server_request.operation_details ()->
92 reply_dispatcher ()->dispatch_reply (params);
96 void
97 TAO_AMI_Arguments_Converter_Impl::handle_corba_exception (
98 TAO_ServerRequest & server_request,
99 CORBA::Exception *exception)
101 TAO_OutputCDR output;
102 TAO_Pluggable_Reply_Params params (0);
103 exception->_tao_encode (output);
104 if (CORBA::SystemException::_downcast (exception) != 0)
106 params.reply_status (GIOP::SYSTEM_EXCEPTION);
108 else
110 params.reply_status (GIOP::USER_EXCEPTION);
112 TAO_InputCDR input (output);
113 params.input_cdr_ = &input;
114 server_request.operation_details ()->
115 reply_dispatcher ()->dispatch_reply (params);
118 // *********************************************************************
120 // Initialization and registration of dynamic service object.
123 TAO_AMI_Arguments_Converter_Impl::Initializer ()
125 return ACE_Service_Config::process_directive (
126 ace_svc_desc_TAO_AMI_Arguments_Converter_Impl);
130 ACE_STATIC_SVC_DEFINE (
131 TAO_AMI_Arguments_Converter_Impl,
132 ACE_TEXT ("AMI_Arguments_Converter"),
133 ACE_SVC_OBJ_T,
134 &ACE_SVC_NAME (TAO_AMI_Arguments_Converter_Impl),
135 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
139 ACE_FACTORY_DEFINE (TAO_Messaging, TAO_AMI_Arguments_Converter_Impl)
141 TAO_END_VERSIONED_NAMESPACE_DECL