00001 // $Id: DII_Arguments.cpp 76962 2007-02-08 16:29:30Z johnnyw $ 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 "$Id: DII_Arguments.cpp 76962 2007-02-08 16:29:30Z johnnyw $") 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 try 00028 { 00029 if (this->x_ !=0 && this->x_->value ()->impl ()) 00030 { 00031 this->x_->value ()->impl ()->_tao_decode (cdr); 00032 } 00033 } 00034 catch (const ::CORBA::Exception&) 00035 { 00036 return false; 00037 } 00038 00039 this->byte_order_ = cdr.byte_order (); 00040 00041 return true; 00042 } 00043 00044 void 00045 NamedValue_Argument::interceptor_value (CORBA::Any *any) const 00046 { 00047 (*any) <<= *this->x_->value (); 00048 } 00049 00050 // ======================================================================== 00051 00052 CORBA::Boolean 00053 NVList_Argument::marshal (TAO_OutputCDR &cdr) 00054 { 00055 try 00056 { 00057 this->x_->_tao_encode (cdr, CORBA::ARG_IN | CORBA::ARG_INOUT); 00058 } 00059 catch (const ::CORBA::Exception&) 00060 { 00061 return false; 00062 } 00063 00064 return true; 00065 } 00066 00067 CORBA::Boolean 00068 NVList_Argument::demarshal (TAO_InputCDR &cdr) 00069 { 00070 00071 try 00072 { 00073 // Now, get all the "return", "out", and "inout" parameters 00074 // from the response message body ... return parameter is 00075 // first, the rest are in the order defined in the IDL spec 00076 // (which is also the order that DII users are required to 00077 // use). 00078 00079 this->x_->_tao_incoming_cdr ( 00080 cdr, 00081 CORBA::ARG_OUT | CORBA::ARG_INOUT, 00082 this->lazy_evaluation_); 00083 } 00084 catch (const ::CORBA::Exception&) 00085 { 00086 return false; 00087 } 00088 00089 return true; 00090 } 00091 00092 void 00093 NVList_Argument::interceptor_paramlist (Dynamic::ParameterList *lst) 00094 { 00095 CORBA::ULong const len = this->x_->count (); 00096 lst->length (len); 00097 00098 for (CORBA::ULong i = 0; i < len; ++i) 00099 { 00100 if (!this->x_->item (i)->value ()) 00101 return; 00102 00103 (*lst)[i].argument.replace (this->x_->item (i)->value ()->impl ()); 00104 00105 switch (this->x_->item (i)->flags ()) 00106 { 00107 case CORBA::ARG_IN: 00108 { 00109 (*lst)[i].mode = CORBA::PARAM_IN; 00110 break; 00111 } 00112 case CORBA::ARG_INOUT: 00113 { 00114 (*lst)[i].mode = CORBA::PARAM_INOUT; 00115 break; 00116 } 00117 case CORBA::ARG_OUT: 00118 { 00119 (*lst)[i].mode = CORBA::PARAM_OUT; 00120 break; 00121 } 00122 default: 00123 break; 00124 } 00125 } 00126 } 00127 } 00128 00129 TAO_END_VERSIONED_NAMESPACE_DECL