diff options
author | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2012-02-29 16:55:18 +0000 |
---|---|---|
committer | sma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2012-02-29 16:55:18 +0000 |
commit | fdb2c99dcc82b15544bd050a22bf41f94e0c2902 (patch) | |
tree | 0f75240e920b19cc7fe4f444544ebcfa03e51392 /TAO/tao/AnyTypeCode | |
parent | d6dde55b9a8d9e54133561c0eff3451bb933ab1d (diff) | |
download | ATCD-fdb2c99dcc82b15544bd050a22bf41f94e0c2902.tar.gz |
ChangeLogTag: Wed Feb 29 16:36:300 UTC 2012 Simon Massey <simon dot massey at prismtech dot com>
Impliment DynValue, DynValueBox and DynValueCommon types
Diffstat (limited to 'TAO/tao/AnyTypeCode')
-rw-r--r-- | TAO/tao/AnyTypeCode/Any_Impl.cpp | 19 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/TypeCode.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/append.cpp | 66 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/skip.cpp | 47 |
5 files changed, 90 insertions, 65 deletions
diff --git a/TAO/tao/AnyTypeCode/Any_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Impl.cpp index 6bf1047c835..84e3e71903a 100644 --- a/TAO/tao/AnyTypeCode/Any_Impl.cpp +++ b/TAO/tao/AnyTypeCode/Any_Impl.cpp @@ -4,6 +4,7 @@ #include "tao/AnyTypeCode/Any_Impl.h" #include "tao/AnyTypeCode/TypeCode.h" #include "tao/AnyTypeCode/Marshal.h" +#include "tao/Valuetype/ValueBase.h" #include "tao/CORBA_String.h" #include "tao/SystemException.h" @@ -29,11 +30,27 @@ TAO::Any_Impl::~Any_Impl (void) CORBA::Boolean TAO::Any_Impl::marshal (TAO_OutputCDR &cdr) { - if ((cdr << this->type_) == 0) + CORBA::ValueBase * vb = 0; + if (this->to_value (vb) && vb) + { + // Since we ARE a value type, we need to + // send the ACTUAL derived typecode for + // the type we are marshaling NOT the + // typecode of the base pointer that may + // have been inserted into the any. + if (cdr << vb->_tao_type () == 0) + { + return false; + } + } + // Otherwise send the typecode of the inserted type. + else if ((cdr << this->type_) == 0) { return false; } + // Once the typecode has been marshaled send the actual + // value (this is polymorphic for valuetypes) return this->marshal_value (cdr); } diff --git a/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp index 00656c63098..f880ebde6cc 100644 --- a/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp +++ b/TAO/tao/AnyTypeCode/Any_Unknown_IDL_Type.cpp @@ -34,6 +34,13 @@ TAO::Unknown_IDL_Type::Unknown_IDL_Type (CORBA::TypeCode_ptr tc, } catch (::CORBA::Exception const &) { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) %N:%l ") + ACE_TEXT ("silent marshaling exception ") + ACE_TEXT ("in TAO::Unknown_IDL_Type::Unknown_IDL_Type\n"))); + } } } diff --git a/TAO/tao/AnyTypeCode/TypeCode.cpp b/TAO/tao/AnyTypeCode/TypeCode.cpp index c026a815d07..8733afe0e17 100644 --- a/TAO/tao/AnyTypeCode/TypeCode.cpp +++ b/TAO/tao/AnyTypeCode/TypeCode.cpp @@ -85,11 +85,9 @@ CORBA::TypeCode::equivalent (TypeCode_ptr tc) const const_cast<CORBA::TypeCode_ptr> (this); CORBA::TypeCode_var unaliased_this = TAO::unaliased_typecode (mutable_this); - CORBA::TypeCode_var unaliased_tc = TAO::unaliased_typecode (tc); CORBA::TCKind const this_kind = unaliased_this->kind (); - CORBA::TCKind const tc_kind = unaliased_tc->kind (); if (tc_kind != this_kind) @@ -98,17 +96,12 @@ CORBA::TypeCode::equivalent (TypeCode_ptr tc) const try { char const * const this_id = unaliased_this->id (); - char const * const tc_id = unaliased_tc->id (); - if (ACE_OS::strlen (this_id) == 0 - || ACE_OS::strlen (tc_id) == 0) - { - return unaliased_this->equivalent_i (unaliased_tc.in ()); - } - else if (ACE_OS::strcmp (this_id, tc_id) != 0) + if (ACE_OS::strlen (this_id) != 0 + && ACE_OS::strlen (tc_id) != 0) { - return false; + return ACE_OS::strcmp (this_id, tc_id) == 0; } } catch (const ::CORBA::TypeCode::BadKind&) @@ -116,10 +109,9 @@ CORBA::TypeCode::equivalent (TypeCode_ptr tc) const // Some TypeCodes do not support the id() operation. Ignore the // failure, and continue equivalence verification using TypeCode // subclass-specific techniques. - return unaliased_this->equivalent_i (unaliased_tc.in ()); } - return true; + return unaliased_this->equivalent_i (unaliased_tc.in ()); } char const * diff --git a/TAO/tao/AnyTypeCode/append.cpp b/TAO/tao/AnyTypeCode/append.cpp index 8aa760c8064..7bfc19d89e1 100644 --- a/TAO/tao/AnyTypeCode/append.cpp +++ b/TAO/tao/AnyTypeCode/append.cpp @@ -1178,41 +1178,47 @@ TAO_Marshal_Value::append (CORBA::TypeCode_ptr tc, } } - // Handle our base valuetype if any. - CORBA::TypeCode_var param = - tc->concrete_base_type (); - - CORBA::TCKind const param_kind = param->kind (); - - if (param_kind != CORBA::tk_null) + CORBA::TypeCode_var param; + if (CORBA::tk_value_box == tc->kind ()) { - retval = this->append (param.in (), - src, - dest - ); - - if (retval != TAO::TRAVERSE_CONTINUE) + param = tc->content_type (); + retval = TAO_Marshal_Object::perform_append (param.in (), + src, + dest + ); + } + else // tc->kind () must be tk_value or tk_event + { + // Handle our base valuetype if any. + param = tc->concrete_base_type (); + if (CORBA::tk_null != param->kind ()) { - return retval; + retval = this->append (param.in (), + src, + dest + ); } - } - // Number of fields in the struct. - const CORBA::ULong member_count = - tc->member_count (); - - for (CORBA::ULong i = 0; - i < member_count && retval == TAO::TRAVERSE_CONTINUE; - ++i) - { - // get member type - param = tc->member_type (i); + if (retval == TAO::TRAVERSE_CONTINUE) + { + // Number of fields in the struct. + const CORBA::ULong member_count = + tc->member_count (); - retval = - TAO_Marshal_Object::perform_append (param.in (), - src, - dest - ); + for (CORBA::ULong i = 0; + i < member_count && retval == TAO::TRAVERSE_CONTINUE; + ++i) + { + // get member type + param = tc->member_type (i); + + retval = + TAO_Marshal_Object::perform_append (param.in (), + src, + dest + ); + } + } } if (retval == TAO::TRAVERSE_CONTINUE) diff --git a/TAO/tao/AnyTypeCode/skip.cpp b/TAO/tao/AnyTypeCode/skip.cpp index 0741c2e62d5..f724a6fa75a 100644 --- a/TAO/tao/AnyTypeCode/skip.cpp +++ b/TAO/tao/AnyTypeCode/skip.cpp @@ -1,4 +1,3 @@ - //============================================================================= /** * @file skip.cpp @@ -851,7 +850,6 @@ TAO::traverse_status TAO_Marshal_Value::skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *stream) { TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE; - CORBA::TypeCode_var param; // Use the same method to skip over our base valuetype. // To achive this we'll need to distinguish between @@ -932,32 +930,37 @@ TAO_Marshal_Value::skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *stream) } - // Handle our base valuetype if any. - param = tc->concrete_base_type (); - - CORBA::TCKind const k = param->kind (); + CORBA::TypeCode_var param; - if (k != CORBA::tk_null) + if (CORBA::tk_value_box == tc->kind ()) { - retval = this->skip (param.in (), stream); - - if (retval != TAO::TRAVERSE_CONTINUE) + param = tc->content_type (); + retval = TAO_Marshal_Object::perform_skip (param.in (), stream); + } + else // tc->kind () must be tk_value or tk_event + { + // Handle our base valuetype if any. + param = tc->concrete_base_type (); + if (CORBA::tk_null != param->kind ()) { - return retval; + retval = this->skip (param.in (), stream); } - } - // Number of fields in the valuetype. - CORBA::ULong const member_count = - tc->member_count (); - - for (CORBA::ULong i = 0; - i < member_count && retval == TAO::TRAVERSE_CONTINUE; - ++i) - { - param = tc->member_type (i); + if (retval == TAO::TRAVERSE_CONTINUE) + { + // Number of fields in the valuetype. + CORBA::ULong const member_count = + tc->member_count (); - retval = TAO_Marshal_Object::perform_skip (param.in (), stream); + for (CORBA::ULong i = 0; + i < member_count && retval == TAO::TRAVERSE_CONTINUE; + ++i) + { + param = tc->member_type (i); + retval = TAO_Marshal_Object::perform_skip ( + param.in (), stream); + } + } } if (retval == TAO::TRAVERSE_CONTINUE) |