39 #ifndef ORO_OPERATION_INTERFACE_PART_FUSED_HPP 40 #define ORO_OPERATION_INTERFACE_PART_FUSED_HPP 43 #include <boost/shared_ptr.hpp> 44 #include <boost/function_types/result_type.hpp> 45 #include <boost/function_types/parameter_types.hpp> 47 #include <boost/version.hpp> 48 #if BOOST_VERSION >= 104100 50 #ifndef BOOST_FUSION_UNFUSED_MAX_ARITY 51 #define BOOST_FUSION_UNFUSED_MAX_ARITY 7 53 #include <boost/functional/forward_adapter.hpp> 54 #include <boost/fusion/functional/generation/make_unfused.hpp> 57 #ifndef BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 58 #define BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 7 60 #include <boost/fusion/include/make_unfused_generic.hpp> 69 #include "../OperationInterfacePart.hpp" 70 #include "../FactoryExceptions.hpp" 71 #include "../Operation.hpp" 72 #include "../base/OperationCallerBase.hpp" 86 static std::vector<ArgumentDescription> getArgumentList(
base::OperationBase* ob,
const int arity, std::vector<std::string>
const& types);
93 template<
typename Signature>
98 typedef typename boost::function_traits<Signature>::result_type
result_type;
119 std::vector<std::string> types;
121 types.push_back( SequenceFactory::GetType(i) );
130 unsigned int arity()
const {
return boost::function_traits<Signature>::arity; }
136 return SequenceFactory::GetTypeInfo(arg);
139 unsigned int collectArity()
const {
return boost::function_traits< typename CollectType<Signature>::type >::arity; }
143 return CollectSequenceFactory::GetTypeInfo(arg);
147 const std::vector<base::DataSourceBase::shared_ptr>& args,
ExecutionEngine* caller)
const 167 const unsigned int carity = boost::mpl::size<typename FusedMCollectDataSource<Signature>::handle_and_arg_types>::value;
168 assert( carity == collectArity() + 1 );
174 #ifdef ORO_SIGNALLING_OPERATIONS 186 #ifdef ORO_SIGNALLING_OPERATIONS 191 template<
typename Signature>
192 class EventOperationInterfacePartFused
195 typedef typename boost::function_traits<Signature>::result_type
result_type;
210 if ( subscriber == impl->getMessageProcessor() )
215 #if BOOST_VERSION >= 104100 216 #if __cplusplus > 199711L 221 typedef typename boost::fusion::result_of::make_unfused< decltype(invoke_fused) >::type unfused_type;
222 return this->op->signals(boost::forward_adapter<unfused_type>(boost::fusion::make_unfused(invoke_fused)));
223 #else // __cplusplus > 199711L 224 return this->op->signals(
231 #endif // __cplusplus > 199711L 232 #else // BOOST_VERSION >= 104100 233 return this->op->signals(
240 #endif // BOOST_VERSION >= 104100 243 #endif // ORO_SIGNALLING_OPERATIONS 250 template<
typename Signature>
254 typedef typename boost::function_traits<Signature>::result_type result_type;
270 #ifdef ORO_SIGNALLING_OPERATIONS 285 std::vector<std::string> types;
287 types.push_back( SequenceFactory::GetType(i) );
296 unsigned int arity()
const {
return boost::function_traits<Signature>::arity; }
302 return SequenceFactory::GetTypeInfo(arg);
305 unsigned int collectArity()
const {
return boost::function_traits< typename CollectType<Signature>::type >::arity; }
309 return CollectSequenceFactory::GetTypeInfo(arg);
313 const std::vector<base::DataSourceBase::shared_ptr>& args,
ExecutionEngine* caller)
const 334 template<
typename Signature,
typename ObjT>
340 typedef typename boost::function_traits<Signature>::result_type result_type;
350 typedef std::vector<base::DataSourceBase::shared_ptr>
ArgList;
357 unsigned int arity()
const {
return boost::function_traits<Signature>::arity - 1; }
363 return SequenceFactory::GetTypeInfo(arg);
366 unsigned int collectArity()
const {
return boost::function_traits< typename CollectType<Signature>::type >::arity; }
370 return CollectSequenceFactory::GetTypeInfo(arg);
383 std::vector<ArgumentDescription> ret;
384 descr.resize( 1 + arity() * 2 );
385 for (
unsigned int i =1; i < descr.size(); i +=2 )
386 ret.push_back(
ArgumentDescription(descr[i],descr[i+1], SequenceFactory::GetType((i-1)/2+2)) );
395 a2.reserve(args.size()+1);
397 a2.insert(a2.end(), args.begin(), args.end());
406 a2.reserve(args.size()+1);
408 a2.insert(a2.end(), args.begin(), args.end());
419 const unsigned int carity = boost::mpl::size<typename FusedMCollectDataSource<Signature>::handle_and_arg_types>::value;
420 assert( carity == collectArity() + 1 );
425 #ifdef ORO_SIGNALLING_OPERATIONS 429 if ( subscriber == impl->getMessageProcessor() )
433 a2.reserve(args.size()+1);
435 a2.insert(a2.end(), args.begin(), args.end());
437 #if BOOST_VERSION >= 104100 438 #if __cplusplus > 199711L 443 typedef typename boost::fusion::result_of::make_unfused< decltype(invoke_fused) >::type unfused_type;
444 return this->op->signals(boost::forward_adapter<unfused_type>(boost::fusion::make_unfused(invoke_fused)));
445 #else // __cplusplus > 199711L 446 return this->op->signals(
453 #endif // __cplusplus > 199711L 454 #else // BOOST_VERSION >= 104100 455 return this->op->signals(
462 #endif // BOOST_VERSION >= 104100 464 #endif // ORO_SIGNALLING_OPERATIONS DataSource is a base class representing a generic way to read data of type T.
virtual std::vector< ArgumentDescription > getArgumentList() const
Get a description of the desired arguments in the ArgumentDescription format.
OperationInterfacePart implementation that uses boost::fusion to produce items.
This base class serves as a template-less handle for operation objects and also stores the name and d...
virtual base::OperationCallerBase< Signature >::shared_ptr getOperationCaller()
std::vector< base::DataSourceBase::shared_ptr > ArgList
virtual base::DataSourceBase::shared_ptr produceSend(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
Create a DataSource for a given send operation.
const types::TypeInfo * getArgumentType(unsigned int arg) const
Returns the type information of the n'th argument, with argument zero being the return value...
This class can create three kinds of Boost Fusion Sequences.
virtual std::string getName() const
Returns the name of this operation.
Operation< Signature > * op
virtual base::DataSourceBase::shared_ptr produceHandle() const
Create an empty SendHandle object for this operation.
static const std::string & getQualifier()
Return the 'const', 'ref', 'pointer' qualifier for this type.
unsigned int arity() const
Returns the arity (number of arguments) of this operation.
The operation ties a C or C++ function into a component interface.
const types::TypeInfo * getArgumentType(unsigned int arg) const
Returns the type information of the n'th argument, with argument zero being the return value...
std::string resultType() const
Return the result (return) type of this operation.
const types::TypeInfo * getCollectType(unsigned int arg) const
Returns the type information of the n'th collectable argument.
virtual std::string description() const
Returns the description of this operation.
OperationInterfacePartFusedDS(DataSource< boost::shared_ptr< ObjT > > *wp, Operation< Signature > *o)
A DataSource that collects the result of an asynchronous method which store its results in other data...
boost::shared_ptr< OperationCallerInterface > shared_ptr
Use this type for shared pointer storage of an OperationCallerInterface object.
const types::TypeInfo * getCollectType(unsigned int arg) const
Returns the type information of the n'th collectable argument.
An execution engine serialises (executes one after the other) the execution of all commands...
const types::TypeInfo * getArgumentType(unsigned int arg) const
Returns the type information of the n'th argument, with argument zero being the return value...
A DataSource that calls a method which gets its arguments from other data sources.
const std::vector< std::string > & getDescriptions()
Returns all the documented descriptions of this operation, as a single list, starting with the operat...
static const std::string & getType()
Return the qualified type.
unsigned int arity() const
Returns the arity (number of arguments) of this operation.
virtual std::string description() const
Returns the description of this operation.
boost::shared_ptr< OperationCallerBase< F > > shared_ptr
virtual std::string description() const
Returns the description of this operation.
virtual std::vector< ArgumentDescription > getArgumentList() const
Get a description of the desired arguments in the ArgumentDescription format.
OperationInterfacePart implementation that uses boost::fusion to produce items.
static const types::TypeInfo * getTypeInfo()
Return the typeinfo object.
virtual base::DataSourceBase::shared_ptr produceHandle() const
Create an empty SendHandle object for this operation.
SynchronousOperationInterfacePartFused(Operation< Signature > *o)
Description of one Argument of a Command.
std::string resultType() const
Return the result (return) type of this operation.
unsigned int collectArity() const
Returns the number of collectable arguments of this operation's function.
std::string resultType() const
Return the result (return) type of this operation.
boost::function_traits< Signature >::result_type result_type
Based on the software pattern 'command', this interface allows execution of action objects...
base::DataSourceBase::shared_ptr produce(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
Create a DataSource for a given callable operation.
A class for representing a user type, and which can build instances of that type. ...
const types::TypeInfo * getCollectType(unsigned int arg) const
Returns the type information of the n'th collectable argument.
This class defines the interface for creating operation objects without using C++ templates...
virtual base::DisposableInterface::shared_ptr getImplementation()
Returns the implementation object of this operation.
boost::shared_ptr< base::DisposableInterface > getLocalOperation() const
Returns any local operation associated with this operation.
virtual std::vector< ArgumentDescription > getArgumentList() const
Get a description of the desired arguments in the ArgumentDescription format.
static std::vector< ArgumentDescription > getArgumentList(base::OperationBase *ob, const int arity, std::vector< std::string > const &types)
boost::intrusive_ptr< DataSource< T > > shared_ptr
static std::string description(base::OperationBase *ob)
unsigned int arity() const
Returns the arity (number of arguments) of this operation.
A special DataSource only to be used for if you understand the copy()/clone() semantics very well...
virtual std::string getName() const
Returns the name of this operation.
virtual base::DataSourceBase::shared_ptr produceCollect(const std::vector< base::DataSourceBase::shared_ptr > &args, DataSource< bool >::shared_ptr blocking) const
Create a DataSource for collecting the results of a Send.
virtual base::DataSourceBase::shared_ptr produceHandle() const
Create an empty SendHandle object for this operation.
base::DataSourceBase::shared_ptr produce(ArgList const &args, ExecutionEngine *caller) const
boost::shared_ptr< base::DisposableInterface > getLocalOperation() const
Returns any local operation associated with this operation.
create_sequence< typename boost::function_types::parameter_types< Signature >::type > SequenceFactory
The factory for converting data sources to C++ types in call()
base::DataSourceBase::shared_ptr produce(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
Create a DataSource for a given callable operation.
virtual base::DataSourceBase::shared_ptr produceSend(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
Create a DataSource for a given send operation.
virtual base::DataSourceBase::shared_ptr produceCollect(const std::vector< base::DataSourceBase::shared_ptr > &args, DataSource< bool >::shared_ptr blocking) const
Create a DataSource for collecting the results of a Send.
unsigned int collectArity() const
Returns the number of collectable arguments of this operation's function.
Exception thrown when a factory is requested to create an object but the wrong number of arguments wa...
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
create_sequence< typename boost::function_types::parameter_types< typename CollectType< Signature >::type >::type > CollectSequenceFactory
The factory for converting data sources to C++ types in collect(). This includes SendHandle.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
OperationInterfacePart implementation that only provides synchronous access to an operation...
virtual base::DataSourceBase::shared_ptr produceCollect(const std::vector< base::DataSourceBase::shared_ptr > &args, internal::DataSource< bool >::shared_ptr blocking) const
Create a DataSource for collecting the results of a Send.
boost::shared_ptr< base::DisposableInterface > getLocalOperation() const
Returns any local operation associated with this operation.
const std::string & getName()
Returns the name of this operation.
A Function object that reacts to a Signal by writing the arguments in data sources and calling an act...
The Handle holds the information, and allows manipulation, of a connection between a internal::Signal...
A DataSource that sends a method which gets its arguments from other data sources.
virtual std::string getName() const
Returns the name of this operation.
Exception thrown when a factory is requested to produce an asynchronous object while it is not availa...
unsigned int collectArity() const
Returns the number of collectable arguments of this operation's function.
virtual base::DataSourceBase::shared_ptr produceSend(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const
Create a DataSource for a given send operation.
OperationInterfacePartFused(Operation< Signature > *o)