TAO::Any_Array_Impl_T< T_slice, T_forany > Class Template Reference

Template Any class for array types. More...

#include <Any_Array_Impl_T.h>

Inheritance diagram for TAO::Any_Array_Impl_T< T_slice, T_forany >:

Inheritance graph
[legend]
Collaboration diagram for TAO::Any_Array_Impl_T< T_slice, T_forany >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Any_Array_Impl_T (_tao_destructor destructor, CORBA::TypeCode_ptr, T_slice *const )
virtual ~Any_Array_Impl_T (void)
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_slice *const )
CORBA::Boolean extract (const CORBA::Any &, _tao_destructor, CORBA::TypeCode_ptr, T_slice *&)

Private Attributes

T_slice * value_

Detailed Description

template<typename T_slice, typename T_forany>
class TAO::Any_Array_Impl_T< T_slice, T_forany >

Template Any class for array types.

Used for arrays

Definition at line 37 of file Any_Array_Impl_T.h.


Constructor & Destructor Documentation

template<typename T_slice, typename T_forany>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::Any_Array_Impl_T< T_slice, T_forany >::Any_Array_Impl_T _tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
T_slice *  const
 

Definition at line 23 of file Any_Array_Impl_T.cpp.

00028   : Any_Impl (destructor,
00029               tc),
00030     value_ (val)
00031 {
00032 }

template<typename T_slice, typename T_forany>
TAO::Any_Array_Impl_T< T_slice, T_forany >::~Any_Array_Impl_T void   )  [virtual]
 

Definition at line 35 of file Any_Array_Impl_T.cpp.

00036 {
00037 }


Member Function Documentation

template<typename T_slice, typename T_forany>
void TAO::Any_Array_Impl_T< T_slice, T_forany >::_tao_decode TAO_InputCDR  )  [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 164 of file Any_Array_Impl_T.cpp.

References TAO::Any_Array_Impl_T< T_slice, T_forany >::demarshal_value().

00166 {
00167   if (! this->demarshal_value (cdr))
00168     {
00169       throw ::CORBA::MARSHAL ();
00170     }
00171 }

template<typename T_slice, typename T_forany>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::demarshal_value TAO_InputCDR  ) 
 

Definition at line 10 of file Any_Array_Impl_T.inl.

Referenced by TAO::Any_Array_Impl_T< T_slice, T_forany >::_tao_decode(), and TAO::Any_Array_Impl_T< T_slice, T_forany >::extract().

00011 {
00012   T_forany tmp (this->value_);
00013   return (cdr >> tmp);
00014 }

template<typename T_slice, typename T_forany>
CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::extract const CORBA::Any ,
_tao_destructor  ,
CORBA::TypeCode_ptr  ,
T_slice *& 
[static]
 

Definition at line 57 of file Any_Array_Impl_T.cpp.

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

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

template<typename T_slice, typename T_forany>
void TAO::Any_Array_Impl_T< T_slice, T_forany >::free_value void   )  [virtual]
 

Reimplemented from TAO::Any_Impl.

Definition at line 150 of file Any_Array_Impl_T.cpp.

00151 {
00152   if (this->value_destructor_ != 0)
00153     {
00154       (*this->value_destructor_) (this->value_);
00155       this->value_destructor_ = 0;
00156     }
00157 
00158   this->value_ = 0;
00159   ::CORBA::release (this->type_);
00160 }

template<typename T_slice, typename T_forany>
void TAO::Any_Array_Impl_T< T_slice, T_forany >::insert CORBA::Any ,
_tao_destructor  destructor,
CORBA::TypeCode_ptr  ,
T_slice *  const
[static]
 

Definition at line 41 of file Any_Array_Impl_T.cpp.

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

00045 {
00046   TAO::Any_Array_Impl_T<T_slice, T_forany> *new_impl = 0;
00047   typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
00048   ACE_NEW (new_impl,
00049            ARRAY_ANY_IMPL (destructor,
00050                            tc,
00051                            value));
00052   any.replace (new_impl);
00053 }

template<typename T_slice, typename T_forany>
CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::marshal_value TAO_OutputCDR  )  [virtual]
 

Implements TAO::Any_Impl.

Definition at line 136 of file Any_Array_Impl_T.cpp.

00137 {
00138   return (cdr << T_forany (this->value_));
00139 }

template<typename T_slice, typename T_forany>
const void * TAO::Any_Array_Impl_T< T_slice, T_forany >::value void   )  const [virtual]
 

Definition at line 143 of file Any_Array_Impl_T.cpp.

00144 {
00145   return this->value_;
00146 }


Member Data Documentation

template<typename T_slice, typename T_forany>
T_slice* TAO::Any_Array_Impl_T< T_slice, T_forany >::value_ [private]
 

Definition at line 63 of file Any_Array_Impl_T.h.

Referenced by TAO::Any_Array_Impl_T< T_slice, T_forany >::extract().


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