39 #ifndef ORO_FUSEDFUNCTORDATASOURCE_HPP_ 40 #define ORO_FUSEDFUNCTORDATASOURCE_HPP_ 44 #include "../SendStatus.hpp" 46 #include "../ExecutionEngine.hpp" 47 #include "../os/oro_allocator.hpp" 49 #include <boost/bind.hpp> 50 #include <boost/type_traits.hpp> 51 #include <boost/function.hpp> 52 #include <boost/function_types/function_type.hpp> 53 #include <boost/fusion/include/invoke.hpp> 54 #include <boost/fusion/include/invoke_procedure.hpp> 55 #include <boost/mpl/bool.hpp> 56 #include <boost/make_shared.hpp> 62 namespace bf = boost::fusion;
69 template<
typename Signature,
class Enable=
void>
72 typename remove_cr<typename boost::function_traits<Signature>::result_type>::type >
75 typedef typename boost::function_traits<Signature>::result_type
80 typename boost::function_types::parameter_types<Signature>::type>
SequenceFactory;
84 boost::function<Signature>
ff;
88 typedef boost::intrusive_ptr<FusedFunctorDataSource<Signature> >
117 typedef typename bf::result_of::invoke<call_type,arg_type>::type iret;
118 typedef iret(*IType)(
call_type, arg_type
const&);
119 IType
foo = &bf::invoke<call_type,arg_type>;
144 template<
typename Signature>
145 struct FusedFunctorDataSource<Signature, typename
boost::enable_if< is_pure_reference<typename boost::function_traits<Signature>::result_type> >::type >
147 typename remove_cr<typename boost::function_traits<Signature>::result_type>::type >
150 typedef typename boost::function_traits<Signature>::result_type
160 boost::function<Signature>
ff;
164 typedef boost::intrusive_ptr<FusedFunctorDataSource<Signature> >
193 typedef typename bf::result_of::invoke<call_type,arg_type>::type iret;
194 typedef iret(*IType)(
call_type, arg_type
const&);
195 IType
foo = &bf::invoke<call_type,arg_type>;
208 get(); ret.
result() = arg;
212 get();
return ret.
result();
237 template<
class Function>
240 typedef typename boost::function_types::function_type<Function>::type Signature;
242 if ( args.size() != boost::function_traits<Signature>::arity )
252 template<
typename Signature>
255 typename remove_cr<typename boost::function_traits<Signature>::result_type>::type >
257 typedef typename boost::function_traits<Signature>::result_type
268 typedef boost::intrusive_ptr<FusedMCallDataSource<Signature> >
298 typedef typename bf::result_of::invoke<call_type,arg_type>::type iret;
299 typedef iret(*IType)(
call_type, arg_type
const&);
300 IType
foo = &bf::invoke<call_type,arg_type>;
334 template<
typename Signature>
351 typedef boost::intrusive_ptr<FusedMSendDataSource<Signature> >
356 ff(g), args(s), sh(), isqueued(false)
365 virtual void set( param_t t ) {
409 if ( alreadyCloned[
this] != 0 ) {
426 template<
typename Signature>
435 typedef typename boost::function_types::parameter_types<CollectSignature>::type
arg_types;
444 typedef boost::intrusive_ptr<FusedMCollectDataSource<Signature> >
471 if (isblocking->
get())
491 if ( alreadyCloned[
this] != 0 ) {
510 template<
typename Signature>
513 typedef typename boost::function_traits<Signature>::result_type
519 boost::shared_ptr<base::ActionInterface>
mact;
530 boost::shared_ptr<FusedMSignal<Signature> >
self;
532 typedef boost::shared_ptr<FusedMSignal<Signature> >
shared_ptr;
542 const DataSourceSequence& s,
544 mact(act), args(s), subscriber(subscr), self()
559 shared_ptr sg = this->cloneRT();
562 if ( subscriber->
process( sg.get() ) ) {
boost::function_traits< Signature >::result_type result_type
bf::cons< arg_store_type, arg_store_tail_type > data_store_type
boost::intrusive_ptr< FusedFunctorDataSource< Signature > > shared_ptr
boost::function_traits< Signature >::result_type result_type
virtual result_t get() const =0
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
SequenceFactory::type DataSourceSequence
FusedMSignal< Signature >::shared_ptr cloneRT() const
static data_store_type store(const data_type &in)
SequenceFactory::type DataSourceSequence
SequenceFactory::type DataSourceSequence
const_reference_t rvalue() const
boost::function< Signature > call_type
ExecutionEngine * subscriber
virtual FusedMCallDataSource< Signature > * clone() const
DataSource< bool >::shared_ptr isblocking
The base class for all internal data representations.
remove_cr< result_type >::type value_t
SequenceFactory::atype DataSourceSequence
SequenceFactory::data_store_type arg_cache
remove_cr< result_type >::type value_t
void setArguments(const DataSourceSequence &a1)
base::DataSourceBase * newFunctorDataSource(Function f, const std::vector< base::DataSourceBase::shared_ptr > &args)
FusedMSendDataSource(typename base::OperationCallerBase< Signature >::shared_ptr g, const DataSourceSequence &s=DataSourceSequence())
virtual FusedMSendDataSource< Signature > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
remove_cr< result_type >::type value_t
boost::intrusive_ptr< FusedMSendDataSource< Signature > > shared_ptr
SequenceFactory::data_type arg_type
DataSource< value_t >::const_reference_t const_reference_t
static void load(const data_store_type &in, const atype &seq)
boost::function_traits< Signature >::result_type result_type
SendHandle< Signature > sh
virtual FusedFunctorDataSource< Signature > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
FusedFunctorDataSource(Func g, const DataSourceSequence &s=DataSourceSequence())
void setArguments(const DataSourceSequence &a1)
CollectType< Signature >::type CollectSignature
AssignableDataSource< value_t >::reference_t reference_t
DataSource< value_t >::const_reference_t const_reference_t
RStore< result_type > ret
DataSource< value_t >::const_reference_t const_reference_t
RStore< result_type > ret
boost::intrusive_ptr< FusedFunctorDataSource< Signature > > shared_ptr
boost::function< Signature > call_type
SequenceFactory::type DataSourceSequence
boost::shared_ptr< OperationCallerBase< F > > shared_ptr
boost::intrusive_ptr< FusedMCollectDataSource< Signature > > shared_ptr
static data_type data(const type &seq)
void setArguments(const DataSourceSequence &a1)
The SendHandle is used to collect the result values of an asynchronous invocation. The template argument Signature must have the same type as the method being invoked.
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
virtual FusedFunctorDataSource< Signature > * clone() const
RStore< result_type > ret
FusedMCallDataSource(typename base::OperationCallerBase< Signature >::shared_ptr g, const DataSourceSequence &s=DataSourceSequence())
static type copy(const type &seq, std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned)
SequenceFactory::data_type arg_type
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
static type sources(std::vector< base::DataSourceBase::shared_ptr >::const_iterator args, int argnbr=1)
FusedMCollectDataSource(const DataSourceSequence &s, DataSource< bool >::shared_ptr blocking)
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
Based on the software pattern 'command', this interface allows execution of action objects...
base::OperationCallerBase< Signature >::shared_ptr ff
boost::intrusive_ptr< FusedMCallDataSource< Signature > > shared_ptr
SequenceFactory::type DataSourceSequence
result_type invoke(const typename SequenceFactory::data_type &seq) const
const_reference_t rvalue() const
virtual FusedMCollectDataSource< Signature > * clone() const
const_reference_t rvalue() const
boost::function< Signature > ff
bf::cons< arg_type, arg_tail_type > data_type
An object that is executable and is freed after execution.
base::OperationCallerBase< Signature >::shared_ptr ff
AssignableDataSource< value_t >::const_reference_t const_reference_t
virtual FusedMSendDataSource< Signature > * clone() const
DataSource< SendStatus >::const_reference_t const_reference_t
AssignableDataSource< value_t >::param_t param_t
const_reference_t rvalue() const
FusedMSignal(base::ActionInterface *act, const DataSourceSequence &s, ExecutionEngine *subscr)
boost::function_types::parameter_types< CollectSignature >::type arg_types
const_reference_t rvalue() const
bf::cons< ds_type, tail_type > type
void setArguments(const DataSourceSequence &a1)
void setArguments(const DataSourceSequence &a1)
boost::function_traits< Signature >::result_type result_type
void setArguments(const DataSourceSequence &a1)
boost::remove_const< typename boost::remove_reference< T >::type >::type type
virtual FusedMCollectDataSource< Signature > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
boost::function< Signature > ff
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static void set(const data_type &in, const atype &seq)
SendHandle< Signature > result_type
virtual bool process(base::DisposableInterface *c)
mpl::push_front< arg_types, SendHandle< Signature > & >::type handle_and_arg_types
static void update(const type &seq)
virtual FusedFunctorDataSource< Signature > * clone() const
virtual FusedFunctorDataSource< Signature > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
details::GetConstRef< T >::type const_reference_t
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
FusedFunctorDataSource(Func g, const DataSourceSequence &s=DataSourceSequence())
create_sequence< handle_and_arg_types > SequenceFactory
bf::cons< ads_type, atail_type > atype
boost::shared_ptr< base::ActionInterface > mact
AssignableDataSource< value_t >::reference_t reference_t
virtual FusedMCallDataSource< Signature > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const
boost::shared_ptr< FusedMSignal< Signature > > shared_ptr