Orocos Real-Time Toolkit  2.9.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
RTT::internal::FusedFunctorDataSource< Signature, Enable > Struct Template Reference

A DataSource that calls a functor of signature Signature which gets its arguments from other data sources. More...

#include <rtt/internal/FusedFunctorDataSource.hpp>

Inheritance diagram for RTT::internal::FusedFunctorDataSource< Signature, Enable >:
RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type > RTT::base::DataSourceBase

Public Types

typedef boost::function_traits< Signature >::result_type result_type
 
typedef remove_cr< result_type >::type value_t
 
typedef DataSource< value_t >::const_reference_t const_reference_t
 
typedef create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
 
typedef SequenceFactory::type DataSourceSequence
 
typedef boost::function< Signature > call_type
 
typedef SequenceFactory::data_type arg_type
 
typedef boost::intrusive_ptr< FusedFunctorDataSource< Signature > > shared_ptr
 
typedef remove_cr< boost::function_traits< Signature >::result_type >::type result_t
 
typedef boost::intrusive_ptr< const DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type > > const_ptr
 

Public Member Functions

template<class Func >
 FusedFunctorDataSource (Func g, const DataSourceSequence &s=DataSourceSequence())
 
void setArguments (const DataSourceSequence &a1)
 
value_t value () const
 Return the result of the last evaluate() function. More...
 
const_reference_t rvalue () const
 Get a const reference to the value of this DataSource. More...
 
bool evaluate () const
 Force an evaluation of the DataSourceBase. More...
 
value_t get () const
 Return the data as type T. More...
 
virtual FusedFunctorDataSource< Signature > * clone () const
 Return a shallow clone of this DataSource. More...
 
virtual FusedFunctorDataSource< Signature > * copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
 Create a deep copy of this internal::DataSource, unless it is already cloned. More...
 
 BOOST_STATIC_ASSERT (!details::HasConst< remove_cr< boost::function_traits< Signature >::result_type >::type >::value)
 If you get a compile error here, it means T has const or reference qualifiers, which is not allowed for DataSource<T> More...
 
void const * getRawConstPointer ()
 Generic implementation of getRawConstPointer() based on rvalue() More...
 
virtual std::string getType () const
 Return useful type info in a human readable format. More...
 
virtual const types::TypeInfogetTypeInfo () const
 Return the Orocos type info object. More...
 
virtual std::string getTypeName () const
 Return the Orocos type name, without const, pointer or reference qualifiers. More...
 
void ref () const
 Increase the reference count by one. More...
 
void deref () const
 Decrease the reference count by one and delete this on zero. More...
 
virtual void reset ()
 Reset the data to initial values. More...
 
virtual bool isAssignable () const
 Returns true if this object can be cast to an AssignableDataSource. More...
 
virtual void updated ()
 In case the internal::DataSource returns a 'reference' type, call this method to notify it that the data was updated in the course of an invocation of get(). More...
 
virtual bool update (DataSourceBase *other)
 Update the value of this internal::DataSource with the value of an other DataSource. More...
 
virtual ActionInterfaceupdateAction (DataSourceBase *other)
 Generate a ActionInterface object which will update this internal::DataSource with the value of another internal::DataSource when execute()'ed. More...
 
virtual shared_ptr getMember (const std::string &member_name)
 Get a (const) reference data source to a member of the structure of this data source. More...
 
virtual shared_ptr getMember (DataSourceBase::shared_ptr member_id, DataSourceBase::shared_ptr offset)
 Same as above, but with run-time lookup of the member to use. More...
 
virtual std::vector< std::string > getMemberNames () const
 Returns the names of all members of the structure contained in this data source, or an empty list if none. More...
 
virtual shared_ptr getParent ()
 Returns the top level data source that contains the full data structure this data source refers to. More...
 
std::ostream & write (std::ostream &os)
 Stream the contents of this object. More...
 
std::string toString ()
 Get the contents of this object as a string. More...
 
virtual void * getRawPointer ()
 Returns a pointer to the sample contained in this data source, if there is any, and if it is an lvalue. More...
 

Static Public Member Functions

static std::string GetType ()
 Return usefull type info in a human readable format. More...
 
static const types::TypeInfoGetTypeInfo ()
 Return the Orocos type info. More...
 
static std::string GetTypeName ()
 Return the Orocos type name, without const, pointer or reference qualifiers. More...
 
static DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type > * narrow (base::DataSourceBase *db)
 This method narrows a base::DataSourceBase to a typeded DataSource, possibly returning a new object. More...
 
static shared_ptr stack_shared_ptr (DataSourceBase *dsb)
 Returns a shared ptr to a DataSourceBase living on the stack. More...
 
static const_ptr stack_const_ptr (const DataSourceBase *dsb)
 Returns a const shared_ptr to a DataSourceBase living on the stack. More...
 

Public Attributes

boost::function< Signature > ff
 
DataSourceSequence args
 
RStore< result_typeret
 

Protected Attributes

os::AtomicInt refcount
 We keep the refcount ourselves. More...
 

Detailed Description

template<typename Signature, class Enable = void>
struct RTT::internal::FusedFunctorDataSource< Signature, Enable >

A DataSource that calls a functor of signature Signature which gets its arguments from other data sources.

The result type of this data source is the result type of the called function.

Definition at line 73 of file FusedFunctorDataSource.hpp.

Member Typedef Documentation

template<typename Signature, class Enable = void>
typedef SequenceFactory::data_type RTT::internal::FusedFunctorDataSource< Signature, Enable >::arg_type

Definition at line 86 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
typedef boost::function<Signature> RTT::internal::FusedFunctorDataSource< Signature, Enable >::call_type

Definition at line 85 of file FusedFunctorDataSource.hpp.

typedef boost::intrusive_ptr<const DataSource<remove_cr< boost::function_traits< Signature >::result_type >::type > > RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::const_ptr
inherited

Definition at line 117 of file DataSource.hpp.

template<typename Signature, class Enable = void>
typedef DataSource<value_t>::const_reference_t RTT::internal::FusedFunctorDataSource< Signature, Enable >::const_reference_t

Definition at line 81 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
typedef SequenceFactory::type RTT::internal::FusedFunctorDataSource< Signature, Enable >::DataSourceSequence

Definition at line 84 of file FusedFunctorDataSource.hpp.

typedef remove_cr< boost::function_traits< Signature >::result_type >::type RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::result_t
inherited

Definition at line 106 of file DataSource.hpp.

template<typename Signature, class Enable = void>
typedef boost::function_traits<Signature>::result_type RTT::internal::FusedFunctorDataSource< Signature, Enable >::result_type

Definition at line 79 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
typedef create_sequence< typename boost::function_types::parameter_types<Signature>::type> RTT::internal::FusedFunctorDataSource< Signature, Enable >::SequenceFactory

Definition at line 83 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
typedef boost::intrusive_ptr<FusedFunctorDataSource<Signature> > RTT::internal::FusedFunctorDataSource< Signature, Enable >::shared_ptr

Definition at line 92 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
typedef remove_cr<result_type>::type RTT::internal::FusedFunctorDataSource< Signature, Enable >::value_t

Definition at line 80 of file FusedFunctorDataSource.hpp.

Constructor & Destructor Documentation

template<typename Signature, class Enable = void>
template<class Func >
RTT::internal::FusedFunctorDataSource< Signature, Enable >::FusedFunctorDataSource ( Func  g,
const DataSourceSequence s = DataSourceSequence() 
)
inline

Definition at line 95 of file FusedFunctorDataSource.hpp.

Member Function Documentation

RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::BOOST_STATIC_ASSERT ( !details::HasConst< remove_cr< boost::function_traits< Signature >::result_type >::type >::value  )
inherited

If you get a compile error here, it means T has const or reference qualifiers, which is not allowed for DataSource<T>

template<typename Signature, class Enable = void>
virtual FusedFunctorDataSource<Signature>* RTT::internal::FusedFunctorDataSource< Signature, Enable >::clone ( ) const
inlinevirtual

Return a shallow clone of this DataSource.

This method returns a duplicate of this instance which re-uses the DataSources this internal::DataSource holds reference to. The clone() function is thus a non-deep copy.

Implements RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >.

Definition at line 134 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
virtual FusedFunctorDataSource<Signature>* RTT::internal::FusedFunctorDataSource< Signature, Enable >::copy ( std::map< const base::DataSourceBase *, base::DataSourceBase * > &  alreadyCloned) const
inlinevirtual

Create a deep copy of this internal::DataSource, unless it is already cloned.

Places the association (parent, clone) in alreadyCloned. If the internal::DataSource is non-copyable (for example it represents the Property of a Task ), this may be returned.

Implements RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >.

Definition at line 138 of file FusedFunctorDataSource.hpp.

void RTT::DataSourceBase::deref ( ) const
inherited

Decrease the reference count by one and delete this on zero.

Definition at line 81 of file DataSource.cpp.

References RTT::os::AtomicInt::dec_and_test(), and RTT::base::DataSourceBase::refcount.

Referenced by RTT::base::intrusive_ptr_release().

template<typename Signature, class Enable = void>
bool RTT::internal::FusedFunctorDataSource< Signature, Enable >::evaluate ( ) const
inlinevirtual

Force an evaluation of the DataSourceBase.

Returns
true on successful evaluation.

Reimplemented from RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >.

Definition at line 116 of file FusedFunctorDataSource.hpp.

References RTT::internal::RStore< T >::exec().

template<typename Signature, class Enable = void>
value_t RTT::internal::FusedFunctorDataSource< Signature, Enable >::get ( ) const
inlinevirtual
DataSourceBase::shared_ptr RTT::DataSourceBase::getMember ( const std::string &  member_name)
virtualinherited

Get a (const) reference data source to a member of the structure of this data source.

You must call getMember() in turn on the returned member to access sub-members.

Parameters
member_nameThe name of the member to get access to.
Returns
null if the member does not exist, this if member_name.empty(), and a reference data source to the member otherwise.

Definition at line 124 of file DataSource.cpp.

References RTT::types::TypeInfo::getMember(), and RTT::base::DataSourceBase::getTypeInfo().

DataSourceBase::shared_ptr RTT::DataSourceBase::getMember ( DataSourceBase::shared_ptr  member_id,
DataSourceBase::shared_ptr  offset 
)
virtualinherited

Same as above, but with run-time lookup of the member to use.

Also takes an optional offset argument which can be used to offset the member in memory. This is necessary when using sequences of sequences. DataSources which are a sequence/offset member themselves must override this function to let the returned member take the offset into account.

Definition at line 130 of file DataSource.cpp.

References RTT::types::TypeInfo::getMember(), and RTT::base::DataSourceBase::getTypeInfo().

vector< string > RTT::DataSourceBase::getMemberNames ( ) const
virtualinherited

Returns the names of all members of the structure contained in this data source, or an empty list if none.

If this data source is a sequence, it will not return the allowed index numbers.

Definition at line 134 of file DataSource.cpp.

References RTT::types::TypeInfo::getMemberNames(), and RTT::base::DataSourceBase::getTypeInfo().

DataSourceBase::shared_ptr RTT::DataSourceBase::getParent ( )
virtualinherited

Returns the top level data source that contains the full data structure this data source refers to.

Defaults to returning this.

Definition at line 138 of file DataSource.cpp.

void const* RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::getRawConstPointer ( )
inlinevirtualinherited

Generic implementation of getRawConstPointer() based on rvalue()

Reimplemented from RTT::base::DataSourceBase.

Definition at line 141 of file DataSource.hpp.

void * RTT::DataSourceBase::getRawPointer ( )
virtualinherited
virtual std::string RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::getType ( ) const
virtualinherited

Return useful type info in a human readable format.

Implements RTT::base::DataSourceBase.

static std::string RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::GetType ( )
staticinherited

Return usefull type info in a human readable format.

virtual const types::TypeInfo* RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::getTypeInfo ( ) const
virtualinherited

Return the Orocos type info object.

Implements RTT::base::DataSourceBase.

static const types::TypeInfo* RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::GetTypeInfo ( )
staticinherited

Return the Orocos type info.

static std::string RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::GetTypeName ( )
staticinherited

Return the Orocos type name, without const, pointer or reference qualifiers.

virtual std::string RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::getTypeName ( ) const
virtualinherited

Return the Orocos type name, without const, pointer or reference qualifiers.

Implements RTT::base::DataSourceBase.

bool RTT::DataSourceBase::isAssignable ( ) const
virtualinherited
static DataSource<remove_cr< boost::function_traits< Signature >::result_type >::type >* RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >::narrow ( base::DataSourceBase db)
staticinherited

This method narrows a base::DataSourceBase to a typeded DataSource, possibly returning a new object.

void RTT::DataSourceBase::ref ( ) const
inherited
void RTT::DataSourceBase::reset ( )
virtualinherited
template<typename Signature, class Enable = void>
const_reference_t RTT::internal::FusedFunctorDataSource< Signature, Enable >::rvalue ( ) const
inlinevirtual

Get a const reference to the value of this DataSource.

You must call evaluate() prior to calling this function in order to get the most recent value of this attribute.

Note
Getting a reference to an internal data structure is not thread-safe.

Implements RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >.

Definition at line 111 of file FusedFunctorDataSource.hpp.

References RTT::internal::RStore< T >::result().

template<typename Signature, class Enable = void>
void RTT::internal::FusedFunctorDataSource< Signature, Enable >::setArguments ( const DataSourceSequence a1)
inline

Definition at line 101 of file FusedFunctorDataSource.hpp.

DataSourceBase::const_ptr RTT::DataSourceBase::stack_const_ptr ( const DataSourceBase dsb)
staticinherited

Returns a const shared_ptr to a DataSourceBase living on the stack.

Make sure that the const_ptr does not outlive the stacked element.

Definition at line 74 of file DataSource.cpp.

References RTT::base::DataSourceBase::ref().

DataSourceBase::shared_ptr RTT::DataSourceBase::stack_shared_ptr ( DataSourceBase dsb)
staticinherited

Returns a shared ptr to a DataSourceBase living on the stack.

Make sure that the shared_ptr does not outlive the stacked element.

Definition at line 69 of file DataSource.cpp.

References RTT::base::DataSourceBase::ref().

std::string RTT::DataSourceBase::toString ( )
inherited

Get the contents of this object as a string.

See also
types::TypeInfo

Definition at line 98 of file DataSource.cpp.

bool RTT::DataSourceBase::update ( DataSourceBase other)
virtualinherited
ActionInterface * RTT::DataSourceBase::updateAction ( DataSourceBase other)
virtualinherited
void RTT::DataSourceBase::updated ( )
virtualinherited
template<typename Signature, class Enable = void>
value_t RTT::internal::FusedFunctorDataSource< Signature, Enable >::value ( ) const
inlinevirtual

Return the result of the last evaluate() function.

You must call evaluate() prior to calling this function in order to get the most recent value of this attribute.

Implements RTT::internal::DataSource< remove_cr< boost::function_traits< Signature >::result_type >::type >.

Definition at line 106 of file FusedFunctorDataSource.hpp.

References RTT::internal::RStore< T >::result().

std::ostream & RTT::DataSourceBase::write ( std::ostream &  os)
inherited

Stream the contents of this object.

See also
types::TypeInfo

Definition at line 91 of file DataSource.cpp.

Member Data Documentation

template<typename Signature, class Enable = void>
DataSourceSequence RTT::internal::FusedFunctorDataSource< Signature, Enable >::args

Definition at line 88 of file FusedFunctorDataSource.hpp.

template<typename Signature, class Enable = void>
boost::function<Signature> RTT::internal::FusedFunctorDataSource< Signature, Enable >::ff

Definition at line 87 of file FusedFunctorDataSource.hpp.

os::AtomicInt RTT::base::DataSourceBase::refcount
mutableprotectedinherited

We keep the refcount ourselves.

We aren't using boost::shared_ptr, because boost::intrusive_ptr is better, exactly because it can be used with refcounts that are stored in the class itself. Advantages are that the shared_ptr's for derived classes use the same refcount, which is of course very much desired, and that refcounting happens in an efficient way, which is also nice :)

Definition at line 88 of file DataSourceBase.hpp.

Referenced by RTT::base::DataSourceBase::deref(), and RTT::base::DataSourceBase::ref().

template<typename Signature, class Enable = void>
RStore<result_type> RTT::internal::FusedFunctorDataSource< Signature, Enable >::ret
mutable

Definition at line 89 of file FusedFunctorDataSource.hpp.


The documentation for this struct was generated from the following file: