diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-03-23 06:11:41 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-03-23 06:11:41 +0000 |
commit | 858fa3a3285c01f0542dda4e3724148a85efcd3a (patch) | |
tree | 5dc23044fe48cff0a2b5903adf9c0f581c5eb133 | |
parent | b28d593b42994ed91f4a174d79d3ce63040cbccb (diff) | |
download | ATCD-858fa3a3285c01f0542dda4e3724148a85efcd3a.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/Any.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/Any_Basic_Impl.cpp | 18 | ||||
-rw-r--r-- | TAO/tao/Any_Special_Impl_T.cpp | 55 | ||||
-rw-r--r-- | TAO/tao/Exception.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/SystemException.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/TypeCode.cpp | 24 | ||||
-rw-r--r-- | TAO/tao/TypeCode.h | 24 | ||||
-rw-r--r-- | TAO/tao/TypeCode.inl | 19 | ||||
-rw-r--r-- | TAO/tao/TypeCode_Constants.cpp | 7 |
9 files changed, 100 insertions, 52 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index c03ca659381..f15847a3a74 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -8,6 +8,7 @@ #include "tao/Any_Unknown_IDL_Type.h" #include "tao/Object.h" #include "tao/TypeCode.h" +#include "tao/TypeCode_Constants.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" diff --git a/TAO/tao/Any_Basic_Impl.cpp b/TAO/tao/Any_Basic_Impl.cpp index 040fb1b2fbc..359f157a181 100644 --- a/TAO/tao/Any_Basic_Impl.cpp +++ b/TAO/tao/Any_Basic_Impl.cpp @@ -18,8 +18,15 @@ namespace TAO Any_Basic_Impl::Any_Basic_Impl (CORBA::TypeCode_ptr tc, void *value) : Any_Impl (0, tc), - kind_ (tc ? tc->kind_ : CORBA::tk_null) + kind_ (CORBA::tk_null) { + if (!CORBA::is_nil (tc)) + { + ACE_DECLARE_NEW_CORBA_ENV; + this->kind_ = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + CORBA::TCKind const tckind = static_cast<CORBA::TCKind> (this->kind_); switch (tckind) @@ -138,8 +145,8 @@ namespace TAO // aliased type if there are any. Passing the aliased kind // will not help. CORBA::TCKind tck = - tc->kind (); - + tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; CORBA::Boolean result = replacement->demarshal_value (cdr, @@ -262,7 +269,10 @@ namespace TAO Any_Basic_Impl * Any_Basic_Impl::create_empty (CORBA::TypeCode_ptr tc) { - CORBA::TCKind const kind = static_cast<CORBA::TCKind> (tc->kind_); + ACE_DECLARE_NEW_CORBA_ENV; + CORBA::TCKind const kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + TAO::Any_Basic_Impl * retval = 0; switch (kind) diff --git a/TAO/tao/Any_Special_Impl_T.cpp b/TAO/tao/Any_Special_Impl_T.cpp index eae91610033..919294c022b 100644 --- a/TAO/tao/Any_Special_Impl_T.cpp +++ b/TAO/tao/Any_Special_Impl_T.cpp @@ -47,36 +47,36 @@ TAO::Any_Special_Impl_T<T, from_T, to_T>::insert (CORBA::Any & any, CORBA::ULong bound ) { - CORBA::TypeCode_ptr bounded_tc = CORBA::TypeCode::_nil (); - - if (bound > 0) - { - CORBA::TCKind kind = static_cast<CORBA::TCKind> (tc->kind_); - static CORBA::Long _oc_buffer [] = - { - TAO_ENCAP_BYTE_ORDER, - static_cast<CORBA::Long> (bound) - }; - - ACE_NEW (bounded_tc, - CORBA::TypeCode (kind, - sizeof _oc_buffer, - (char *) &_oc_buffer, - 1, - 0)); - } - else - { - bounded_tc = CORBA::TypeCode::_duplicate (tc); - } - - Any_Special_Impl_T<T, from_T, to_T> *new_impl = 0; +// CORBA::TypeCode_ptr bounded_tc = CORBA::TypeCode::_nil (); + +// if (bound > 0) +// { +// CORBA::TCKind kind = static_cast<CORBA::TCKind> (tc->kind_); +// static CORBA::Long _oc_buffer [] = +// { +// TAO_ENCAP_BYTE_ORDER, +// static_cast<CORBA::Long> (bound) +// }; + +// ACE_NEW (bounded_tc, +// CORBA::TypeCode (kind, +// sizeof _oc_buffer, +// (char *) &_oc_buffer, +// 1, +// 0)); +// } +// else +// { +// bounded_tc = CORBA::TypeCode::_duplicate (tc); +// } + + Any_Special_Impl_T<T, from_T, to_T> * new_impl = 0; ACE_NEW (new_impl, Any_Special_Impl_T (destructor, - bounded_tc, + /* bounded_ */ tc, value, bound)); - CORBA::release (bounded_tc); +// CORBA::release (bounded_tc); any.replace (new_impl); } @@ -95,7 +95,8 @@ TAO::Any_Special_Impl_T<T, from_T, to_T>::extract (const CORBA::Any & any, { CORBA::TypeCode_ptr any_type = any._tao_get_typecode (); CORBA::TypeCode_var unaliased_any_type = - any_type->unalias (ACE_ENV_SINGLE_ARG_PARAMETER); + TAO::unaliased_typecode (any_type + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; CORBA::TCKind any_kind = diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index 0f74b45b642..92e4d7df62e 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -7,7 +7,7 @@ #include "Any_Dual_Impl_T.h" #include "TypeCode.h" #include "ORB_Constants.h" -#include "TC_Constants_Forward.h" +#include "TypeCode_Constants.h" #include "CORBA_String.h" #include "CDR.h" #include "debug.h" diff --git a/TAO/tao/SystemException.cpp b/TAO/tao/SystemException.cpp index 20f9ad7bd06..d5c33d214fd 100644 --- a/TAO/tao/SystemException.cpp +++ b/TAO/tao/SystemException.cpp @@ -6,7 +6,7 @@ #include "Any_Dual_Impl_T.h" #include "TypeCode.h" #include "ORB_Constants.h" -#include "TC_Constants_Forward.h" +#include "TypeCode_Constants.h" #include "CORBA_String.h" #include "CDR.h" #include "debug.h" diff --git a/TAO/tao/TypeCode.cpp b/TAO/tao/TypeCode.cpp index 65c7f503321..b14f44b0543 100644 --- a/TAO/tao/TypeCode.cpp +++ b/TAO/tao/TypeCode.cpp @@ -185,40 +185,38 @@ TAO::operator<< (TAO_OutputCDR & cdr, return (cdr << kind) && tc->tao_marshal (cdr); } -CORBA::TCKind -TAO::unaliased_kind (CORBA::TypeCode_ptr tc - ACE_ENV_ARG_DECL) +CORBA::TypeCode_ptr +TAO::unaliased_typecode (CORBA::TypeCode_ptr tc + ACE_ENV_ARG_DECL) { - CORBA::TCKind tc_kind = 0; - if (CORBA::is_nil (tc)) { ACE_THROW_RETURN (CORBA::BAD_PARAM (CORBA::OMGVMCID | 13, CORBA::COMPLETED_NO), - tc_kind); + tc); } - tc_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TCKind tc_kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (tc_kind); if (tc_kind == CORBA::tk_alias) { - CORBA::TypeCode_var tc_content = - tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (tc_kind); + CORBA::TypeCode_var tc_content; // Iterate until we get to the actual unaliased type. do { tc_content = tc_content->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (tc_kind); + ACE_CHECK_RETURN (tc); tc_kind = tc_content->kind (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (tc_kind); + ACE_CHECK_RETURN (tc); } while (tc_kind == CORBA::tk_alias); + + return tc_content._retn (); } - return tc_kind; + return CORBA::TypeCode::_duplicate (tc); } diff --git a/TAO/tao/TypeCode.h b/TAO/tao/TypeCode.h index 2f1a9007368..b13b7c3b625 100644 --- a/TAO/tao/TypeCode.h +++ b/TAO/tao/TypeCode.h @@ -28,10 +28,14 @@ #include "tao/UserException.h" #include "tao/Basic_Types.h" #include "tao/OBV_Constants.h" - +#include "tao/CORBA_methods.h" +#include "tao/Pseudo_VarOut_T.h" namespace CORBA { + typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var; + typedef TAO_Pseudo_Out_T<TypeCode, TypeCode_var> TypeCode_out; + /** * @enum TCKind @@ -93,7 +97,7 @@ namespace CORBA // dispatch based on TCKind values, and lets many important ones // just be table lookups. It must always be the last enum value!! - TC_KIND_COUNT + TAO_TC_KIND_COUNT }; typedef TCKind & TCKind_out; @@ -463,6 +467,9 @@ namespace CORBA /// Decrease the reference count on this object. virtual void tao_release (void) = 0; + /// Destruction callback for Anys. + static void CORBA::TypeCode::_tao_any_destructor (void * x); + protected: /// Constructor. @@ -531,10 +538,23 @@ namespace TAO { extern TAO_Export bool operator<< (TAO_OutputCDR & cdr, CORBA::TypeCode const * x); + extern TAO_Export bool operator>> (TAO_InputCDR& cdr, + CORBA::TypeCode *&x); + + /// Return the unaliased content @c TypeCode of the given + /// @c TypeCode. + CORBA::TypeCode_ptr unaliased_typecode (CORBA::TypeCode_ptr tc + ACE_ENV_ARG_DECL); /// Return the unaliased @c TCKind of the given @c TypeCode. + /** + * @note This is a convenience function that simply calls @c kind() + * on the unaliased @c TypeCode returned from + * @c unaliased_typecode(). + */ CORBA::TCKind unaliased_kind (CORBA::TypeCode_ptr tc ACE_ENV_ARG_DECL); + } diff --git a/TAO/tao/TypeCode.inl b/TAO/tao/TypeCode.inl index 47c3b9eff41..dbeb41eaf1a 100644 --- a/TAO/tao/TypeCode.inl +++ b/TAO/tao/TypeCode.inl @@ -4,6 +4,7 @@ #include "tao/CORBA_methods.h" +#include "tao/Environment.h" ACE_INLINE CORBA::Boolean @@ -161,3 +162,21 @@ CORBA::TypeCode::concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const { return this->concrete_base_type_i (ACE_ENV_SINGLE_ARG_PARAMETER); } + +ACE_INLINE void +CORBA::TypeCode::_tao_any_destructor (void * x) +{ + CORBA::release (static_cast <CORBA::TypeCode_ptr> (x)); +} + +// -------------------------------------------------------------- + +ACE_INLINE CORBA::TCKind +TAO::unaliased_kind (CORBA::TypeCode_ptr tc + ACE_ENV_ARG_DECL) +{ + CORBA::TypeCode_var unaliased_tc = + TAO::unaliased_typecode (tc + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::TAO_TC_KIND_COUNT); +} diff --git a/TAO/tao/TypeCode_Constants.cpp b/TAO/tao/TypeCode_Constants.cpp index 04b85e2e98b..8c66f67a7f7 100644 --- a/TAO/tao/TypeCode_Constants.cpp +++ b/TAO/tao/TypeCode_Constants.cpp @@ -1,21 +1,20 @@ // $Id$ -//#include "TypeCode_Constants.h" -#include "Null_RefCount_Policy.h" +#include "TypeCode_Constants.h" + ACE_RCSID (tao, TypeCode_Constants, "$Id$") - +#include "Null_RefCount_Policy.h" #include "Empty_Param_TypeCode.h" #include "Objref_TypeCode.h" #include "String_TypeCode.h" #include "Value_TypeCode.h" -#include "tao/TC_Constants_Forward.h" namespace TAO { |