39 #ifndef ORO_TEMPLATE_CONSTRUCTOR_HPP 40 #define ORO_TEMPLATE_CONSTRUCTOR_HPP 43 #include "../internal/FusedFunctorDataSource.hpp" 44 #include "../internal/CreateSequence.hpp" 45 #include "../Logger.hpp" 47 #include <boost/type_traits/function_traits.hpp> 48 #include <boost/function.hpp> 50 #include "../rtt-config.h" 63 struct TemplateConstructor
64 :
public TypeConstructor
66 typedef typename boost::function_traits<S>::result_type
result_type;
67 typedef typename boost::function_traits<S>::arg1_type
arg1_type;
70 boost::function<S>
ff;
75 : ff(f), automatic(autom)
80 if ( args.size() != boost::function_traits<S>::arity )
90 if ( boost::function_traits<S>::arity != 1) {
104 std::vector<base::DataSourceBase::shared_ptr> args;
109 log(
Warning) <<
"Conversion from " << arg->getTypeName() <<
" to " << ret->getTypeName() <<endlog();
121 template<
class Function>
134 template<
class Object>
The constructor classes allow to define type constructors or type conversions (convert type B from ty...
TemplateConstructor(FInit f, bool autom)
This class can create three kinds of Boost Fusion Sequences.
TypeConstructor * newConstructor(Function *foo, bool automatic=false)
Create a new Constructor.
static const types::TypeInfo * getTypeInfo()
Return the typeinfo object.
static type sources(std::vector< base::DataSourceBase::shared_ptr >::const_iterator args, int argnbr=1)
Converts a std::vector of DataSourceBase types into a boost::fusion Sequence of DataSources of the ty...
internal::create_sequence< typename boost::function_types::parameter_types< S >::type > SequenceFactory
boost::function_traits< S >::result_type result_type
virtual base::DataSourceBase::shared_ptr build(const std::vector< base::DataSourceBase::shared_ptr > &args) const
Inspect args and return a type constructed with these args if such a constructor exists.
boost::function_traits< S >::arg1_type arg1_type
virtual base::DataSourceBase::shared_ptr convert(base::DataSourceBase::shared_ptr arg) const
Automatic type conversion (float->double,...
This interface describes how constructors work.
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.
A DataSource that calls a functor of signature Signature which gets its arguments from other data sou...