47 #include "../internal/DataSource.hpp" 51 #include <boost/lexical_cast.hpp> 52 #include "../Logger.hpp" 54 #include "../Property.hpp" 61 namespace RTT {
namespace types {
81 if (decomposed == dsb)
97 vector<string> parts = dsb->getMemberNames();
98 if ( parts.empty() ) {
99 log(
Debug) <<
"propertyDecomposition: "<< dsb->getTypeName() <<
" does not have any members." <<
endlog();
103 targetbag.
setType( dsb->getTypeName() );
106 #if __cplusplus > 199711L 107 unique_ptr< Property<PropertyBag> >
109 auto_ptr< Property<PropertyBag> >
113 for(vector<string>::iterator it = parts.begin(); it != parts.end(); ++it ) {
116 log(
Error) <<
"propertyDecomposition: Inconsistent type info for "<< dsb->getTypeName() <<
": reported to have part '"<<*it<<
"' but failed to return it."<<
endlog();
119 if ( !part->isAssignable() ) {
121 log(
Debug)<<
"propertyDecomposition: Part "<< *it <<
":"<< part->getTypeName() <<
" is not changeable."<<
endlog();
127 log(
Error)<<
"Decomposition failed because Part '"<<*it<<
"' is not known to type system."<<
endlog();
134 assert( recurse_bag->rvalue().empty() );
137 if ( converted && converted != clone ) {
139 targetbag.
ownProperty( converted->getTypeInfo()->buildProperty(*it,
"", converted) );
145 assert( recurse_bag->rvalue().size() >= 1 );
146 recurse_bag->setName(*it);
160 int msize = size->
get();
161 for (
int i=0; i < msize; ++i) {
162 string indx = boost::lexical_cast<
string>( i );
165 if ( !item->isAssignable() ) {
167 log(
Warning)<<
"propertyDecomposition: Item '"<< indx <<
"' of type "<< dsb->getTypeName() <<
" is not changeable."<<
endlog();
176 recurse_bag->
setName(
"Element" + indx );
184 if (targetbag.
empty() )
185 log(
Debug) <<
"propertyDecomposition: "<< dsb->getTypeName() <<
" returns an empty property bag." <<
endlog();
virtual result_t get() const =0
bool propertyDecomposition(base::PropertyBase *source, PropertyBag &targetbag, bool recurse)
void setType(const std::string &newtype)
A container for holding references to properties.
bool ownProperty(base::PropertyBase *p)
virtual const_reference_t rvalue() const =0
base::PropertyBase * buildProperty(const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const
void setName(const std::string &name)
bool typeDecomposition(base::DataSourceBase::shared_ptr dsb, PropertyBag &targetbag, bool recurse)
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static Logger::LogFunction endlog()
virtual DataSourceBase::shared_ptr getDataSource() const =0
virtual const types::TypeInfo * getTypeInfo() const =0
void setDescription(const std::string &desc)