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