TAO_DII_Arguments_Converter_Impl Class Reference

TAO_DII_Arguments_Converter_Impl. More...

#include <DII_Arguments_Converter_Impl.h>

List of all members.

Public Member Functions

virtual void convert_request (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs)
virtual void dsi_convert_request (TAO_ServerRequest &server_request, TAO_OutputCDR &output)
virtual void convert_reply (TAO_ServerRequest &server_request, TAO::Argument *const args[], size_t nargs)
virtual void dsi_convert_reply (TAO_ServerRequest &server_request, TAO_InputCDR &input)
virtual void handle_corba_exception (TAO_ServerRequest &server_request, CORBA::Exception *exception)

Static Public Member Functions

static int Initializer (void)


Detailed Description

TAO_DII_Arguments_Converter_Impl.

This class provides the implementation to expand the DII arguments in NVList to the list of arguments.

Definition at line 40 of file DII_Arguments_Converter_Impl.h.


Member Function Documentation

void TAO_DII_Arguments_Converter_Impl::convert_reply ( TAO_ServerRequest server_request,
TAO::Argument *const   args[],
size_t  nargs 
) [virtual]

Definition at line 95 of file DII_Arguments_Converter_Impl.cpp.

References dsi_convert_reply(), and TAO_OutputCDR::throw_skel_exception().

00099 {
00100   TAO_OutputCDR output;
00101   for (CORBA::ULong j = 0; j < nargs; ++j)
00102     {
00103       if (!(args[j]->marshal (output)))
00104         {
00105           TAO_OutputCDR::throw_skel_exception (errno);
00106         }
00107     }
00108   TAO_InputCDR input (output);
00109   this->dsi_convert_reply (server_request, input);
00110 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL void TAO_DII_Arguments_Converter_Impl::convert_request ( TAO_ServerRequest server_request,
TAO::Argument *const   args[],
size_t  nargs 
) [virtual]

Definition at line 17 of file DII_Arguments_Converter_Impl.cpp.

References TAO_Operation_Details::use_stub_args().

00021 {
00022   // The DII requests on client side always have two arguments
00023   // - one is the return argument and the other is NVList_Argument.
00024   // Since the argument list in the client side is used by server side
00025   // in collocation case and the server expects the list of arguments
00026   // and not the NVList_Argument, we need expand the NVList_Argument
00027   // to be list of Arguments.
00028 
00029   // Before expanding NVList_Argument logic was added, the
00030   // $TAO_ROOT/tests/DII_Collocated_Tests/run_test.pl should fail.
00031   // The servant will get incorrect "IN" parameter from the oneway
00032   // operation with single "IN" parameter and get access violation on
00033   // get_in_arg () from the oneway operation with multiple "IN"
00034   // parameters.
00035   CORBA::NVList_ptr lst
00036     = static_cast<TAO::NVList_Argument *> (
00037         server_request.operation_details ()->args()[1])->arg ();
00038 
00039   CORBA::ULong const sz = lst->count ();
00040 
00041   if (sz != nargs - 1)
00042     {
00043       throw ::CORBA::BAD_PARAM ();
00044     }
00045 
00046   // To avoid the use of extraction operators on CORBA::Any, we will
00047   // marshal the arguments in the NVList into an output cdr and then
00048   // demarshal them into the TAO::Argument array.
00049   TAO_OutputCDR output;
00050   for (CORBA::ULong i = 0; i < sz; ++i)
00051     {
00052       CORBA::NamedValue_ptr theitem = lst->item (i);
00053 
00054       if (!(theitem->value ()->impl ()->marshal_value (output)))
00055         {
00056           throw ::CORBA::BAD_PARAM ();
00057         }
00058     }
00059 
00060   TAO_InputCDR input (output);
00061   for (CORBA::ULong j = 0; j < sz; ++j)
00062     {
00063       if (!(args[j + 1]->demarshal (input)))
00064         {
00065           throw ::CORBA::BAD_PARAM ();
00066         }
00067     }
00068 
00069   TAO_Operation_Details* details
00070     = const_cast <TAO_Operation_Details*> (server_request.operation_details ());
00071 
00072   // The NVList_Argument in operation details is converted to skel
00073   // args, the invocation of the dii collocation requests should use
00074   // the skel args and not use the stub args.
00075   details->use_stub_args (false);
00076 }

void TAO_DII_Arguments_Converter_Impl::dsi_convert_reply ( TAO_ServerRequest server_request,
TAO_InputCDR input 
) [virtual]

Definition at line 113 of file DII_Arguments_Converter_Impl.cpp.

References TAO_Operation_Details::args(), and TAO_ServerRequest::operation_details().

Referenced by convert_reply().

00116 {
00117   TAO::NamedValue_Argument * _ret_val
00118     = static_cast<TAO::NamedValue_Argument *> (
00119         server_request.operation_details ()->args()[0]);
00120   
00121   _ret_val->demarshal (input);
00122   
00123   CORBA::NVList_ptr lst
00124     = static_cast<TAO::NVList_Argument *> (
00125         server_request.operation_details ()->args()[1])->arg ();
00126 
00127   lst->_tao_decode (input, 
00128                     CORBA::ARG_INOUT | CORBA::ARG_OUT);
00129 }

void TAO_DII_Arguments_Converter_Impl::dsi_convert_request ( TAO_ServerRequest server_request,
TAO_OutputCDR output 
) [virtual]

Definition at line 79 of file DII_Arguments_Converter_Impl.cpp.

References TAO_Operation_Details::args(), and TAO_ServerRequest::operation_details().

00082 {
00083   // The DII requests on client side always have two arguments
00084   // - one is the return argument and the other is NVList_Argument.
00085   CORBA::NVList_ptr lst
00086     = static_cast<TAO::NVList_Argument *> (
00087         server_request.operation_details ()->args()[1])->arg ();
00088 
00089   // Only marshal the in(out) arguments since we use this to demarshal
00090   // these values in the serverside argument list.
00091   lst->_tao_encode (output, CORBA::ARG_IN | CORBA::ARG_INOUT);
00092 }

void TAO_DII_Arguments_Converter_Impl::handle_corba_exception ( TAO_ServerRequest server_request,
CORBA::Exception exception 
) [virtual]

Definition at line 132 of file DII_Arguments_Converter_Impl.cpp.

References CORBA::Exception::_raise().

00135 {
00136   exception->_raise ();
00137 }

int TAO_DII_Arguments_Converter_Impl::Initializer ( void   )  [static]

Definition at line 144 of file DII_Arguments_Converter_Impl.cpp.

References ACE_Service_Config::process_directive().

00145 {
00146   return ACE_Service_Config::process_directive (
00147     ace_svc_desc_TAO_DII_Arguments_Converter_Impl);
00148 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:43:29 2010 for TAO_DynamicInterface by  doxygen 1.4.7