Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / AnyTypeCode / ExceptionA.cpp
blob280f70e4bea5bc4f608b24ad183c0477da682f12
1 // -*- C++ -*-
2 #include "tao/AnyTypeCode/ExceptionA.h"
3 #include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
4 #include "tao/SystemException.h"
5 #include "tao/ORB_Constants.h"
6 #include "tao/CORBA_String.h"
7 #include "tao/CDR.h"
8 #include "tao/debug.h"
10 #include "ace/Malloc.h"
11 #include "ace/SString.h"
12 #include "ace/OS_NS_string.h"
14 #include "ace/OS_NS_stdio.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 // Specializations for CORBA::Exception Any operators.
19 namespace TAO
21 template<>
22 void
23 Any_Dual_Impl_T<CORBA::Exception>::value (const CORBA::Exception & val)
25 this->value_ = val._tao_duplicate ();
28 template<>
29 CORBA::Boolean
30 Any_Dual_Impl_T<CORBA::Exception>::marshal_value (TAO_OutputCDR &cdr)
32 try
34 this->value_->_tao_encode (cdr);
36 return true;
38 catch (const ::CORBA::Exception&)
42 return false;
45 template<>
46 CORBA::Boolean
47 Any_Dual_Impl_T<CORBA::Exception>::demarshal_value (TAO_InputCDR &cdr)
49 try
51 this->value_->_tao_decode (cdr);
53 return true;
55 catch (const ::CORBA::Exception&)
59 return false;
62 // This should never get called since we don't have extraction operators
63 // for CORBA::Exception, but it is here to sidestep the constructor call
64 // in the unspecialized version that causes a problem with compilers that
65 // require explicit instantiation
66 template<>
67 CORBA::Boolean
68 Any_Dual_Impl_T<CORBA::Exception>::extract (
69 const CORBA::Any &,
70 _tao_destructor,
71 CORBA::TypeCode_ptr,
72 const CORBA::Exception *&)
74 return false;
78 // =======================================================================
80 namespace CORBA
82 // Insertion of CORBA::Exception - copying.
83 void
84 operator<<= (CORBA::Any &any, const CORBA::Exception &exception)
86 TAO::Any_Dual_Impl_T<CORBA::Exception>::insert_copy (
87 any,
88 CORBA::Exception::_tao_any_destructor,
89 exception._tao_type (),
90 exception);
93 // Insertion of CORBA::Exception - non-copying.
94 void
95 operator<<= (CORBA::Any &any, CORBA::Exception *exception)
97 TAO::Any_Dual_Impl_T<CORBA::Exception>::insert (
98 any,
99 CORBA::Exception::_tao_any_destructor,
100 exception->_tao_type (),
101 exception);
107 TAO_END_VERSIONED_NAMESPACE_DECL