39 #ifndef ORO_REMOTE_METHOD_HPP 40 #define ORO_REMOTE_METHOD_HPP 42 #include <boost/function.hpp> 44 #include "../base/OperationCallerBase.hpp" 49 #include <boost/fusion/include/vector_tie.hpp> 50 #include <boost/fusion/include/filter_if.hpp> 51 #include <boost/fusion/include/as_vector.hpp> 59 namespace bf = ::boost::fusion;
70 template<
class OperationCallerT>
82 typedef typename boost::function_traits<OperationCallerT>::result_type
result_type;
95 : mmeth(), mhandle(handle)
99 virtual bool isError()
const {
return false; }
107 template<
class Xignored>
110 return sendargs.getResult();
115 sendargs.store( a1 );
117 return sendargs.getResult();
120 template<
class T1,
class T2>
122 sendargs.store( a1, a2 );
124 return sendargs.getResult();
127 template<
class T1,
class T2,
class T3>
129 sendargs.store( a1, a2, a3 );
131 return sendargs.getResult();
134 template<
class T1,
class T2,
class T3,
class T4>
136 sendargs.store( a1, a2, a3, a4 );
138 return sendargs.getResult();
141 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
142 result_type
call_impl( T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6 ) {
143 sendargs.store( a1, a2, a3, a4, a5, a6 );
145 return sendargs.getResult();
148 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
149 result_type
call_impl( T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7 ) {
150 sendargs.store( a1, a2, a3, a4, a5, a6, a7 );
152 return sendargs.getResult();
155 template<
class T1,
class T2,
class T3,
class T4,
class T5>
156 result_type
call_impl( T1 a1, T2 a2, T3 a3, T4 a4, T5 a5 ) {
157 sendargs.store( a1, a2, a3, a4, a5 );
159 return sendargs.getResult();
163 mhandle = mmeth.
send();
170 sendargs.store( a1 );
171 mhandle = mmeth.
send();
175 template<
class T1,
class T2>
177 sendargs.store( a1, a2 );
178 mhandle = mmeth.
send();
182 template<
class T1,
class T2,
class T3>
184 sendargs.store( a1, a2, a3 );
185 mhandle = mmeth.
send();
189 template<
class T1,
class T2,
class T3,
class T4>
191 sendargs.store( a1, a2, a3, a4 );
192 mhandle = mmeth.
send();
196 template<
class T1,
class T2,
class T3,
class T4,
class T5>
198 sendargs.store( a1, a2, a3, a4, a5 );
199 mhandle = mmeth.
send();
203 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
205 sendargs.store( a1, a2, a3, a4, a5, a6 );
206 mhandle = mmeth.
send();
210 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
212 sendargs.store( a1, a2, a3, a4, a5, a6, a7 );
213 mhandle = mmeth.
send();
226 collectargs.store( a1 );
233 template<
class T1,
class T2>
235 collectargs.store( a1, a2);
242 template<
class T1,
class T2,
class T3>
244 collectargs.store( a1, a2, a3);
251 template<
class T1,
class T2,
class T3,
class T4>
253 collectargs.store( a1, a2, a3, a4);
260 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
262 collectargs.store( a1, a2, a3, a4, a5, a6);
269 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
271 collectargs.store( a1, a2, a3, a4, a5, a6, a7 );
278 template<
class T1,
class T2,
class T3,
class T4,
class T5>
280 collectargs.store( a1, a2, a3, a4, a5);
292 collectargs.store( a1 );
296 template<
class T1,
class T2>
298 collectargs.store( a1, a2);
302 template<
class T1,
class T2,
class T3>
304 collectargs.store( a1, a2, a3);
308 template<
class T1,
class T2,
class T3,
class T4>
310 collectargs.store( a1, a2, a3, a4);
314 template<
class T1,
class T2,
class T3,
class T4,
class T5>
316 collectargs.store( a1, a2, a3, a4, a5);
322 return sendargs.getResult();
333 sendargs.store( a1 );
335 return sendargs.getResult();
338 template<
class T1,
class T2>
341 sendargs.store( a1, a2 );
343 return sendargs.getResult();
346 template<
class T1,
class T2,
class T3>
349 sendargs.store( a1, a2, a3 );
351 return sendargs.getResult();
354 template<
class T1,
class T2,
class T3,
class T4>
357 sendargs.store( a1, a2, a3, a4 );
359 return sendargs.getResult();
362 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
363 result_type
ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
365 sendargs.store( a1, a2, a3, a4, a5, a6 );
367 return sendargs.getResult();
370 template<
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
371 result_type
ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
373 sendargs.store( a1, a2, a3, a4, a5, a6, a7 );
375 return sendargs.getResult();
378 template<
class T1,
class T2,
class T3,
class T4,
class T5>
379 result_type
ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
381 sendargs.store( a1, a2, a3, a4, a5);
383 return sendargs.getResult();
403 template<
class OperationCallerT>
405 :
public Invoker<OperationCallerT,RemoteOperationCallerImpl<OperationCallerT> >
SendStatus collect_impl(T1 &a1)
virtual bool ready() const
virtual bool isError() const
result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
SendStatus collect_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4, T5 &a5)
bool ready() const
Returns true if this method is ready for execution.
SendStatus collectIfDone_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4, T5 &a5, T6 &a6)
SendHandleC send()
Send the contained method.
SendStatus collectIfDone_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4)
result_type ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
virtual void setCaller(ExecutionEngine *caller)
SendStatus collectIfDone_impl()
virtual base::OperationCallerBase< OperationCallerT > * cloneI(ExecutionEngine *caller) const
SendHandle< Signature > send_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
virtual void setCaller(ExecutionEngine *ee)
Sets the caller's engine of this operation.
Creates an invocation object with a function signature to invoke and an implementation in which an op...
result_type ret_impl(T1 a1)
This function has the same signature of call() and returns the stored return value, and tries to return all arguments.
SendHandle< Signature > send_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
DataSourceStorage< OperationCallerT > sendargs
SendStatus collectIfDone_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4, T5 &a5)
SendHandle< Signature > send_impl(T1 a1, T2 a2, T3 a3, T4 a4)
SendStatus collect_impl()
void setAutoCollect(bool on_off)
When set to 'on', the destruction of this SendHandleC will cause a call to collect() before all data ...
virtual void executeAndDispose()
Execute functionality and free this object.
SendStatus collect()
Collect the contained method.
result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4)
RemoteOperationCaller(OperationInterfacePart *of, std::string name, ExecutionEngine *caller=0)
Create a RemoteOperationCaller object which executes a remote method.
SendStatus collectIfDone_impl(T1 &a1, T2 &a2)
result_type ret_impl(T1 a1, T2 a2, T3 a3, T4 a4)
result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
The base class for all method implementations.
An execution engine serialises (executes one after the other) the execution of all commands...
SendStatus
Returns the status of a send() or collect() invocation.
SendStatus collect_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4)
SendHandle< Signature > send_impl(T1 a1, T2 a2, T3 a3)
SendStatus collect_impl(T1 &a1, T2 &a2)
A template-less SendHandle manager.
A OperationCaller implementation which delegates C++ to datasource conversions when C++ code tries to...
RemoteOperationCallerImpl(SendHandleC handle)
Create from a sendhandle.
result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
result_type ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
The SendHandle is used to collect the result values of an asynchronous invocation.
SendHandle< Signature > send_impl(T1 a1)
OperationCallerT Signature
SendStatus collectIfDone_impl(T1 &a1)
A template-less manager for OperationCaller calls.
SendStatus collectIfDone()
Collect the contained method.
DataSourceStorage< typename CollectType< OperationCallerT >::type > collectargs
SendHandle< Signature > send_impl()
This class defines the interface for creating operation objects without using C++ templates...
bool call()
Call the contained method.
virtual void dispose()
Just free this object without executing it.
RemoteOperationCallerImpl()
The defaults are reset by the constructor.
Returned when the send() succeeded, but the operation has not yet been executed by the receiving comp...
SendHandle< Signature > send_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
result_type call_impl()
Call this operator if the RemoteOperationCaller takes no arguments.
SendHandle< Signature > send_impl(T1 a1, T2 a2)
SendStatus collect_impl(T1 &a1, T2 &a2, T3 &a3)
Returned when the send() failed to deliver the operation call to the receiving component.
This struct takes the user's Function signature F and transforms it to the form required in the Colle...
result_type ret_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
result_type ret_impl(T1 a1, T2 a2)
SendStatus collectIfDone_impl(T1 &a1, T2 &a2, T3 &a3, T4 &a4, T5 &a5, T6 &a6, T7 &a7)
std::string const & getName() const
Returns the name of the operation that will be called.
result_type call_impl(T1 a1)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
OperationInterfacePart * getOrp() const
Returns the factory which we use to produce the operation call.
RemoteOperationCaller(const SendHandleC &sh)
A OperationCaller implementation which executes a remote function which is encapsulated in a Operatio...
result_type ret_impl(T1 a1, T2 a2, T3 a3)
result_type call_impl(T1 a1, T2 a2)
result_type call_impl(T1 a1, T2 a2, T3 a3)
SendStatus collectIfDone_impl(T1 &a1, T2 &a2, T3 &a3)
OperationCallerT Signature
boost::function_traits< OperationCallerT >::result_type result_type