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;
73 T&
get() {
return arg; }
75 operator T&() {
return arg; }
87 T&
get() {
return *
arg; }
89 operator T&() {
return *
arg; }
93 std::ostream& operator<<(std::ostream& o, AStore<T>& a) { o <<
"aarg:"<<a.get();
return o;}
99 RStore() : executed(false), error(false) {}
102 if(error)
throw std::runtime_error(
"Unable to complete the operation call. The called operation has thrown an exception");
118 }
catch (std::exception& e) {
119 log(
Error) <<
"Exception raised while executing an operation : " << e.what() <<
endlog();
122 log(
Error) <<
"Unknown exception raised while executing an operation." <<
endlog();
145 operator T&() {
return arg;}
158 }
catch (std::exception& e) {
159 log(
Error) <<
"Exception raised while executing an operation : " << e.what() <<
endlog();
162 log(
Error) <<
"Unknown exception raised while executing an operation." <<
endlog();
180 }
catch (std::exception& e) {
181 log(
Error) <<
"Exception raised while executing an operation : " << e.what() <<
endlog();
184 log(
Error) <<
"Unknown exception raised while executing an operation." <<
endlog();
193 operator T&() { checkError();
return *
arg;}
202 operator T&() { checkError();
return arg;}
215 }
catch (std::exception& e) {
216 log(
Error) <<
"Exception raised while executing an operation : " << e.what() <<
endlog();
219 log(
Error) <<
"Unknown exception raised while executing an operation." <<
endlog();
228 std::ostream& operator<<(std::ostream& o, RStore<T>& a) { o <<
"rarg:"<<a.result();
return o;}
270 template<
int,
class T>
277 template<
class ToBind>
280 typedef typename boost::function_traits<ToBind>::result_type
result_type;
287 bf::vector< RStore<result_type>&>
vStore;
288 #ifdef ORO_SIGNALLING_OPERATIONS 294 #ifdef ORO_SIGNALLING_OPERATIONS
300 #ifdef ORO_SIGNALLING_OPERATIONS 301 if (msig) msig->emit();
313 template<
class ToBind>
316 typedef typename boost::function_traits<ToBind>::result_type
result_type;
317 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
327 #ifdef ORO_SIGNALLING_OPERATIONS 333 #ifdef ORO_SIGNALLING_OPERATIONS
337 void store(arg1_type t1) { a1(t1); }
339 #ifdef ORO_SIGNALLING_OPERATIONS 340 if (msig) (*msig)(a1);
343 retv.
exec( boost::bind(mmeth, a1 ) );
350 template<
class ToBind>
353 typedef typename boost::function_traits<ToBind>::result_type
result_type;
354 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
355 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
366 #ifdef ORO_SIGNALLING_OPERATIONS 372 #ifdef ORO_SIGNALLING_OPERATIONS
377 void store(arg1_type t1, arg2_type t2) { a1(t1); a2(t2); }
379 #ifdef ORO_SIGNALLING_OPERATIONS 380 if (msig) (*msig)(a1, a2);
383 retv.
exec( boost::bind(mmeth, a1, a2 ) );
390 template<
class ToBind>
393 typedef typename boost::function_traits<ToBind>::result_type
result_type;
394 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
395 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
396 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
408 #ifdef ORO_SIGNALLING_OPERATIONS 414 #ifdef ORO_SIGNALLING_OPERATIONS
419 void store(arg1_type t1, arg2_type t2, arg3_type t3) { a1(t1); a2(t2); a3(t3); }
421 #ifdef ORO_SIGNALLING_OPERATIONS 422 if (msig) (*msig)(a1, a2, a3);
425 retv.
exec( boost::bind(mmeth, a1, a2, a3 ) );
431 template<
class ToBind>
434 typedef typename boost::function_traits<ToBind>::result_type
result_type;
435 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
436 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
437 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
438 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
451 #ifdef ORO_SIGNALLING_OPERATIONS 457 #ifdef ORO_SIGNALLING_OPERATIONS
462 void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4) { a1(t1); a2(t2); a3(t3); a4(t4); }
464 #ifdef ORO_SIGNALLING_OPERATIONS 465 if (msig) (*msig)(a1, a2, a3, a4);
468 retv.
exec( boost::bind( mmeth, a1, a2, a3, a4 ) );
474 template<
class ToBind>
477 typedef typename boost::function_traits<ToBind>::result_type
result_type;
478 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
479 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
480 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
481 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
482 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
496 #ifdef ORO_SIGNALLING_OPERATIONS 502 #ifdef ORO_SIGNALLING_OPERATIONS
507 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);}
509 #ifdef ORO_SIGNALLING_OPERATIONS 510 if (msig) (*msig)(a1, a2, a3, a4, a5);
513 retv.
exec( boost::bind( mmeth, a1, a2, a3, a4, a5 ) );
519 template<
class ToBind>
522 typedef typename boost::function_traits<ToBind>::result_type
result_type;
523 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
524 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
525 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
526 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
527 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
528 typedef typename boost::function_traits<ToBind>::arg6_type
arg6_type;
543 #ifdef ORO_SIGNALLING_OPERATIONS 549 #ifdef ORO_SIGNALLING_OPERATIONS
554 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);}
556 #ifdef ORO_SIGNALLING_OPERATIONS 557 if (msig) (*msig)(a1, a2, a3, a4, a5, a6);
560 retv.
exec( boost::bind( mmeth, a1, a2, a3, a4, a5, a6 ) );
566 template<
class ToBind>
569 typedef typename boost::function_traits<ToBind>::result_type
result_type;
570 typedef typename boost::function_traits<ToBind>::arg1_type
arg1_type;
571 typedef typename boost::function_traits<ToBind>::arg2_type
arg2_type;
572 typedef typename boost::function_traits<ToBind>::arg3_type
arg3_type;
573 typedef typename boost::function_traits<ToBind>::arg4_type
arg4_type;
574 typedef typename boost::function_traits<ToBind>::arg5_type
arg5_type;
575 typedef typename boost::function_traits<ToBind>::arg6_type
arg6_type;
576 typedef typename boost::function_traits<ToBind>::arg7_type
arg7_type;
592 #ifdef ORO_SIGNALLING_OPERATIONS 598 #ifdef ORO_SIGNALLING_OPERATIONS
603 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);}
605 #ifdef ORO_SIGNALLING_OPERATIONS 606 if (msig) (*msig)(a1, a2, a3, a4, a5, a6, a7);
609 retv.
exec( boost::bind( mmeth, a1, a2, a3, a4, a5, a6, a7 ) );
634 template<
class ToBind>
636 :
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)
bf::vector< RStore< result_type > &, AStore< arg1_type > &, AStore< arg2_type > & > vStore
boost::function< ToBind > mmeth
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
boost::function_traits< ToBind >::result_type result_type
BindStorageImpl(const BindStorageImpl &orig)
void store(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
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)
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
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
RStore< result_type > RStoreType
RStore< result_type > RStoreType
static Logger::LogFunction endlog()
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)