Orocos Real-Time Toolkit  2.9.0
Collect.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 Collect.hpp
3 
4  Collect.hpp - description
5  -------------------
6  begin : Tue September 07 2010
7  copyright : (C) 2010 The SourceWorks
8  email : peter@thesourceworks.com
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_COLLECT_HPP
40 #define ORO_COLLECT_HPP
41 
42 #include "CollectSignature.hpp"
43 #include "../SendStatus.hpp"
44 #include <boost/function.hpp>
45 #include <boost/type_traits.hpp>
46 
47 namespace RTT
48 {
49  namespace internal
50  {
51  template<int, class Ft, class BaseImpl>
52  struct CollectImpl;
53 
59  template<class F, class BaseImpl>
60  struct Collect
61  : public CollectImpl< boost::function_traits< typename CollectType<F>::Ft >::arity, typename CollectType<F>::Ft, BaseImpl >
62  {
63  typedef typename boost::function_traits< F >::result_type result_type;
65 
67  {
68  return BaseImpl::collect_impl();
69  }
70 
72  {
73  return BaseImpl::collectIfDone_impl();
74  }
75 
76  result_type ret()
77  {
78  return BaseImpl::ret_impl();
79  }
80 
81  };
82 
83  template<class Ft, class BaseImpl>
84  struct CollectImpl<0,Ft,BaseImpl>
85  : public BaseImpl
86  {
87  virtual ~CollectImpl() {}
88  };
89 
90  template<class Ft, class BaseImpl>
91  struct CollectImpl<1,Ft,BaseImpl>
92  : public BaseImpl
93  {
94  typedef typename boost::function<Ft>::arg1_type arg1_type;
95  virtual ~CollectImpl() {}
96 
101  virtual SendStatus collect()
102  {
103  return BaseImpl::collect_impl();
104  }
110  virtual SendStatus collect(arg1_type a1)
111  {
112  return BaseImpl::collect_impl(a1);
113  }
114  virtual SendStatus collectIfDone(arg1_type a1)
115  {
116  return BaseImpl::collectIfDone_impl(a1);
117  }
118  };
119 
120  template<class Ft, class BaseImpl>
121  struct CollectImpl<2,Ft,BaseImpl>
122  : public BaseImpl
123  {
124  typedef typename boost::function<Ft>::arg1_type arg1_type;
125  typedef typename boost::function<Ft>::arg2_type arg2_type;
126  virtual ~CollectImpl() {}
127 
132  virtual SendStatus collect()
133  {
134  return BaseImpl::collect_impl();
135  }
141  virtual SendStatus collect(arg1_type a1, arg2_type a2)
142  {
143  return BaseImpl::collect_impl(a1,a2);
144  }
145  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2)
146  {
147  return BaseImpl::collectIfDone_impl(a1,a2);
148  }
149  };
150 
151  template<class Ft, class BaseImpl>
152  struct CollectImpl<3,Ft,BaseImpl>
153  : public BaseImpl
154  {
155  typedef typename boost::function<Ft>::arg1_type arg1_type;
156  typedef typename boost::function<Ft>::arg2_type arg2_type;
157  typedef typename boost::function<Ft>::arg3_type arg3_type;
158  virtual ~CollectImpl() {}
159 
164  virtual SendStatus collect()
165  {
166  return BaseImpl::collect_impl();
167  }
173  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3)
174  {
175  return BaseImpl::collect_impl(a1,a2,a3);
176  }
177  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3)
178  {
179  return BaseImpl::collectIfDone_impl(a1,a2,a3);
180  }
181  };
182 
183  template<class Ft, class BaseImpl>
184  struct CollectImpl<4,Ft,BaseImpl>
185  : public BaseImpl
186  {
187  typedef typename boost::function<Ft>::arg1_type arg1_type;
188  typedef typename boost::function<Ft>::arg2_type arg2_type;
189  typedef typename boost::function<Ft>::arg3_type arg3_type;
190  typedef typename boost::function<Ft>::arg4_type arg4_type;
191  virtual ~CollectImpl() {}
192 
197  virtual SendStatus collect()
198  {
199  return BaseImpl::collect_impl();
200  }
206  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
207  {
208  return BaseImpl::collect_impl(a1,a2,a3,a4);
209  }
210  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
211  {
212  return BaseImpl::collectIfDone_impl(a1,a2,a3,a4);
213  }
214  };
215 
216  template<class Ft, class BaseImpl>
217  struct CollectImpl<5,Ft,BaseImpl>
218  : public BaseImpl
219  {
220  typedef typename boost::function<Ft>::arg1_type arg1_type;
221  typedef typename boost::function<Ft>::arg2_type arg2_type;
222  typedef typename boost::function<Ft>::arg3_type arg3_type;
223  typedef typename boost::function<Ft>::arg4_type arg4_type;
224  typedef typename boost::function<Ft>::arg5_type arg5_type;
225  virtual ~CollectImpl() {}
226 
231  virtual SendStatus collect()
232  {
233  return BaseImpl::collect_impl();
234  }
240  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
241  {
242  return BaseImpl::collect_impl(a1,a2,a3,a4,a5);
243  }
244  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
245  {
246  return BaseImpl::collectIfDone_impl(a1,a2,a3,a4,a5);
247  }
248  };
249 
250  template<class Ft, class BaseImpl>
251  struct CollectImpl<6,Ft,BaseImpl>
252  : public BaseImpl
253  {
254  typedef typename boost::function<Ft>::arg1_type arg1_type;
255  typedef typename boost::function<Ft>::arg2_type arg2_type;
256  typedef typename boost::function<Ft>::arg3_type arg3_type;
257  typedef typename boost::function<Ft>::arg4_type arg4_type;
258  typedef typename boost::function<Ft>::arg5_type arg5_type;
259  typedef typename boost::function<Ft>::arg6_type arg6_type;
260  virtual ~CollectImpl() {}
261 
266  virtual SendStatus collect()
267  {
268  return BaseImpl::collect_impl();
269  }
275  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
276  {
277  return BaseImpl::collect_impl(a1,a2,a3,a4,a5,a6);
278  }
279  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
280  {
281  return BaseImpl::collectIfDone_impl(a1,a2,a3,a4,a5,a6);
282  }
283  };
284 
285  }
286 }
287 #endif
virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
Definition: Collect.hpp:279
boost::function< Ft >::arg5_type arg5_type
Definition: Collect.hpp:224
virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3)
Definition: Collect.hpp:177
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:254
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:132
ft::function_type< fttype >::type Ft
boost::function< Ft >::arg2_type arg2_type
Definition: Collect.hpp:221
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:164
boost::function< Ft >::arg3_type arg3_type
Definition: Collect.hpp:157
virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
Definition: Collect.hpp:210
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:187
boost::function< Ft >::arg6_type arg6_type
Definition: Collect.hpp:259
virtual SendStatus collect(arg1_type a1, arg2_type a2)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:141
virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2)
Definition: Collect.hpp:145
boost::function< Ft >::arg4_type arg4_type
Definition: Collect.hpp:223
boost::function< Ft >::arg2_type arg2_type
Definition: Collect.hpp:255
boost::function< Ft >::arg3_type arg3_type
Definition: Collect.hpp:256
virtual SendStatus collectIfDone(arg1_type a1)
Definition: Collect.hpp:114
virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:173
virtual SendStatus collect(arg1_type a1)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:110
boost::function< Ft >::arg3_type arg3_type
Definition: Collect.hpp:189
virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:240
SendStatus
Returns the status of a send() or collect() invocation.
Definition: SendStatus.hpp:53
boost::function< Ft >::arg2_type arg2_type
Definition: Collect.hpp:156
boost::function_traits< F >::result_type result_type
Definition: Collect.hpp:63
virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
Definition: Collect.hpp:244
SendStatus collectIfDone()
Definition: Collect.hpp:71
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:231
boost::function< Ft >::arg2_type arg2_type
Definition: Collect.hpp:188
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:155
SendStatus collect()
Definition: Collect.hpp:66
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:124
This struct takes the user&#39;s Function signature F and transforms it to the form required in the Colle...
Definition: Collect.hpp:60
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:266
boost::function< Ft >::arg3_type arg3_type
Definition: Collect.hpp:222
virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:275
boost::function< Ft >::arg2_type arg2_type
Definition: Collect.hpp:125
boost::function< Ft >::arg4_type arg4_type
Definition: Collect.hpp:257
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:101
virtual SendStatus collect()
Collect F without returning the results.
Definition: Collect.hpp:197
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:220
result_type ret()
Definition: Collect.hpp:76
virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
Collect a void(arg1_type) F or arg1_type(void) F.
Definition: Collect.hpp:206
boost::function< Ft >::arg5_type arg5_type
Definition: Collect.hpp:258
boost::function< Ft >::arg1_type arg1_type
Definition: Collect.hpp:94
boost::function< Ft >::arg4_type arg4_type
Definition: Collect.hpp:190