00001 //operation_details.cpp,v 1.12 2006/04/20 12:37:17 jwillemsen Exp 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 00011 #include "ace/OS_NS_string.h" 00012 00013 #if !defined (__ACE_INLINE__) 00014 # include "tao/operation_details.i" 00015 #endif /* ! __ACE_INLINE__ */ 00016 00017 ACE_RCSID (tao, 00018 operation_details, 00019 "operation_details.cpp,v 1.12 2006/04/20 12:37:17 jwillemsen Exp") 00020 00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 CORBA::Exception * 00024 TAO_Operation_Details::corba_exception (const char *id 00025 ACE_ENV_ARG_DECL) 00026 ACE_THROW_SPEC ((CORBA::SystemException)) 00027 { 00028 for (CORBA::ULong i = 0; i != this->ex_count_; ++i) 00029 { 00030 if (ACE_OS::strcmp (id, 00031 this->ex_data_[i].id) != 0) 00032 { 00033 continue; 00034 } 00035 00036 // Create an exception object 00037 CORBA::Exception *exception = 00038 this->ex_data_[i].alloc (); 00039 00040 if (exception == 0) 00041 { 00042 ACE_THROW_RETURN (CORBA::NO_MEMORY (0, 00043 CORBA::COMPLETED_YES), 00044 0); 00045 } 00046 00047 // Return the exception object that we just created. 00048 return exception; 00049 } 00050 00051 // If there are no matches return an unknown exception. 00052 ACE_THROW_RETURN (CORBA::UNKNOWN (0, 00053 CORBA::COMPLETED_YES), 00054 0); 00055 } 00056 00057 bool 00058 TAO_Operation_Details::marshal_args (TAO_OutputCDR &cdr) 00059 { 00060 for (CORBA::ULong i = 0; i != this->num_args_; ++i) 00061 { 00062 if (!((*this->args_[i]).marshal (cdr))) 00063 return false; 00064 } 00065 00066 // Nothing else to fragment. We're also guaranteed to have 00067 // data in the CDR stream since the operation was a marshaling 00068 // operation, not a fragmentation operation. 00069 cdr.more_fragments (false); 00070 00071 return true; 00072 } 00073 00074 bool 00075 TAO_Operation_Details::demarshal_args (TAO_InputCDR &cdr) 00076 { 00077 for (CORBA::ULong i = 0; i != this->num_args_; ++i) 00078 { 00079 if (!((*this->args_[i]).demarshal (cdr))) 00080 return false; 00081 } 00082 00083 return true; 00084 } 00085 00086 TAO_END_VERSIONED_NAMESPACE_DECL