diff --git a/rtt/types/PropertyComposition.cpp b/rtt/types/PropertyComposition.cpp index dd752bd6c..9acfe9e8f 100644 --- a/rtt/types/PropertyComposition.cpp +++ b/rtt/types/PropertyComposition.cpp @@ -32,18 +32,8 @@ bool RTT::types::composePropertyBag( PropertyBag const& sourcebag, PropertyBag& log(Debug) << "Used user's composition function for " << tgtprop->getName() <<":"<getType()<decomposeType() since that probably doesn't do what we wish - PropertyBag decomp; - if ( typeDecomposition( tgtprop->getDataSource(), decomp) && ( decomp.getType() == isbag.getType() ) && refreshProperties(decomp, isbag) ) { - // note: we add tgtprop ! the decomp is just a way to get a reference to the parts of tgtprop - target.ownProperty( tgtprop ); - } else { - log(Error) <<"The type '" << isbag.value().getType() <<"' did not provide a type composition function, but I need one to compose it from a PropertyBag." <getTypeName() << "'s getMember() can not process "<< item->getTypeName() <::reference_t result) const { + // The default implementation decomposes result and refreshes it with source. + internal::ReferenceDataSource rds(result); + rds.ref(); // prevent dealloc. + PropertyBag decomp; + // only try refreshProperties if decomp's type is equal to source type. + // update vs refresh: since it is intentional that the decomposition leads to references to parts of result, + // only refreshProperties() is meaningful (ie we have a one-to-one mapping). In case of sequences, this would + // of course not match, so this is struct specific. + return typeDecomposition( &rds, decomp, false) && ( decomp.getType() == source.getType() ) && refreshProperties(decomp, source); + } + + }; } } diff --git a/rtt/types/TemplateTypeInfo.hpp b/rtt/types/TemplateTypeInfo.hpp index 6700a239d..f7ff39eaf 100644 --- a/rtt/types/TemplateTypeInfo.hpp +++ b/rtt/types/TemplateTypeInfo.hpp @@ -331,16 +331,9 @@ namespace RTT /** * User, implement this function in case you want to control reading the XML data format. - * TemplateTypeInfo provides a default, good for most types implementation in case getMember() - * is implemented. */ virtual bool composeTypeImpl(const PropertyBag& source, typename internal::AssignableDataSource::reference_t result) const { - // The default implementation decomposes result and refreshes it with source. - internal::ReferenceDataSource rds(result); - rds.ref(); // prevent dealloc. - PropertyBag decomp; - // only try refreshProperties if decomp's type is equal to source type. - return typeDecomposition( &rds, decomp) && ( decomp.getType() == source.getType() ) && refreshProperties(decomp, source); + return false; } /**