DII_Arguments.cpp

Go to the documentation of this file.
00001 // DII_Arguments.cpp,v 1.9 2006/03/10 07:19:08 jtc Exp
00002 
00003 #include "tao/DynamicInterface/DII_Arguments.h"
00004 
00005 #include "tao/AnyTypeCode/NVList.h"
00006 #include "tao/AnyTypeCode/Any_Impl.h"
00007 #include "tao/AnyTypeCode/DynamicC.h"
00008 #include "tao/Exception.h"
00009 #include "tao/CDR.h"
00010 
00011 
00012 ACE_RCSID (DynamicInterface,
00013            DII_Arguments,
00014            "DII_Arguments.cpp,v 1.9 2006/03/10 07:19:08 jtc Exp")
00015 
00016 #if !defined (__ACE_INLINE__)
00017 # include "tao/DynamicInterface/DII_Arguments.inl"
00018 #endif /* ! __ACE_INLINE__ */
00019 
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021 
00022 namespace TAO
00023 {
00024   CORBA::Boolean
00025   NamedValue_Argument::demarshal (TAO_InputCDR &cdr)
00026   {
00027     ACE_DECLARE_NEW_CORBA_ENV;
00028     ACE_TRY
00029       {
00030         if (this->x_ !=0 && this->x_->value ()->impl ())
00031           {
00032             this->x_->value ()->impl ()->_tao_decode (cdr
00033                                                       ACE_ENV_ARG_PARAMETER);
00034             ACE_TRY_CHECK;
00035           }
00036       }
00037     ACE_CATCHANY
00038       {
00039         return 0;
00040       }
00041     ACE_ENDTRY;
00042     ACE_CHECK_RETURN (false);
00043 
00044     this->byte_order_ = cdr.byte_order ();
00045 
00046     return 1;
00047   }
00048 
00049   void
00050   NamedValue_Argument::interceptor_value (CORBA::Any *any) const
00051   {
00052     (*any) <<= *this->x_->value ();
00053   }
00054 
00055   // ========================================================================
00056 
00057   CORBA::Boolean
00058   NVList_Argument::marshal (TAO_OutputCDR &cdr)
00059   {
00060     ACE_DECLARE_NEW_CORBA_ENV;
00061     ACE_TRY
00062       {
00063         this->x_->_tao_encode (cdr,
00064                                CORBA::ARG_IN | CORBA::ARG_INOUT
00065                                ACE_ENV_ARG_PARAMETER);
00066         ACE_TRY_CHECK;
00067       }
00068     ACE_CATCHANY
00069       {
00070         return 0;
00071       }
00072     ACE_ENDTRY;
00073     ACE_CHECK_RETURN (false);
00074 
00075     return 1;
00076   }
00077 
00078   CORBA::Boolean
00079   NVList_Argument::demarshal (TAO_InputCDR &cdr)
00080   {
00081 
00082     ACE_DECLARE_NEW_CORBA_ENV;
00083     ACE_TRY
00084       {
00085         // Now, get all the "return", "out", and "inout" parameters
00086         // from the response message body ... return parameter is
00087         // first, the rest are in the order defined in the IDL spec
00088         // (which is also the order that DII users are required to
00089         // use).
00090 
00091         this->x_->_tao_incoming_cdr (
00092             cdr,
00093             CORBA::ARG_OUT | CORBA::ARG_INOUT,
00094             this->lazy_evaluation_
00095             ACE_ENV_ARG_PARAMETER);
00096         ACE_TRY_CHECK;
00097       }
00098     ACE_CATCHANY
00099       {
00100         return 0;
00101       }
00102     ACE_ENDTRY;
00103     ACE_CHECK_RETURN (false);
00104 
00105     return 1;
00106   }
00107 
00108   void
00109   NVList_Argument::interceptor_paramlist (Dynamic::ParameterList *lst)
00110   {
00111     const CORBA::ULong len = this->x_->count ();
00112     lst->length (len);
00113 
00114     for (CORBA::ULong i = 0; i < len; ++i)
00115       {
00116         if (!this->x_->item (i)->value ())
00117           return;
00118 
00119         (*lst)[i].argument.replace (
00120           this->x_->item (i)->value ()->impl ());
00121 
00122         switch (this->x_->item (i)->flags ())
00123           {
00124           case CORBA::ARG_IN:
00125             {
00126               (*lst)[i].mode = CORBA::PARAM_IN;
00127               break;
00128             }
00129           case CORBA::ARG_INOUT:
00130             {
00131               (*lst)[i].mode = CORBA::PARAM_INOUT;
00132               break;
00133             }
00134           case CORBA::ARG_OUT:
00135             {
00136               (*lst)[i].mode = CORBA::PARAM_OUT;
00137               break;
00138             }
00139           default:
00140             break;
00141           }
00142       }
00143   }
00144 }
00145 
00146 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:04:21 2006 for TAO_DynamicInterface by doxygen 1.3.6