Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / operation_details.cpp
blob843b3cbb75f08cb78b872a4d08d55b60cc0e6f78
1 #include "tao/operation_details.h"
2 #include "tao/Stub.h"
3 #include "tao/ORB_Constants.h"
4 #include "tao/Exception_Data.h"
5 #include "tao/SystemException.h"
6 #include "tao/Argument.h"
7 #include "tao/CDR.h"
8 #include "tao/debug.h"
10 #include "ace/OS_NS_string.h"
12 #if !defined (__ACE_INLINE__)
13 # include "tao/operation_details.inl"
14 #endif /* ! __ACE_INLINE__ */
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 CORBA::Exception *
19 TAO_Operation_Details::corba_exception (const char *id) const
21 for (CORBA::ULong i = 0; i != this->ex_count_; ++i)
23 if (ACE_OS::strcmp (id, this->ex_data_[i].id) != 0)
25 continue;
28 // Create an exception object
29 CORBA::Exception *exception = this->ex_data_[i].alloc ();
31 if (!exception)
33 throw ::CORBA::NO_MEMORY (0, CORBA::COMPLETED_YES);
36 // Return the exception object that we just created.
37 return exception;
40 // If there are no matches return an unknown exception.
41 throw ::CORBA::UNKNOWN (0, CORBA::COMPLETED_YES);
44 bool
45 TAO_Operation_Details::has_exception (::CORBA::Exception& ex) const
47 for (CORBA::ULong i = 0; i != this->ex_count_; ++i)
49 if (ACE_OS::strcmp (ex._rep_id (), this->ex_data_[i].id) == 0)
51 return true;
54 return false;
57 bool
58 TAO_Operation_Details::marshal_args (TAO_OutputCDR &cdr)
60 try {
61 for (CORBA::ULong i = 0; i != this->num_args_; ++i)
63 if (!((*this->args_[i]).marshal (cdr)))
64 return false;
67 // Nothing else to fragment. We're also guaranteed to have
68 // data in the CDR stream since the operation was a marshaling
69 // operation, not a fragmentation operation.
70 cdr.more_fragments (false);
71 #ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION
72 cdr.reset_vt_indirect_maps ();
73 #endif
75 catch (...) {
76 #ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION
77 cdr.reset_vt_indirect_maps ();
78 #endif
79 throw;
81 return true;
84 bool
85 TAO_Operation_Details::demarshal_args (TAO_InputCDR &cdr)
87 try {
88 for (CORBA::ULong i = 0; i != this->num_args_; ++i)
90 if (!((*this->args_[i]).demarshal (cdr)))
91 return false;
94 cdr.reset_vt_indirect_maps ();
96 catch (...) {
97 cdr.reset_vt_indirect_maps ();
98 throw;
100 return true;
103 TAO_END_VERSIONED_NAMESPACE_DECL