TAO::Any_SystemException Class Reference

Template Any class for IDL types with 2 modes of insertion. More...

#include <Any_SystemException.h>

Inheritance diagram for TAO::Any_SystemException:

Inheritance graph
[legend]
Collaboration diagram for TAO::Any_SystemException:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Any_SystemException (_tao_destructor destructor, CORBA::TypeCode_ptr, CORBA::SystemException *const )
 Any_SystemException (_tao_destructor destructor, CORBA::TypeCode_ptr, const CORBA::SystemException &)
 Any_SystemException (CORBA::TypeCode_ptr)
virtual ~Any_SystemException (void)
virtual CORBA::Boolean marshal_value (TAO_OutputCDR &)
CORBA::Boolean demarshal_value (TAO_InputCDR &)
virtual const void * value (void) const
virtual void free_value (void)

Static Public Member Functions

void insert (CORBA::Any &, _tao_destructor, CORBA::TypeCode_ptr, CORBA::SystemException *const )
void insert_copy (CORBA::Any &, _tao_destructor destructor, CORBA::TypeCode_ptr, const CORBA::SystemException &)
CORBA::Boolean extract (const CORBA::Any &, _tao_destructor, CORBA::TypeCode_ptr, const CORBA::SystemException *&, excp_factory f)

Protected Attributes

CORBA::SystemExceptionvalue_

Detailed Description

Template Any class for IDL types with 2 modes of insertion.

Used for the IDL types that have copying and non-copying insertion, but which are not (de)marshaled as pointers - struct, union, sequence, and exception.

Definition at line 42 of file Any_SystemException.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::Any_SystemException::Any_SystemException _tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
CORBA::SystemException const
 

Definition at line 23 of file Any_SystemException.cpp.

00026   : Any_Impl (destructor,
00027               tc),
00028     value_ (val)
00029 {
00030 }

TAO::Any_SystemException::Any_SystemException _tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
const CORBA::SystemException
 

Definition at line 32 of file Any_SystemException.cpp.

References CORBA::SystemException::_tao_duplicate().

00035   : Any_Impl (destructor,
00036               tc)
00037 {
00038  this->value_ =
00039    dynamic_cast <CORBA::SystemException *> (val._tao_duplicate ());
00040 }

TAO::Any_SystemException::Any_SystemException CORBA::TypeCode_ptr   ) 
 

Definition at line 42 of file Any_SystemException.cpp.

00043   : Any_Impl (0,
00044               tc)
00045 {
00046 }

TAO::Any_SystemException::~Any_SystemException void   )  [virtual]
 

Definition at line 48 of file Any_SystemException.cpp.

00049 {
00050 }


Member Function Documentation

CORBA::Boolean TAO::Any_SystemException::demarshal_value TAO_InputCDR  ) 
 

Definition at line 189 of file Any_SystemException.cpp.

References CORBA::SystemException::_tao_decode().

Referenced by extract().

00190 {
00191   try
00192     {
00193       this->value_->_tao_decode (cdr);
00194       return true;
00195     }
00196   catch (const ::CORBA::Exception&)
00197     {
00198     }
00199   return false;
00200 }

CORBA::Boolean TAO::Any_SystemException::extract const CORBA::Any ,
_tao_destructor  ,
CORBA::TypeCode_ptr  ,
const CORBA::SystemException *&  ,
excp_factory  f
[static]
 

Definition at line 81 of file Any_SystemException.cpp.

References TAO::Unknown_IDL_Type::_tao_get_cdr(), CORBA::Any::_tao_get_typecode(), ACE_NEW_RETURN, demarshal_value(), TAO::Any_Impl::encoded(), CORBA::Any::impl(), ACE_Auto_Basic_Ptr< X >::release(), and value_.

00086 {
00087   _tao_elem = 0;
00088 
00089   try
00090     {
00091       CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
00092       CORBA::Boolean const _tao_equiv = any_tc->equivalent (tc);
00093 
00094       if (_tao_equiv == false)
00095         {
00096           return false;
00097         }
00098 
00099       TAO::Any_Impl *impl = any.impl ();
00100 
00101       if (!impl->encoded ())
00102         {
00103           TAO::Any_SystemException *narrow_impl =
00104             dynamic_cast <TAO::Any_SystemException *> (impl);
00105 
00106           if (narrow_impl == 0)
00107             {
00108               return false;
00109             }
00110 
00111           _tao_elem = narrow_impl->value_;
00112           return true;
00113         }
00114 
00115       CORBA::SystemException *empty_value =  (*f) ();
00116 
00117       TAO::Any_SystemException *replacement = 0;
00118       ACE_NEW_RETURN (replacement,
00119                       TAO::Any_SystemException (destructor,
00120                                                 any_tc,
00121                                                 empty_value),
00122                       false);
00123 
00124       auto_ptr<TAO::Any_SystemException > replacement_safety (replacement);
00125 
00126       // We know this will work since the unencoded case is covered above.
00127       TAO::Unknown_IDL_Type * const unk =
00128         dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
00129 
00130       if (!unk)
00131         return false;
00132 
00133       // We don't want the rd_ptr of unk to move, in case it is
00134       // shared by another Any. This copies the state, not the buffer.
00135       TAO_InputCDR for_reading (unk->_tao_get_cdr ());
00136 
00137       CORBA::Boolean const good_decode =
00138         replacement->demarshal_value (for_reading);
00139 
00140       if (good_decode)
00141         {
00142           _tao_elem = replacement->value_;
00143           const_cast<CORBA::Any &> (any).replace (replacement);
00144           replacement_safety.release ();
00145           return true;
00146         }
00147     }
00148   catch (const ::CORBA::Exception&)
00149     {
00150     }
00151 
00152   return false;
00153 }

void TAO::Any_SystemException::free_value void   )  [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 156 of file Any_SystemException.cpp.

00157 {
00158   if (this->value_destructor_ != 0)
00159     {
00160       (*this->value_destructor_) (this->value_);
00161       this->value_destructor_ = 0;
00162     }
00163 
00164   ::CORBA::release (this->type_);
00165   this->value_ = 0;
00166 }

void TAO::Any_SystemException::insert CORBA::Any ,
_tao_destructor  ,
CORBA::TypeCode_ptr  ,
CORBA::SystemException const
[static]
 

Definition at line 53 of file Any_SystemException.cpp.

References ACE_NEW, and CORBA::Any::replace().

00057 {
00058   Any_SystemException *new_impl = 0;
00059   ACE_NEW (new_impl,
00060            Any_SystemException (destructor,
00061                                 tc,
00062                                 value));
00063   any.replace (new_impl);
00064 }

void TAO::Any_SystemException::insert_copy CORBA::Any ,
_tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
const CORBA::SystemException
[static]
 

Definition at line 67 of file Any_SystemException.cpp.

References ACE_NEW, and CORBA::Any::replace().

00071 {
00072   Any_SystemException *new_impl = 0;
00073   ACE_NEW (new_impl,
00074            Any_SystemException (destructor,
00075                                 tc,
00076                                 value));
00077   any.replace (new_impl);
00078 }

CORBA::Boolean TAO::Any_SystemException::marshal_value TAO_OutputCDR  )  [virtual]
 

Implements TAO::Any_Impl.

Definition at line 175 of file Any_SystemException.cpp.

References CORBA::SystemException::_tao_encode().

00176 {
00177   try
00178     {
00179       this->value_->_tao_encode (cdr);
00180       return true;
00181     }
00182   catch (const ::CORBA::Exception&)
00183     {
00184     }
00185   return false;
00186 }

const void * TAO::Any_SystemException::value void   )  const [virtual]
 

Definition at line 169 of file Any_SystemException.cpp.

00170 {
00171   return this->value_;
00172 }


Member Data Documentation

CORBA::SystemException* TAO::Any_SystemException::value_ [protected]
 

Definition at line 80 of file Any_SystemException.h.

Referenced by extract().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:22:06 2008 for TAO_AnyTypeCode by doxygen 1.3.6