39 #ifndef ORO_TASK_BIND_STORAGE_HPP 40 #define ORO_TASK_BIND_STORAGE_HPP 42 #include <boost/function.hpp> 43 #include <boost/type_traits/function_traits.hpp> 44 #include <boost/bind.hpp> 45 #include <boost/fusion/include/vector.hpp> 46 #include <boost/fusion/include/filter_if.hpp> 48 #include "../Logger.hpp" 50 #ifdef ORO_SIGNALLING_OPERATIONS 58 namespace bf=boost::fusion;
59 namespace mpl=boost::mpl;
72 T&
get() {
return arg; }
74 operator T() {
return arg;}
85 T&
get() {
return *
arg; }
87 operator T&() {
return *
arg;}
91 std::ostream& operator<<(std::ostream& o, AStore<T>& a) { o <<
"aarg:"<<a.get();
return o;}
97 RStore() : executed(false), error(false) {}
100 if(error)
throw std::runtime_error(
"Unable to complete the operation call. The called operation has thrown an exception");
116 }
catch (std::exception& e) {
117 log(
Error) <<
"Exception raised while executing an operation : " << e.what() << endlog();
120 log(
Error) <<
"Unknown exception raised while executing an operation." << endlog();
143 operator T&() {
return arg;}
156 }
catch (std::exception& e) {
157 log(
Error) <<
"Exception raised while executing an operation : " << e.what() << endlog();
160 log(
Error) <<
"Unknown exception raised while executing an operation." << endlog();
178 }
catch (std::exception& e) {
179 log(
Error) <<
"Exception raised while executing an operation : " << e.what() << endlog();
182 log(
Error) <<
"Unknown exception raised while executing an operation." << endlog();
191 operator T&() { checkError();
return *
arg;}
200 operator T&() { checkError();
return arg;}
213 }
catch (std::exception& e) {
214 log(
Error) <<
"Exception raised while executing an operation : " << e.what() << endlog();
217 log(
Error) <<
"Unknown exception raised while executing an operation." << endlog();
226 std::ostream& operator<<(std::ostream& o, RStore<T>& a) { o <<
"rarg:"<<a.result();
return o;}
268 template<
int,
class T>
275 template<
class ToBind>
278 typedef typename boost::function_traits<ToBind>::result_type
result_type;
285 bf::vector< RStore<result_type>&>
vStore;
286 #ifdef ORO_SIGNALLING_OPERATIONS 298 #ifdef ORO_SIGNALLING_OPERATIONS 299 if (msig) msig->emit();
311 template<
class ToBind>
314 typedef typename boost::function_traits<ToBind>::result_type
result_type;
315 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
325 #ifdef ORO_SIGNALLING_OPERATIONS 335 void store(arg1_type t1) { a1(t1); }
337 #ifdef ORO_SIGNALLING_OPERATIONS 338 if (msig) (*msig)(a1.
get());
341 retv.
exec( boost::bind(mmeth, boost::ref(a1.
get()) ) );
348 template<
class ToBind>
351 typedef typename boost::function_traits<ToBind>::result_type
result_type;
352 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
353 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
364 #ifdef ORO_SIGNALLING_OPERATIONS 375 void store(arg1_type t1, arg2_type t2) { a1(t1); a2(t2); }
377 #ifdef ORO_SIGNALLING_OPERATIONS 378 if (msig) (*msig)(a1.
get(), a2.
get());
381 retv.
exec( boost::bind(mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()) ) );
388 template<
class ToBind>
391 typedef typename boost::function_traits<ToBind>::result_type
result_type;
392 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
393 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
394 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
406 #ifdef ORO_SIGNALLING_OPERATIONS 417 void store(arg1_type t1, arg2_type t2, arg3_type t3) { a1(t1); a2(t2); a3(t3); }
419 #ifdef ORO_SIGNALLING_OPERATIONS 420 if (msig) (*msig)(a1.
get(), a2.
get(), a3.
get());
423 retv.
exec( boost::bind(mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()), boost::ref(a3.
get()) ) );
429 template<
class ToBind>
432 typedef typename boost::function_traits<ToBind>::result_type
result_type;
433 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
434 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
435 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
436 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
449 #ifdef ORO_SIGNALLING_OPERATIONS 460 void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4) { a1(t1); a2(t2); a3(t3); a4(t4); }
462 #ifdef ORO_SIGNALLING_OPERATIONS 463 if (msig) (*msig)(a1.
get(), a2.
get(), a3.
get(), a4.
get());
466 retv.
exec( boost::bind( mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()), boost::ref(a3.
get()), boost::ref(a4.
get()) ) );
472 template<
class ToBind>
475 typedef typename boost::function_traits<ToBind>::result_type
result_type;
476 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
477 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
478 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
479 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
480 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
494 #ifdef ORO_SIGNALLING_OPERATIONS 505 void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5) { a1(t1); a2(t2); a3(t3); a4(t4); a5(t5);}
507 #ifdef ORO_SIGNALLING_OPERATIONS 511 retv.
exec( boost::bind( mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()), boost::ref(a3.
get()), boost::ref(a4.
get()), boost::ref(a5.
get()) ) );
517 template<
class ToBind>
520 typedef typename boost::function_traits<ToBind>::result_type
result_type;
521 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
522 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
523 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
524 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
525 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
526 typedef typename boost::function_traits<ToBind>::arg6_type
arg6_type;
541 #ifdef ORO_SIGNALLING_OPERATIONS 552 void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6) { a1(t1); a2(t2); a3(t3); a4(t4); a5(t5); a6(t6);}
554 #ifdef ORO_SIGNALLING_OPERATIONS 558 retv.
exec( boost::bind( mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()), boost::ref(a3.
get()), boost::ref(a4.
get()), boost::ref(a5.
get()), boost::ref(a6.
get()) ) );
564 template<
class ToBind>
567 typedef typename boost::function_traits<ToBind>::result_type
result_type;
568 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
569 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
570 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
571 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
572 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
573 typedef typename boost::function_traits<ToBind>::arg6_type
arg6_type;
574 typedef typename boost::function_traits<ToBind>::arg7_type
arg7_type;
590 #ifdef ORO_SIGNALLING_OPERATIONS 601 void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7) { a1(t1); a2(t2); a3(t3); a4(t4); a5(t5); a6(t6); a7(t7);}
603 #ifdef ORO_SIGNALLING_OPERATIONS 607 retv.
exec( boost::bind( mmeth, boost::ref(a1.
get()), boost::ref(a2.
get()), boost::ref(a3.
get()), boost::ref(a4.
get()), boost::ref(a5.
get()), boost::ref(a6.
get()), boost::ref(a7.
get()) ) );
632 template<
class ToBind>
634 :
public BindStorageImpl<boost::function_traits<ToBind>::arity, ToBind>
bf::vector< RStore< result_type > &, AStore< arg1_type > & > vStore
RStore< result_type > retv
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > &, AStore< arg3_type > &, AStore< arg4_type > &, AStore< arg5_type > & > vStore
boost::function_traits< ToBind >::arg2_type arg2_type
boost::function< ToBind > mmeth
boost::function_traits< ToBind >::arg5_type arg5_type
boost::function_traits< ToBind >::arg5_type arg5_type
BindStorageImpl(const BindStorageImpl &orig)
boost::function_traits< ToBind >::result_type result_type
RStore< result_type > retv
RStore< result_type > retv
boost::function< ToBind > mmeth
boost::function_traits< ToBind >::arg3_type arg3_type
boost::function_traits< ToBind >::arg1_type arg1_type
void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
boost::function_traits< ToBind >::arg1_type arg1_type
boost::function_traits< ToBind >::result_type result_type
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > &, AStore< arg3_type > &, AStore< arg4_type > & > vStore
void store(arg1_type t1, arg2_type t2, arg3_type t3)
Store a bound argument which may be a reference, const reference or any other type.
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > & > vStore
boost::function< ToBind > mmeth
void exec(F f)
Stores the result of a function.
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > &, AStore< arg3_type > & > vStore
boost::function_traits< ToBind >::result_type result_type
boost::function_traits< ToBind >::arg2_type arg2_type
bf::vector< RStore< result_type > & > vStore
void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
boost::function_traits< ToBind >::arg6_type arg6_type
boost::function_traits< ToBind >::arg2_type arg2_type
BindStorageImpl(const BindStorageImpl &orig)
boost::function_traits< ToBind >::arg4_type arg4_type
boost::function_traits< ToBind >::arg4_type arg4_type
boost::function_traits< ToBind >::arg3_type arg3_type
RStore< result_type > RStoreType
boost::function_traits< ToBind >::result_type result_type
RStore< result_type > RStoreType
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > &, AStore< arg3_type > &, AStore< arg4_type > &, AStore< arg5_type > &, AStore< arg6_type > & > vStore
BindStorageImpl(const BindStorageImpl &orig)
boost::function< ToBind > mmeth
boost::function_traits< ToBind >::arg1_type arg1_type
Store a return value which may be a void, reference, const reference or any other type...
boost::function_traits< ToBind >::result_type result_type
BindStorageImpl(const BindStorageImpl &orig)
A helper-class for the Command implementation which stores the command and collition function objects...
void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
#define ORO_SIGNALLING_OPERATIONS
boost::function_traits< ToBind >::arg7_type arg7_type
void store(arg1_type t1, arg2_type t2)
boost::function_traits< ToBind >::arg1_type arg1_type
boost::function_traits< ToBind >::arg3_type arg3_type
RStore< result_type > retv
boost::shared_ptr< Signal< Signature, TSlotFunction > > shared_ptr
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > &, AStore< arg3_type > &, AStore< arg4_type > &, AStore< arg5_type > &, AStore< arg6_type > &, AStore< arg7_type > & > vStore
RStore< result_type > retv
boost::function_traits< ToBind >::arg1_type arg1_type
BindStorageImpl(const BindStorageImpl &orig)
void exec(F f)
Stores the result of a function.
boost::function< ToBind > mmeth
RStore< result_type > RStoreType
boost::function_traits< ToBind >::arg5_type arg5_type
boost::function< ToBind > mmeth
boost::function_traits< ToBind >::arg4_type arg4_type
Outargs are of type AStore and contain a pure reference.
This class is used to return a 'default' value when no value is available ('Not Available').
boost::function_traits< ToBind >::arg1_type arg1_type
RStore< result_type > RStoreType
boost::function_traits< ToBind >::arg6_type arg6_type
RStore< result_type > RStoreType
BindStorageImpl(const BindStorageImpl &orig)
void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
boost::function_traits< ToBind >::arg2_type arg2_type
boost::function< ToBind > mmeth
RStore< result_type > retv
BindStorageImpl(const BindStorageImpl &orig)
boost::function< ToBind > mmeth
boost::function_traits< ToBind >::arg4_type arg4_type
boost::function_traits< ToBind >::arg1_type arg1_type
boost::function_traits< ToBind >::arg3_type arg3_type
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
boost::function_traits< ToBind >::result_type result_type
This helper struct is required to filter out the AStore elements that don't need to be returned to th...
RStore< result_type > RStoreType
RStore< result_type > RStoreType
boost::function_traits< ToBind >::result_type result_type
boost::function_traits< ToBind >::arg3_type arg3_type
RStore< result_type > RStoreType
boost::function_traits< ToBind >::arg2_type arg2_type
RStore< result_type > retv
boost::function_traits< ToBind >::result_type result_type
RStore< result_type > retv
boost::function_traits< ToBind >::arg2_type arg2_type
BindStorageImpl(const BindStorageImpl &orig)