diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tao/AnyTypeCode/Any_Impl_T.cpp | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tao/AnyTypeCode/Any_Impl_T.cpp')
-rw-r--r-- | TAO/tao/AnyTypeCode/Any_Impl_T.cpp | 193 |
1 files changed, 0 insertions, 193 deletions
diff --git a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Impl_T.cpp deleted file mode 100644 index 4555bf32e9e..00000000000 --- a/TAO/tao/AnyTypeCode/Any_Impl_T.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// $Id$ - -#ifndef TAO_ANY_IMPL_T_CPP -#define TAO_ANY_IMPL_T_CPP - -#include "tao/AnyTypeCode/Any_Impl_T.h" -#include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h" -#include "tao/AnyTypeCode/Marshal.h" -#include "tao/CDR.h" -#include "tao/Environment.h" -#include "tao/SystemException.h" -#include "tao/AnyTypeCode/TypeCode.h" - -#include "ace/CORBA_macros.h" -#include "ace/Auto_Ptr.h" -#include "ace/OS_Memory.h" - -#if !defined (__ACE_INLINE__) -# include "tao/AnyTypeCode/Any_Impl_T.inl" -#endif /* ! __ACE_INLINE__ */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template<typename T> -TAO::Any_Impl_T<T>::Any_Impl_T (_tao_destructor destructor, - CORBA::TypeCode_ptr tc, - T * const val) - : Any_Impl (destructor, - tc), - value_ (val) -{ -} - -template<typename T> -TAO::Any_Impl_T<T>::~Any_Impl_T (void) -{ -} - -template<typename T> -void -TAO::Any_Impl_T<T>::insert (CORBA::Any & any, - _tao_destructor destructor, - CORBA::TypeCode_ptr tc, - T * const value) -{ - TAO::Any_Impl_T<T> *new_impl = 0; - ACE_NEW (new_impl, - TAO::Any_Impl_T<T> (destructor, - tc, - value)); - any.replace (new_impl); -} - -template<typename T> -CORBA::Boolean -TAO::Any_Impl_T<T>::extract (const CORBA::Any & any, - _tao_destructor destructor, - CORBA::TypeCode_ptr tc, - T *& _tao_elem) -{ - _tao_elem = 0; - - ACE_TRY_NEW_ENV - { - CORBA::TypeCode_ptr any_tc = any._tao_get_typecode (); - CORBA::Boolean _tao_equiv = any_tc->equivalent (tc - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (_tao_equiv == 0) - { - return false; - } - - TAO::Any_Impl *impl = any.impl (); - - if (!impl->encoded ()) - { - TAO::Any_Impl_T<T> *narrow_impl = - dynamic_cast <TAO::Any_Impl_T<T> *> (impl); - - if (narrow_impl == 0) - { - return false; - } - - _tao_elem = (T *) narrow_impl->value_; - return true; - } - - TAO::Any_Impl_T<T> *replacement = 0; - ACE_NEW_RETURN (replacement, - TAO::Any_Impl_T<T> (destructor, - any_tc, - 0), - false); - - auto_ptr<TAO::Any_Impl_T<T> > replacement_safety (replacement); - - // We know this will work since the unencoded case is covered above. - TAO::Unknown_IDL_Type *unk = - dynamic_cast<TAO::Unknown_IDL_Type *> (impl); - - // We don't want the rd_ptr of unk to move, in case it is - // shared by another Any. This copies the state, not the buffer. - TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - - CORBA::Boolean const good_decode = - replacement->demarshal_value (for_reading); - - if (good_decode) - { - _tao_elem = const_cast<T *> (replacement->value_); - const_cast<CORBA::Any &> (any).replace (replacement); - replacement_safety.release (); - return true; - } - - // Duplicated by Any_Impl base class constructor. - ::CORBA::release (any_tc); - } - ACE_CATCHANY - { - } - ACE_ENDTRY; - - return 0; -} - -template<typename T> -CORBA::Boolean -TAO::Any_Impl_T<T>::to_object (CORBA::Object_ptr &) const -{ - return 0; -} - -template<typename T> -CORBA::Boolean -TAO::Any_Impl_T<T>::to_value (CORBA::ValueBase *&) const -{ - return 0; -} - -template<typename T> - -CORBA::Boolean -TAO::Any_Impl_T<T>::to_abstract_base (CORBA::AbstractBase_ptr &) const -{ - return 0; -} - -template<typename T> -CORBA::Boolean -TAO::Any_Impl_T<T>::marshal_value (TAO_OutputCDR &cdr) -{ - return (cdr << this->value_); -} - -template<typename T> -const void * -TAO::Any_Impl_T<T>::value (void) const -{ - return this->value_; -} - -template<typename T> -void -TAO::Any_Impl_T<T>::free_value (void) -{ - if (this->value_destructor_ != 0) - { - (*this->value_destructor_) (this->value_); - this->value_destructor_ = 0; - } - - ::CORBA::release (this->type_); - this->value_ = 0; -} - -template<typename T> -void -TAO::Any_Impl_T<T>::_tao_decode (TAO_InputCDR &cdr - ACE_ENV_ARG_DECL) -{ - if (! this->demarshal_value (cdr)) - { - ACE_THROW (CORBA::MARSHAL ()); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* TAO_ANY_IMPL_T_CPP */ |