39 #ifndef ORO_PARTDATASOURCE_HPP_ 40 #define ORO_PARTDATASOURCE_HPP_ 43 #include "../types/carray.hpp" 68 typedef boost::intrusive_ptr<PartDataSource<T> >
shared_ptr;
78 : mref(ref), mparent(parent)
118 if ( replace[
this] != 0 ) {
123 assert( mparent->getRawPointer() != 0 &&
"Can't copy part of rvalue datasource.");
124 if ( mparent->getRawPointer() == 0 )
125 throw std::runtime_error(
"PartDataSource.hpp: Can't copy part of rvalue datasource.");
128 int offset =
reinterpret_cast<unsigned char*
>( &mref ) - reinterpret_cast<unsigned char*>(mparent->getRawPointer());
162 : mref(ref), mparent(parent)
200 virtual PartDataSource*
copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replace )
const {
202 if ( replace[
this] != 0 ) {
203 assert ( dynamic_cast<PartDataSource*>( replace[
this] ) == static_cast<PartDataSource*>( replace[
this] ) );
207 assert( mparent->getRawPointer() != 0 &&
"Can't copy part of rvalue datasource.");
208 if ( mparent->getRawPointer() == 0 )
209 throw std::runtime_error(
"PartDataSource.hpp: Can't copy part of rvalue datasource.");
212 int offset =
reinterpret_cast<unsigned char*
>( mref.address() ) - reinterpret_cast<unsigned char*>(mparent->getRawPointer());
215 mref_copy.
init(reinterpret_cast<T*>( reinterpret_cast<unsigned char*>(mparent_copy->getRawPointer()) + offset ), mref.count() );
A DataSource which is used to manipulate a reference to a part of a data source.
types::carray< T > value() const
Return the result of the last evaluate() function.
void init(value_type *t, std::size_t s)
(Re-)initialize this carray to a new address and size.
virtual PartDataSource< T > * clone() const
Return a shallow clone of this DataSource.
boost::call_traits< value_t >::reference reference_t
void updated()
In case the internal::DataSource returns a 'reference' type, call this method to notify it that the d...
types::carray< T > const & rvalue() const
Get a const reference to the value of this DataSource.
Wraps a C array such that we can return a C array from a DataSource.
virtual PartDataSource * clone() const
Return a shallow clone of this DataSource.
DataSource< T >::result_t value() const
Return the result of the last evaluate() function.
PartDataSource(typename AssignableDataSource< T >::reference_t ref, base::DataSourceBase::shared_ptr parent)
The part is constructed from a reference to a member variable of an existing struct.
boost::intrusive_ptr< PartDataSource< T > > shared_ptr
A DataSource which has set() methods.
virtual PartDataSource * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &replace) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
DataSource< T >::value_t value_t
DataSource< T >::const_reference_t const_reference_t
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
PartDataSource(types::carray< T > ref, base::DataSourceBase::shared_ptr parent)
The part is constructed from a reference to a member variable of an existing struct.
void ref() const
Increase the reference count by one.
AssignableDataSource< T >::const_reference_t rvalue() const
Get a const reference to the value of this DataSource.
boost::intrusive_ptr< PartDataSource< T > > shared_ptr
boost::call_traits< value_t >::param_type param_t
virtual PartDataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &replace) const
Create a deep copy of this internal::DataSource, unless it is already cloned.
void updated()
In case the internal::DataSource returns a 'reference' type, call this method to notify it that the d...