TAO::Any_Impl_T< T > Class Template Reference

Template Any class for pointer types. More...

#include <Any_Impl_T.h>

Inheritance diagram for TAO::Any_Impl_T< T >:

Inheritance graph
[legend]
Collaboration diagram for TAO::Any_Impl_T< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Any_Impl_T (_tao_destructor destructor, CORBA::TypeCode_ptr, T *const )
virtual ~Any_Impl_T (void)
virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const
virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const
virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const
virtual CORBA::Boolean marshal_value (TAO_OutputCDR &)
CORBA::Boolean demarshal_value (TAO_InputCDR &)
virtual void _tao_decode (TAO_InputCDR &)
virtual const void * value (void) const
virtual void free_value (void)

Static Public Member Functions

void insert (CORBA::Any &, _tao_destructor destructor, CORBA::TypeCode_ptr, T *const )
CORBA::Boolean extract (const CORBA::Any &, _tao_destructor, CORBA::TypeCode_ptr, T *&)

Private Attributes

T * value_

Detailed Description

template<typename T>
class TAO::Any_Impl_T< T >

Template Any class for pointer types.

Used for interfaces and typecodes

Definition at line 42 of file Any_Impl_T.h.


Constructor & Destructor Documentation

template<typename T>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::Any_Impl_T< T >::Any_Impl_T _tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
T *  const
 

Definition at line 23 of file Any_Impl_T.cpp.

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

template<typename T>
TAO::Any_Impl_T< T >::~Any_Impl_T void   )  [virtual]
 

Definition at line 33 of file Any_Impl_T.cpp.

00034 {
00035 }


Member Function Documentation

template<typename T>
void TAO::Any_Impl_T< T >::_tao_decode TAO_InputCDR  )  [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 180 of file Any_Impl_T.cpp.

References TAO::Any_Impl_T< T >::demarshal_value().

00181 {
00182   if (! this->demarshal_value (cdr))
00183     {
00184       throw ::CORBA::MARSHAL ();
00185     }
00186 }

template<typename T>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Boolean TAO::Any_Impl_T< T >::demarshal_value TAO_InputCDR  ) 
 

Definition at line 12 of file Any_Impl_T.inl.

Referenced by TAO::Any_Impl_T< T >::_tao_decode(), and TAO::Any_Impl_T< T >::extract().

00013 {
00014   return (cdr >> this->value_);
00015 }

template<typename T>
CORBA::Boolean TAO::Any_Impl_T< T >::extract const CORBA::Any ,
_tao_destructor  ,
CORBA::TypeCode_ptr  ,
T *& 
[static]
 

Definition at line 54 of file Any_Impl_T.cpp.

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

Referenced by operator>>=().

00058 {
00059   _tao_elem = 0;
00060 
00061   try
00062     {
00063       CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
00064       CORBA::Boolean const _tao_equiv = any_tc->equivalent (tc);
00065 
00066       if (_tao_equiv == 0)
00067         {
00068           return false;
00069         }
00070 
00071       TAO::Any_Impl * const impl = any.impl ();
00072 
00073       if (impl && !impl->encoded ())
00074         {
00075           TAO::Any_Impl_T<T> * const narrow_impl =
00076             dynamic_cast <TAO::Any_Impl_T<T> *> (impl);
00077 
00078           if (narrow_impl == 0)
00079             {
00080               return false;
00081             }
00082 
00083           _tao_elem = (T *) narrow_impl->value_;
00084           return true;
00085         }
00086 
00087       TAO::Any_Impl_T<T> *replacement = 0;
00088       ACE_NEW_RETURN (replacement,
00089                       TAO::Any_Impl_T<T> (destructor,
00090                                           any_tc,
00091                                           0),
00092                       false);
00093 
00094       auto_ptr<TAO::Any_Impl_T<T> > replacement_safety (replacement);
00095 
00096       // We know this will work since the unencoded case is covered above.
00097       TAO::Unknown_IDL_Type * const unk =
00098         dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
00099 
00100       if (!unk)
00101         return false;
00102 
00103       // We don't want the rd_ptr of unk to move, in case it is
00104       // shared by another Any. This copies the state, not the buffer.
00105       TAO_InputCDR for_reading (unk->_tao_get_cdr ());
00106 
00107       CORBA::Boolean const good_decode =
00108         replacement->demarshal_value (for_reading);
00109 
00110       if (good_decode)
00111         {
00112           _tao_elem = const_cast<T *> (replacement->value_);
00113           const_cast<CORBA::Any &> (any).replace (replacement);
00114           replacement_safety.release ();
00115           return true;
00116         }
00117 
00118       // Duplicated by Any_Impl base class constructor.
00119       ::CORBA::release (any_tc);
00120     }
00121   catch (const ::CORBA::Exception&)
00122     {
00123     }
00124 
00125   return false;
00126 }

template<typename T>
void TAO::Any_Impl_T< T >::free_value void   )  [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 166 of file Any_Impl_T.cpp.

00167 {
00168   if (this->value_destructor_ != 0)
00169     {
00170       (*this->value_destructor_) (this->value_);
00171       this->value_destructor_ = 0;
00172     }
00173 
00174   ::CORBA::release (this->type_);
00175   this->value_ = 0;
00176 }

template<typename T>
void TAO::Any_Impl_T< T >::insert CORBA::Any ,
_tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
T *  const
[static]
 

Definition at line 39 of file Any_Impl_T.cpp.

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

Referenced by operator<<=().

00043 {
00044   TAO::Any_Impl_T<T> *new_impl = 0;
00045   ACE_NEW (new_impl,
00046            TAO::Any_Impl_T<T> (destructor,
00047                                tc,
00048                                value));
00049   any.replace (new_impl);
00050 }

template<typename T>
CORBA::Boolean TAO::Any_Impl_T< T >::marshal_value TAO_OutputCDR  )  [virtual]
 

Implements TAO::Any_Impl.

Definition at line 152 of file Any_Impl_T.cpp.

00153 {
00154   return (cdr << this->value_);
00155 }

template<typename T>
CORBA::Boolean TAO::Any_Impl_T< T >::to_abstract_base CORBA::AbstractBase_ptr  )  const [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 145 of file Any_Impl_T.cpp.

00146 {
00147   return false;
00148 }

template<typename T>
CORBA::Boolean TAO::Any_Impl_T< T >::to_object CORBA::Object_ptr  )  const [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 130 of file Any_Impl_T.cpp.

00131 {
00132   return false;
00133 }

template<typename T>
CORBA::Boolean TAO::Any_Impl_T< T >::to_value CORBA::ValueBase *&   )  const [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 137 of file Any_Impl_T.cpp.

00138 {
00139   return false;
00140 }

template<typename T>
const void * TAO::Any_Impl_T< T >::value void   )  const [virtual]
 

Definition at line 159 of file Any_Impl_T.cpp.

00160 {
00161   return this->value_;
00162 }


Member Data Documentation

template<typename T>
T* TAO::Any_Impl_T< T >::value_ [private]
 

Definition at line 70 of file Any_Impl_T.h.

Referenced by TAO::Any_Impl_T< T >::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