00001 //$Id: operation_details.cpp 87951 2009-12-07 07:13:31Z dai_y $ 00002 00003 #include "tao/operation_details.h" 00004 #include "tao/Stub.h" 00005 #include "tao/ORB_Constants.h" 00006 #include "tao/Exception_Data.h" 00007 #include "tao/SystemException.h" 00008 #include "tao/Argument.h" 00009 #include "tao/CDR.h" 00010 #include "tao/debug.h" 00011 00012 #include "ace/OS_NS_string.h" 00013 00014 #if !defined (__ACE_INLINE__) 00015 # include "tao/operation_details.inl" 00016 #endif /* ! __ACE_INLINE__ */ 00017 00018 ACE_RCSID (tao, 00019 operation_details, 00020 "$Id: operation_details.cpp 87951 2009-12-07 07:13:31Z dai_y $") 00021 00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00023 00024 CORBA::Exception * 00025 TAO_Operation_Details::corba_exception (const char *id) const 00026 { 00027 for (CORBA::ULong i = 0; i != this->ex_count_; ++i) 00028 { 00029 if (ACE_OS::strcmp (id, this->ex_data_[i].id) != 0) 00030 { 00031 continue; 00032 } 00033 00034 // Create an exception object 00035 CORBA::Exception *exception = this->ex_data_[i].alloc (); 00036 00037 if (exception == 0) 00038 { 00039 throw ::CORBA::NO_MEMORY (0, CORBA::COMPLETED_YES); 00040 } 00041 00042 // Return the exception object that we just created. 00043 return exception; 00044 } 00045 00046 // If there are no matches return an unknown exception. 00047 throw ::CORBA::UNKNOWN (0, CORBA::COMPLETED_YES); 00048 } 00049 00050 bool 00051 TAO_Operation_Details::has_exception (::CORBA::Exception& ex) const 00052 { 00053 for (CORBA::ULong i = 0; i != this->ex_count_; ++i) 00054 { 00055 if (ACE_OS::strcmp (ex._rep_id (), this->ex_data_[i].id) == 0) 00056 { 00057 return true; 00058 } 00059 } 00060 return false; 00061 } 00062 00063 bool 00064 TAO_Operation_Details::marshal_args (TAO_OutputCDR &cdr) 00065 { 00066 try { 00067 for (CORBA::ULong i = 0; i != this->num_args_; ++i) 00068 { 00069 if (!((*this->args_[i]).marshal (cdr))) 00070 return false; 00071 } 00072 00073 // Nothing else to fragment. We're also guaranteed to have 00074 // data in the CDR stream since the operation was a marshaling 00075 // operation, not a fragmentation operation. 00076 cdr.more_fragments (false); 00077 #ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION 00078 cdr.reset_vt_indirect_maps (); 00079 #endif 00080 } 00081 catch (...) { 00082 #ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION 00083 cdr.reset_vt_indirect_maps (); 00084 #endif 00085 throw; 00086 } 00087 return true; 00088 } 00089 00090 bool 00091 TAO_Operation_Details::demarshal_args (TAO_InputCDR &cdr) 00092 { 00093 try { 00094 for (CORBA::ULong i = 0; i != this->num_args_; ++i) 00095 { 00096 if (!((*this->args_[i]).demarshal (cdr))) 00097 return false; 00098 } 00099 00100 cdr.reset_vt_indirect_maps (); 00101 } 00102 catch (...) { 00103 cdr.reset_vt_indirect_maps (); 00104 throw; 00105 } 00106 return true; 00107 } 00108 00109 TAO_END_VERSIONED_NAMESPACE_DECL