ExceptionA.cpp

Go to the documentation of this file.
00001 // $Id: ExceptionA.cpp 77357 2007-02-24 06:58:14Z johnnyw $
00002 
00003 #include "tao/AnyTypeCode/ExceptionA.h"
00004 #include "tao/AnyTypeCode/Any_Dual_Impl_T.h"
00005 #include "tao/SystemException.h"
00006 #include "tao/ORB_Constants.h"
00007 #include "tao/CORBA_String.h"
00008 #include "tao/CDR.h"
00009 #include "tao/debug.h"
00010 
00011 #include "ace/Malloc.h"
00012 #include "ace/SString.h"
00013 #include "ace/OS_NS_string.h"
00014 
00015 #include "ace/OS_NS_stdio.h"
00016 
00017 ACE_RCSID (AnyTypeCode,
00018            Exception,
00019            "$Id: ExceptionA.cpp 77357 2007-02-24 06:58:14Z johnnyw $")
00020 
00021 
00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 // Specializations for CORBA::Exception Any operators.
00025 namespace TAO
00026 {
00027   template<>
00028   void
00029   Any_Dual_Impl_T<CORBA::Exception>::value (
00030       const CORBA::Exception & val
00031     )
00032   {
00033     this->value_ = val._tao_duplicate ();
00034   }
00035 
00036   template<>
00037   CORBA::Boolean
00038   Any_Dual_Impl_T<CORBA::Exception>::marshal_value (TAO_OutputCDR &cdr)
00039   {
00040     try
00041       {
00042         this->value_->_tao_encode (cdr);
00043 
00044         return true;
00045       }
00046     catch (const ::CORBA::Exception&)
00047       {
00048       }
00049 
00050     return false;
00051   }
00052 
00053   template<>
00054   CORBA::Boolean
00055   Any_Dual_Impl_T<CORBA::Exception>::demarshal_value (TAO_InputCDR &cdr)
00056   {
00057     try
00058       {
00059         this->value_->_tao_decode (cdr
00060                                   );
00061 
00062         return true;
00063       }
00064     catch (const ::CORBA::Exception&)
00065       {
00066       }
00067 
00068     return false;
00069   }
00070 
00071   // This should never get called since we don't have extraction operators
00072   // for CORBA::Exception, but it is here to sidestep the constructor call
00073   // in the unspecialized version that causes a problem with compilers that
00074   // require explicit instantiation
00075   template<>
00076   CORBA::Boolean
00077   Any_Dual_Impl_T<CORBA::Exception>::extract (
00078       const CORBA::Any &,
00079       _tao_destructor,
00080       CORBA::TypeCode_ptr,
00081       const CORBA::Exception *&
00082     )
00083   {
00084     return false;
00085   }
00086 }
00087 
00088 // =======================================================================
00089 
00090 
00091 // Insertion of CORBA::Exception - copying.
00092 void
00093 operator<<= (CORBA::Any &any, const CORBA::Exception &exception)
00094 {
00095   TAO::Any_Dual_Impl_T<CORBA::Exception>::insert_copy (
00096       any,
00097       CORBA::Exception::_tao_any_destructor,
00098       exception._tao_type (),
00099       exception
00100     );
00101 }
00102 
00103 // Insertion of CORBA::Exception - non-copying.
00104 void
00105 operator<<= (CORBA::Any &any, CORBA::Exception *exception)
00106 {
00107   TAO::Any_Dual_Impl_T<CORBA::Exception>::insert (
00108       any,
00109       CORBA::Exception::_tao_any_destructor,
00110       exception->_tao_type (),
00111       exception
00112     );
00113 }
00114 
00115 
00116 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Sun Jan 27 13:21:06 2008 for TAO_AnyTypeCode by doxygen 1.3.6