Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into toolchain-2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerj committed Apr 28, 2017
2 parents 24d3b3b + f39b704 commit 7db2042
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
4 changes: 4 additions & 0 deletions rtt/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,11 @@ namespace RTT
os::MutexLock lock( d->inpguard );
getline( d->remotestream, line );
if ( !d->remotestream )
{
d->remotestream.str("");
d->remotestream.clear();
d->messagecnt = 0;
}
}
if ( !line.empty() )
--d->messagecnt;
Expand Down
17 changes: 12 additions & 5 deletions rtt/Property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace RTT
* @post ready() will be true if datasource is a valid pointer.
*/
Property(const std::string& name, const std::string& description,
typename internal::AssignableDataSource<DataSourceType>::shared_ptr datasource )
const typename internal::AssignableDataSource<DataSourceType>::shared_ptr& datasource )
: base::PropertyBase(name, description), _value( datasource )
{
// need to do this on the datasource in order to have access to set()/rvalue() of the data source.
Expand Down Expand Up @@ -373,14 +373,21 @@ namespace RTT
return new Property<T>(*this);
}

virtual Property<T>* copy() const
virtual Property<T>* create() const
{
return new Property<T>( _name, _description, _value );
return new Property<T>( _name, _description, T() );
}

virtual Property<T>* create() const
virtual Property<T>* create( const base::DataSourceBase::shared_ptr& datasource ) const
{
return new Property<T>( _name, _description, T() );
typename internal::AssignableDataSource<DataSourceType>::shared_ptr value
= internal::AssignableDataSource<DataSourceType>::narrow( datasource.get() );
Property<T>* prop = new Property<T>( _name, _description, value );
if ( datasource && !prop->ready() ) {
log(Error) << "Cannot initialize Property: "
<< "incompatible type ( destination type: " << getType() << ", source type: " << datasource->getTypeName() << ")." << endlog();
}
return prop;
}

virtual base::DataSourceBase::shared_ptr getDataSource() const {
Expand Down
2 changes: 1 addition & 1 deletion rtt/PropertyBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace RTT

for( const_iterator i = orig.mproperties.begin(); i != orig.mproperties.end(); ++i) {
if ( orig.ownsProperty( *i ) ) {
PropertyBase* copy = (*i)->copy();
PropertyBase* copy = (*i)->create( (*i)->getDataSource() );
this->ownProperty( copy );
} else {
this->add( *i );
Expand Down
12 changes: 6 additions & 6 deletions rtt/base/PropertyBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,18 @@ namespace RTT
virtual PropertyBase* clone() const = 0;

/**
* Deliver a shallow copy of this PropertyBase with a shared
* DataSource. The original may be deleted and the clone can be
* transparantly used in its place or vice versa.
* Create a new default instance of the PropertyBase.
* This is a factory method to 'make something of the same type'.
* The new PropertyBase has the same name and description as this.
*/
virtual PropertyBase* copy() const = 0;
virtual PropertyBase* create() const = 0;

/**
* Create a new default instance of the PropertyBase.
* Create a new instance of the PropertyBase with a custom data source.
* This is a factory method to 'make something of the same type'.
* The new PropertyBase has the same name and description as this.
*/
virtual PropertyBase* create() const = 0;
virtual PropertyBase* create( const base::DataSourceBase::shared_ptr& datasource ) const = 0;

/**
* Get an assignable base::DataSource through which this PropertyBase
Expand Down

0 comments on commit 7db2042

Please sign in to comment.