diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2006-04-25 17:53:53 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2006-04-25 17:53:53 +0000 |
commit | 005fb3e9d8a929923e206ae48bd4b49bd8f0f612 (patch) | |
tree | 695add741bd28ce418e8b6ad67a85e7a7eb832ec /TAO/tao | |
parent | 9ab44a8fe858347eaf8b27436f2ae57cd92f13cb (diff) | |
download | ATCD-005fb3e9d8a929923e206ae48bd4b49bd8f0f612.tar.gz |
ChangeLog tag: Tue Apr 25 17:38:34 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Messaging/ExceptionHolderC.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/Messaging/ExceptionHolderC.h | 1 | ||||
-rw-r--r-- | TAO/tao/ObjRefTemplate/Default_ORTC.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/ObjRefTemplate/Default_ORTC.h | 1 | ||||
-rw-r--r-- | TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.h | 1 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase.h | 1 | ||||
-rw-r--r-- | TAO/tao/Valuetype/StringValueC.h | 2 | ||||
-rw-r--r-- | TAO/tao/Valuetype/StringValueC.inl | 15 | ||||
-rw-r--r-- | TAO/tao/Valuetype/ValueBase.cpp | 113 | ||||
-rw-r--r-- | TAO/tao/Valuetype/ValueBase.h | 14 |
12 files changed, 131 insertions, 55 deletions
diff --git a/TAO/tao/Messaging/ExceptionHolderC.cpp b/TAO/tao/Messaging/ExceptionHolderC.cpp index 7f4f71d6624..3c9396ae7da 100644 --- a/TAO/tao/Messaging/ExceptionHolderC.cpp +++ b/TAO/tao/Messaging/ExceptionHolderC.cpp @@ -106,17 +106,27 @@ Messaging::ExceptionHolder::_tao_any_destructor (void *_tao_void_pointer) Messaging::ExceptionHolder::~ExceptionHolder (void) {} -::CORBA::Boolean Messaging::ExceptionHolder::_tao_marshal_v (TAO_OutputCDR & strm) const +::CORBA::Boolean +Messaging::ExceptionHolder::_tao_marshal_v (TAO_OutputCDR & strm) const { return this->_tao_marshal__Messaging_ExceptionHolder (strm); } -::CORBA::Boolean Messaging::ExceptionHolder::_tao_unmarshal_v (TAO_InputCDR & strm) +::CORBA::Boolean +Messaging::ExceptionHolder::_tao_unmarshal_v (TAO_InputCDR & strm) { return this->_tao_unmarshal__Messaging_ExceptionHolder (strm); } -::CORBA::Boolean Messaging::ExceptionHolder::_tao_unmarshal ( +::CORBA::Boolean +Messaging::ExceptionHolder::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return formal_type_id == + reinterpret_cast<ptrdiff_t>(&Messaging::ExceptionHolder::_downcast); +} + +::CORBA::Boolean +Messaging::ExceptionHolder::_tao_unmarshal ( TAO_InputCDR &strm, ExceptionHolder *&new_object ) diff --git a/TAO/tao/Messaging/ExceptionHolderC.h b/TAO/tao/Messaging/ExceptionHolderC.h index 13f9e99fcbf..786cfe5dc1e 100644 --- a/TAO/tao/Messaging/ExceptionHolderC.h +++ b/TAO/tao/Messaging/ExceptionHolderC.h @@ -162,6 +162,7 @@ namespace Messaging virtual ::CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const; virtual ::CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &); + virtual ::CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; private: ExceptionHolder (const ExceptionHolder &); diff --git a/TAO/tao/ObjRefTemplate/Default_ORTC.cpp b/TAO/tao/ObjRefTemplate/Default_ORTC.cpp index 3f6aea58e32..ef7dde2671c 100644 --- a/TAO/tao/ObjRefTemplate/Default_ORTC.cpp +++ b/TAO/tao/ObjRefTemplate/Default_ORTC.cpp @@ -118,6 +118,12 @@ CORBA::Boolean TAO_Default_ORT::ObjectReferenceTemplate::_tao_unmarshal_v (TAO_I return this->_tao_unmarshal__TAO_Default_ORT_ObjectReferenceTemplate (strm); } +CORBA::Boolean TAO_Default_ORT::ObjectReferenceTemplate::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return formal_type_id == + reinterpret_cast<ptrdiff_t>(&TAO_Default_ORT::ObjectReferenceTemplate::_downcast); +} + CORBA::Boolean TAO_Default_ORT::ObjectReferenceTemplate::_tao_unmarshal ( TAO_InputCDR &strm, ObjectReferenceTemplate *&new_object diff --git a/TAO/tao/ObjRefTemplate/Default_ORTC.h b/TAO/tao/ObjRefTemplate/Default_ORTC.h index 0500d24c41e..aaa7789cdda 100644 --- a/TAO/tao/ObjRefTemplate/Default_ORTC.h +++ b/TAO/tao/ObjRefTemplate/Default_ORTC.h @@ -133,6 +133,7 @@ namespace TAO_Default_ORT virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const; virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &); + virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; private: ObjectReferenceTemplate (const ObjectReferenceTemplate &); diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.cpp b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.cpp index 9dffb88e09d..8672196c8f2 100644 --- a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.cpp +++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.cpp @@ -134,7 +134,8 @@ PortableInterceptor::ObjectReferenceFactory::_tao_any_destructor (void *_tao_voi PortableInterceptor::ObjectReferenceFactory::~ObjectReferenceFactory (void) {} -CORBA::Boolean PortableInterceptor::ObjectReferenceFactory::_tao_unmarshal ( +CORBA::Boolean +PortableInterceptor::ObjectReferenceFactory::_tao_unmarshal ( TAO_InputCDR &strm, ObjectReferenceFactory *&new_object ) @@ -240,6 +241,13 @@ CORBA::Boolean PortableInterceptor::ObjectReferenceTemplate::_tao_unmarshal ( return 1; } +CORBA::Boolean +PortableInterceptor::ObjectReferenceFactory::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return formal_type_id == + reinterpret_cast<ptrdiff_t>(&PortableInterceptor::ObjectReferenceFactory::_downcast); +} + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 diff --git a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.h b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.h index 3e134c09da0..ed453afe5c0 100644 --- a/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.h +++ b/TAO/tao/ObjRefTemplate/ObjectReferenceTemplateC.h @@ -147,6 +147,7 @@ namespace PortableInterceptor virtual ~ObjectReferenceFactory (void); + virtual CORBA::Boolean _tao_match_formal_type(ptrdiff_t ) const; private: ObjectReferenceFactory (const ObjectReferenceFactory &); diff --git a/TAO/tao/Valuetype/AbstractBase.cpp b/TAO/tao/Valuetype/AbstractBase.cpp index ab05661f649..fe11b167e7b 100644 --- a/TAO/tao/Valuetype/AbstractBase.cpp +++ b/TAO/tao/Valuetype/AbstractBase.cpp @@ -400,6 +400,12 @@ CORBA::AbstractBase::_tao_unmarshal_v (TAO_InputCDR &) return false; } +CORBA::Boolean +CORBA::AbstractBase::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return 0; +} + CORBA::ValueBase * CORBA::AbstractBase::_tao_to_value (void) { diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h index 52439e45f4c..742716b2a2f 100644 --- a/TAO/tao/Valuetype/AbstractBase.h +++ b/TAO/tao/Valuetype/AbstractBase.h @@ -91,6 +91,7 @@ namespace CORBA virtual const char* _tao_obv_repository_id (void) const; virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &strm); virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &strm); + virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; /// Memmory management operations virtual void _add_ref (void); diff --git a/TAO/tao/Valuetype/StringValueC.h b/TAO/tao/Valuetype/StringValueC.h index a4187429878..fa8d1e68cab 100644 --- a/TAO/tao/Valuetype/StringValueC.h +++ b/TAO/tao/Valuetype/StringValueC.h @@ -156,6 +156,7 @@ namespace CORBA virtual ~StringValue (void); virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const; virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &); + virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; private: void operator= (const StringValue & val); @@ -254,6 +255,7 @@ namespace CORBA virtual ~WStringValue (void); virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const; virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &); + virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; private: void operator= (const WStringValue & val); diff --git a/TAO/tao/Valuetype/StringValueC.inl b/TAO/tao/Valuetype/StringValueC.inl index 04fc7a36098..a7b1df82545 100644 --- a/TAO/tao/Valuetype/StringValueC.inl +++ b/TAO/tao/Valuetype/StringValueC.inl @@ -142,8 +142,6 @@ CORBA::StringValue::_tao_marshal_v (TAO_OutputCDR & strm) const return (strm << this->_pd_value); } - - // TAO_IDL - Generated from // c:\projects\ace_cvs\ace_wrappers\tao\tao_idl\be\be_visitor_valuebox/valuebox_ci.cpp:60 ACE_INLINE const char* @@ -158,7 +156,12 @@ CORBA::StringValue::_tao_unmarshal_v (TAO_InputCDR & ) return 1; } - +ACE_INLINE CORBA::Boolean +CORBA::StringValue::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return formal_type_id == + reinterpret_cast<ptrdiff_t> (&CORBA::StringValue::_downcast); +} // TAO_IDL - Generated from // c:\projects\ace_cvs\ace_wrappers\tao\tao_idl\be\be_visitor_valuebox/valuebox_ci.cpp:332 @@ -290,5 +293,11 @@ CORBA::WStringValue::_tao_unmarshal_v (TAO_InputCDR & ) return 1; } +ACE_INLINE CORBA::Boolean +CORBA::WStringValue::_tao_match_formal_type (ptrdiff_t formal_type_id) const +{ + return formal_type_id == + reinterpret_cast<ptrdiff_t> (&CORBA::WStringValue::_downcast); +} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp index d6f9c729085..576f261f667 100644 --- a/TAO/tao/Valuetype/ValueBase.cpp +++ b/TAO/tao/Valuetype/ValueBase.cpp @@ -142,11 +142,11 @@ CORBA::ValueBase::_tao_any_destructor (void *x) CORBA::Boolean CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm, const CORBA::ValueBase *this_, - ptrdiff_t /*formal_type_id*/) + ptrdiff_t formal_type_id) { if ( ! write_special_value (strm, this_)) { - return write_value (strm, this_); + return write_value (strm, this_, formal_type_id); } return true; @@ -199,7 +199,7 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, const char * const repo_id) { CORBA::ValueFactory factory = 0; - ACE_UNUSED_ARG (repo_id); + // %! yet much to do ... look for +++ ! // 1. Get the <value-tag> (else it may be <indirection-tag> or <null-ref>). @@ -231,6 +231,9 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, if (TAO_OBV_GIOP_Flags::is_indirection_tag (valuetag)) { //@@TODO: read indirection value. + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO does not currently support valuetype indirecton\n"))); return false; } else if (TAO_OBV_GIOP_Flags::is_null_ref (valuetag)) @@ -239,27 +242,29 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, valuetype = 0; return true; } - else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag)) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("missing value type information or unknown value tag: %x\n"), - valuetag), - false); - } else if (TAO_OBV_GIOP_Flags::has_single_type_info (valuetag)) - { - ACE_CString id; - if (! strm.read_string(id)) - return false; - ids.push_back (id); - } + { + ACE_CString id; + if (! strm.read_string(id)) + return false; + ids.push_back (id); + } else if (TAO_OBV_GIOP_Flags::has_list_type_info (valuetag)) - { - if (! read_repository_ids(strm, ids)) - return false; - } + { + if (! read_repository_ids(strm, ids)) + return false; + } + else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag)) + { + ids.push_back (repo_id); + } else - return false; + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) unknown value tag: %x\n"), valuetag)); + return false; + } TAO_ORB_Core *orb_core = strm.orb_core (); @@ -275,8 +280,8 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, } } - CORBA::Boolean chunking = TAO_OBV_GIOP_Flags::is_chunked (valuetag); CORBA::Boolean require_truncation = false; + CORBA::Boolean chunking = TAO_OBV_GIOP_Flags::is_chunked (valuetag); CORBA::ULong num_ids = ids.size (); // Find the registered factory for this unmarshalling valuetype. If any @@ -300,7 +305,7 @@ CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%N:%l) OBV factory is null !!!\n"))); + ACE_TEXT ("TAO (%P|%t) OBV factory is null, id = %s\n"), repo_id)); } return false; } @@ -439,9 +444,11 @@ CORBA::ValueBase::write_special_value(TAO_OutputCDR &strm, CORBA::Boolean -CORBA::ValueBase::write_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value) +CORBA::ValueBase::write_value(TAO_OutputCDR &strm, + const CORBA::ValueBase * value, + ptrdiff_t formal_type_id) { - if (! value->write_value_header (strm)) + if (! value->write_value_header (strm, formal_type_id)) return false; if (! value->_tao_marshal_v (strm)) @@ -452,13 +459,30 @@ CORBA::ValueBase::write_value(TAO_OutputCDR &strm, const CORBA::ValueBase * valu CORBA::Boolean -CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm) const -{ - //TODO: The list of repo ids may only be necessary if the formal_type_id - // is unequal to the 'true derived' type of this object. - // In the future only write the repo ids if necessary. - // This would require knowing the formal parameter type. - // See section 15.3.4.2 of the CORBA spec. +CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm, + ptrdiff_t formal_type_id) const +{ +#if defined (TAO_HAS_OPTIMIMIZED_VALUETYPE_MARSHALING) + // this case allows TAO to avoid marshaling the typeID for values + // where the actual type matches the formal type (ie not a derived + // type). + // + // I would much prefer that there be a way to have a -ORB option to + // control this behavior, but for now there is no reference to the + // ORB Core available during marshaling (there is during unmarshaling) + // and no other way to communicate such configuration values. + + CORBA::Boolean is_formal_type = + this->_tao_match_formal_type (formal_type_id); +#else + // Unfortunately, all versions of tao prior to TAO 1.5.2 did not + // support unmarshaling of valuetypes that did not explicitly + // marshal the type id. At least it is benign to always encode the + // typecode value, even if it can be a little verbose. + CORBA::Boolean is_formal_type = + false; + ACE_UNUSED_ARG (formal_type_id); +#endif /* TAO_HAS_OPTIMIMIZED_VALUETYPE_MARSHALING */ // Get the list of repository ids for this valuetype. Repository_Id_List repository_ids; @@ -476,32 +500,31 @@ CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm) const if (this->is_truncatable_ || this->chunking_) valuetag |= TAO_OBV_GIOP_Flags::Chunking_tag_sigbits; - if (num_ids == 1) - { + if (!is_formal_type || this->is_truncatable_) valuetag |= TAO_OBV_GIOP_Flags::Type_info_single; + + if (num_ids > 1) + valuetag |= TAO_OBV_GIOP_Flags::Type_info_list; + // Write <value-tag>. if (! strm.write_long (valuetag)) { return false; } - } - else - { - valuetag |= TAO_OBV_GIOP_Flags::Type_info_list; - // Write <value-tag> and number of repository ids. - if (! strm.write_long (valuetag) - || ! strm.write_long (num_ids)) - { + + if (num_ids > 1 && !strm.write_long (num_ids)) return false; - } - } + if (this->is_truncatable_ || + !is_formal_type || + num_ids > 1) + { // Marshal type information. - for( CORBA::Long i = 0; i < num_ids; ++i ) { if (! strm.write_string (repository_ids[i])) return false; + } } return true; diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h index 94d0ab53e76..1b1880cadc9 100644 --- a/TAO/tao/Valuetype/ValueBase.h +++ b/TAO/tao/Valuetype/ValueBase.h @@ -217,19 +217,27 @@ namespace CORBA /// implementation, we just use chunking for the truncatable valuetype. CORBA::Boolean chunking_; + /// Compare the supplied formal type identifier with our actual type. + /// This is used during marshaling of valuetypes to detect when it is + /// appropriate to not explicitly marshal the typecode for the value. + virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const = 0; + private: /// Write some special values such as null value or indirection value. static CORBA::Boolean write_special_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value); /// Write whole value. - static CORBA::Boolean write_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value); + static CORBA::Boolean write_value(TAO_OutputCDR &strm, + const CORBA::ValueBase * value, + ptrdiff_t formal_type_id); + /// Write the header of the value which includes the valuetag, number of /// repository ids and list of repository ids. - CORBA::Boolean write_value_header(TAO_OutputCDR &strm) const; + CORBA::Boolean write_value_header(TAO_OutputCDR &strm, + ptrdiff_t formal_type_id) const; /// Read the repository ids from the CDR input stream. static CORBA::Boolean read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids); - private: ValueBase & operator= (const ValueBase &); |