Orocos Real-Time Toolkit  2.8.3
Invoker.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:05:58 CET 2006 Invoker.hpp
3 
4  Invoker.hpp - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 FMTC
8  email : peter.soetens@fmtc.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 #ifndef ORO_INVOKER_HPP
40 #define ORO_INVOKER_HPP
41 
42 #include <boost/function.hpp>
43 #include <boost/function_types/function_type.hpp>
44 #include <boost/type_traits.hpp>
45 #include "InvokerBase.hpp"
46 #include "Return.hpp"
47 
48 namespace RTT
49 {
50  namespace internal
51  {
52  template<int, class F, class BaseImpl>
53  struct InvokerImpl;
54 
60  template<class F, class BaseImpl>
61  struct Invoker
62  : public InvokerImpl<boost::function_traits<F>::arity, F, BaseImpl>
63  {};
64 
65  template<class F, class BaseImpl>
66  struct InvokerImpl<0,F,BaseImpl>
67  : public Return<F,BaseImpl> // inherits from BaseImpl
68  {
69  typedef typename boost::function_traits<F>::result_type result_type;
73  result_type call()
74  {
75  return BaseImpl::template call_impl<int>();
76  }
77 
79  {
80  return BaseImpl::send_impl();
81  }
82 
83  };
84 
85  template<class F, class BaseImpl>
86  struct InvokerImpl<1,F,BaseImpl>
87  : public Return<F,BaseImpl>
88  {
89  typedef typename boost::function_traits<F>::result_type result_type;
90  typedef typename boost::function_traits<F>::arg1_type arg1_type;
94  result_type call(arg1_type a1)
95  {
96  return BaseImpl::template call_impl<arg1_type>( a1 );
97  }
98  result_type ret(arg1_type a1)
99  {
100  return BaseImpl::template ret_impl<arg1_type>( a1 );
101  }
102  result_type ret()
103  {
104  return BaseImpl::ret_impl();
105  }
106  SendHandle<F> send(arg1_type a1)
107  {
108  return BaseImpl::template send_impl<arg1_type>( a1 );
109  }
110  };
111 
112  template<class F, class BaseImpl>
113  struct InvokerImpl<2,F,BaseImpl>
114  : public Return<F,BaseImpl>
115  {
116  typedef typename boost::function_traits<F>::result_type result_type;
117  typedef typename boost::function_traits<F>::arg1_type arg1_type;
118  typedef typename boost::function_traits<F>::arg2_type arg2_type;
119 
123  result_type call(arg1_type t1, arg2_type t2)
124  {
125  return BaseImpl::template call_impl<arg1_type, arg2_type>(t1, t2);
126  }
127 
128  result_type ret(arg1_type t1, arg2_type t2)
129  {
130  return BaseImpl::template ret_impl<arg1_type, arg2_type>(t1, t2);
131  }
132 
133  result_type ret()
134  {
135  return BaseImpl::ret_impl();
136  }
137 
138  SendHandle<F> send(arg1_type t1, arg2_type t2)
139  {
140  return BaseImpl::template send_impl<arg1_type, arg2_type>(t1, t2);
141  }
142  };
143 
144  template<class F, class BaseImpl>
145  struct InvokerImpl<3,F,BaseImpl>
146  : public Return<F,BaseImpl>
147  {
148  typedef typename boost::function_traits<F>::result_type result_type;
149  typedef typename boost::function_traits<F>::arg1_type arg1_type;
150  typedef typename boost::function_traits<F>::arg2_type arg2_type;
151  typedef typename boost::function_traits<F>::arg3_type arg3_type;
152 
156  result_type call(arg1_type t1, arg2_type t2, arg3_type t3)
157  {
158  return BaseImpl::template call_impl<arg1_type, arg2_type, arg3_type>(t1, t2, t3);
159  }
160 
161  result_type ret(arg1_type t1, arg2_type t2, arg3_type t3)
162  {
163  return BaseImpl::template ret_impl<arg1_type, arg2_type, arg3_type>(t1, t2, t3);
164  }
165 
166  result_type ret()
167  {
168  return BaseImpl::ret_impl();
169  }
170 
171  SendHandle<F> send(arg1_type t1, arg2_type t2, arg3_type t3)
172  {
173  return BaseImpl::template send_impl<arg1_type, arg2_type, arg3_type>(t1, t2, t3);
174  }
175 
176  };
177 
178  template<class F, class BaseImpl>
179  struct InvokerImpl<4,F,BaseImpl>
180  : public Return<F,BaseImpl>
181  {
182  typedef typename boost::function_traits<F>::result_type result_type;
183  typedef typename boost::function_traits<F>::arg1_type arg1_type;
184  typedef typename boost::function_traits<F>::arg2_type arg2_type;
185  typedef typename boost::function_traits<F>::arg3_type arg3_type;
186  typedef typename boost::function_traits<F>::arg4_type arg4_type;
187 
191  result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
192  {
193  return BaseImpl::template call_impl<arg1_type, arg2_type, arg3_type, arg4_type>(t1, t2, t3, t4);
194  }
195 
196  result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
197  {
198  return BaseImpl::template ret_impl<arg1_type, arg2_type, arg3_type, arg4_type>(t1, t2, t3, t4);
199  }
200 
201  result_type ret()
202  {
203  return BaseImpl::ret_impl();
204  }
205 
206  SendHandle<F> send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
207  {
208  return BaseImpl::template send_impl<arg1_type, arg2_type, arg3_type, arg4_type>(t1, t2, t3, t4);
209  }
210 
211  };
212 
213  template<class F, class BaseImpl>
214  struct InvokerImpl<5,F,BaseImpl>
215  : public Return<F,BaseImpl>
216  {
217  typedef typename boost::function_traits<F>::result_type result_type;
218  typedef typename boost::function_traits<F>::arg1_type arg1_type;
219  typedef typename boost::function_traits<F>::arg2_type arg2_type;
220  typedef typename boost::function_traits<F>::arg3_type arg3_type;
221  typedef typename boost::function_traits<F>::arg4_type arg4_type;
222  typedef typename boost::function_traits<F>::arg5_type arg5_type;
223 
227  result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
228  {
229  return BaseImpl::template call_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type>(t1, t2, t3, t4, t5);
230  }
231 
232  result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
233  {
234  return BaseImpl::template ret_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type>(t1, t2, t3, t4, t5);
235  }
236 
237  result_type ret()
238  {
239  return BaseImpl::ret_impl();
240  }
241 
242  SendHandle<F> send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
243  {
244  return BaseImpl::template send_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type>(t1, t2, t3, t4, t5);
245  }
246 
247  };
248 
249  template<class F, class BaseImpl>
250  struct InvokerImpl<6,F,BaseImpl>
251  : public Return<F,BaseImpl>
252  {
253  typedef typename boost::function_traits<F>::result_type result_type;
254  typedef typename boost::function_traits<F>::arg1_type arg1_type;
255  typedef typename boost::function_traits<F>::arg2_type arg2_type;
256  typedef typename boost::function_traits<F>::arg3_type arg3_type;
257  typedef typename boost::function_traits<F>::arg4_type arg4_type;
258  typedef typename boost::function_traits<F>::arg5_type arg5_type;
259  typedef typename boost::function_traits<F>::arg6_type arg6_type;
260 
264  result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
265  {
266  return BaseImpl::template call_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type>(t1, t2, t3, t4, t5, t6);
267  }
268 
269  result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
270  {
271  return BaseImpl::template ret_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type>(t1, t2, t3, t4, t5, t6);
272  }
273 
274  result_type ret()
275  {
276  return BaseImpl::ret_impl();
277  }
278 
279  SendHandle<F> send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
280  {
281  return BaseImpl::template send_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type>(t1, t2, t3, t4, t5, t6);
282  }
283 
284  };
285 
286  template<class F, class BaseImpl>
287  struct InvokerImpl<7,F,BaseImpl>
288  : public Return<F,BaseImpl>
289  {
290  typedef typename boost::function_traits<F>::result_type result_type;
291  typedef typename boost::function_traits<F>::arg1_type arg1_type;
292  typedef typename boost::function_traits<F>::arg2_type arg2_type;
293  typedef typename boost::function_traits<F>::arg3_type arg3_type;
294  typedef typename boost::function_traits<F>::arg4_type arg4_type;
295  typedef typename boost::function_traits<F>::arg5_type arg5_type;
296  typedef typename boost::function_traits<F>::arg6_type arg6_type;
297  typedef typename boost::function_traits<F>::arg7_type arg7_type;
298 
302  result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
303  {
304  return BaseImpl::template call_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type>(t1, t2, t3, t4, t5, t6, t7);
305  }
306 
307  result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
308  {
309  return BaseImpl::template ret_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type>(t1, t2, t3, t4, t5, t6, t7);
310  }
311 
312  result_type ret()
313  {
314  return BaseImpl::ret_impl();
315  }
316 
317  SendHandle<F> send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
318  {
319  return BaseImpl::template send_impl<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type>(t1, t2, t3, t4, t5, t6, t7);
320  }
321 
322  };
323 
324  }
325 }
326 #endif
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:218
boost::function_traits< F >::arg5_type arg5_type
Definition: Invoker.hpp:222
result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
Invoke this operator if the method has four arguments.
Definition: Invoker.hpp:191
boost::function_traits< F >::arg7_type arg7_type
Definition: Invoker.hpp:297
result_type call()
Invoke this operator if the method has no arguments.
Definition: Invoker.hpp:73
boost::function_traits< F >::arg3_type arg3_type
Definition: Invoker.hpp:185
SendHandle< F > send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
Definition: Invoker.hpp:206
result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
Invoke this operator if the method has four arguments.
Definition: Invoker.hpp:302
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:219
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:69
result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
Invoke this operator if the method has four arguments.
Definition: Invoker.hpp:264
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:149
result_type call(arg1_type a1)
Invoke this operator if the method has one argument.
Definition: Invoker.hpp:94
result_type call(arg1_type t1, arg2_type t2)
Invoke this operator if the method has two arguments.
Definition: Invoker.hpp:123
boost::function_traits< F >::arg4_type arg4_type
Definition: Invoker.hpp:294
Creates an invocation object with a function signature to invoke and an implementation in which an op...
Definition: Invoker.hpp:61
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:290
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:253
result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
Definition: Invoker.hpp:307
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:148
SendHandle< F > send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
Definition: Invoker.hpp:242
boost::function_traits< F >::arg3_type arg3_type
Definition: Invoker.hpp:220
result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4)
Definition: Invoker.hpp:196
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:117
boost::function_traits< F >::arg4_type arg4_type
Definition: Invoker.hpp:221
boost::function_traits< F >::arg6_type arg6_type
Definition: Invoker.hpp:259
boost::function_traits< F >::arg3_type arg3_type
Definition: Invoker.hpp:151
SendHandle< F > send(arg1_type t1, arg2_type t2)
Definition: Invoker.hpp:138
result_type call(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
Invoke this operator if the method has four arguments.
Definition: Invoker.hpp:227
boost::function_traits< F >::arg5_type arg5_type
Definition: Invoker.hpp:258
SendHandle< F > send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7)
Definition: Invoker.hpp:317
result_type ret(arg1_type t1, arg2_type t2, arg3_type t3)
Definition: Invoker.hpp:161
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:184
boost::function_traits< F >::arg4_type arg4_type
Definition: Invoker.hpp:257
result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5)
Definition: Invoker.hpp:232
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:292
The SendHandle is used to collect the result values of an asynchronous invocation.
Definition: rtt-fwd.hpp:79
boost::function_traits< F >::arg6_type arg6_type
Definition: Invoker.hpp:296
boost::function_traits< F >::arg3_type arg3_type
Definition: Invoker.hpp:293
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:150
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:116
boost::function_traits< F >::arg5_type arg5_type
Definition: Invoker.hpp:295
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:291
boost::function_traits< F >::arg3_type arg3_type
Definition: Invoker.hpp:256
result_type ret(arg1_type t1, arg2_type t2)
Definition: Invoker.hpp:128
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:182
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:217
SendHandle< F > send(arg1_type a1)
Definition: Invoker.hpp:106
SendHandle< F > send(arg1_type t1, arg2_type t2, arg3_type t3)
Definition: Invoker.hpp:171
boost::function_traits< F >::arg4_type arg4_type
Definition: Invoker.hpp:186
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:255
result_type call(arg1_type t1, arg2_type t2, arg3_type t3)
Invoke this operator if the method has three arguments.
Definition: Invoker.hpp:156
boost::function_traits< F >::arg2_type arg2_type
Definition: Invoker.hpp:118
result_type ret(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
Definition: Invoker.hpp:269
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:254
boost::function_traits< F >::result_type result_type
Definition: Invoker.hpp:89
SendHandle< F > send(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6)
Definition: Invoker.hpp:279
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:183
boost::function_traits< F >::arg1_type arg1_type
Definition: Invoker.hpp:90