Public Member Functions | Static Public Member Functions

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.

{
  TAO_OutputCDR output;
  for (CORBA::ULong j = 0; j < nargs; ++j)
    {
      if (!(args[j]->marshal (output)))
        {
          TAO_OutputCDR::throw_skel_exception (errno);
        }
    }
  TAO_InputCDR input (output);
  this->dsi_convert_reply (server_request, input);
}

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.

{
  // The DII requests on client side always have two arguments
  // - one is the return argument and the other is NVList_Argument.
  // Since the argument list in the client side is used by server side
  // in collocation case and the server expects the list of arguments
  // and not the NVList_Argument, we need expand the NVList_Argument
  // to be list of Arguments.

  // Before expanding NVList_Argument logic was added, the
  // $TAO_ROOT/tests/DII_Collocated_Tests/run_test.pl should fail.
  // The servant will get incorrect "IN" parameter from the oneway
  // operation with single "IN" parameter and get access violation on
  // get_in_arg () from the oneway operation with multiple "IN"
  // parameters.
  CORBA::NVList_ptr lst
    = static_cast<TAO::NVList_Argument *> (
        server_request.operation_details ()->args()[1])->arg ();

  CORBA::ULong const sz = lst->count ();

  if (sz != nargs - 1)
    {
      throw ::CORBA::BAD_PARAM ();
    }

  // To avoid the use of extraction operators on CORBA::Any, we will
  // marshal the arguments in the NVList into an output cdr and then
  // demarshal them into the TAO::Argument array.
  TAO_OutputCDR output;
  for (CORBA::ULong i = 0; i < sz; ++i)
    {
      CORBA::NamedValue_ptr theitem = lst->item (i);

      if (!(theitem->value ()->impl ()->marshal_value (output)))
        {
          throw ::CORBA::BAD_PARAM ();
        }
    }

  TAO_InputCDR input (output);
  for (CORBA::ULong j = 0; j < sz; ++j)
    {
      if (!(args[j + 1]->demarshal (input)))
        {
          throw ::CORBA::BAD_PARAM ();
        }
    }

  TAO_Operation_Details* details
    = const_cast <TAO_Operation_Details*> (server_request.operation_details ());

  // The NVList_Argument in operation details is converted to skel
  // args, the invocation of the dii collocation requests should use
  // the skel args and not use the stub args.
  details->use_stub_args (false);
}

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.

{
  TAO::NamedValue_Argument * _ret_val
    = static_cast<TAO::NamedValue_Argument *> (
        server_request.operation_details ()->args()[0]);
  
  _ret_val->demarshal (input);
  
  CORBA::NVList_ptr lst
    = static_cast<TAO::NVList_Argument *> (
        server_request.operation_details ()->args()[1])->arg ();

  lst->_tao_decode (input, 
                    CORBA::ARG_INOUT | CORBA::ARG_OUT);
}

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.

{
  // The DII requests on client side always have two arguments
  // - one is the return argument and the other is NVList_Argument.
  CORBA::NVList_ptr lst
    = static_cast<TAO::NVList_Argument *> (
        server_request.operation_details ()->args()[1])->arg ();

  // Only marshal the in(out) arguments since we use this to demarshal
  // these values in the serverside argument list.
  lst->_tao_encode (output, CORBA::ARG_IN | CORBA::ARG_INOUT);
}

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.

{
  exception->_raise ();
}

int TAO_DII_Arguments_Converter_Impl::Initializer ( void   )  [static]

Definition at line 144 of file DII_Arguments_Converter_Impl.cpp.

{
  return ACE_Service_Config::process_directive (
    ace_svc_desc_TAO_DII_Arguments_Converter_Impl);
}


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines