Orocos Real-Time Toolkit  2.9.0
CollectBase.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 CollectBase.hpp
3 
4  CollectBase.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_BASE_HPP
40 #define ORO_COLLECT_BASE_HPP
41 
42 #include "CollectSignature.hpp"
43 #include "../SendStatus.hpp"
44 #include "ReturnBase.hpp"
45 #include <boost/function.hpp>
46 
47 namespace RTT
48 {
49  namespace internal
50  {
59  template<int, class Ft>
61 
68  template<class F>
69  struct CollectBase
70  : public CollectBaseImpl< boost::function_traits<typename CollectType<F>::Ft>::arity, typename CollectType<F>::Ft >,
71  public ReturnBaseImpl< boost::function_traits<F>::arity, F>
72  {
73  typedef boost::shared_ptr<CollectBase<F> > shared_ptr;
74  };
75 
76  template<class Ft>
77  struct CollectBaseImpl<0,Ft>
78  {
79  virtual ~CollectBaseImpl() {}
80 
85  virtual SendStatus collect() = 0;
86 
87  virtual SendStatus collectIfDone() = 0;
88  };
89 
90  template<class Ft>
91  struct CollectBaseImpl<1,Ft>
92  {
93  typedef typename boost::function<Ft>::result_type result_type;
94  typedef typename boost::function<Ft>::arg1_type arg1_type;
95  virtual ~CollectBaseImpl() {}
96 
101  virtual SendStatus collect() = 0;
102 
108  virtual SendStatus collect(arg1_type a1) = 0;
109 
110  virtual SendStatus collectIfDone(arg1_type a1) = 0;
111  };
112 
113  template<class Ft>
114  struct CollectBaseImpl<2,Ft>
115  {
116  typedef typename boost::function<Ft>::arg1_type arg1_type;
117  typedef typename boost::function<Ft>::arg2_type arg2_type;
118  virtual ~CollectBaseImpl() {}
119 
124  virtual SendStatus collect() = 0;
130  virtual SendStatus collect(arg1_type a1, arg2_type a2) = 0;
131  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2) = 0;
132  };
133 
134  template<class Ft>
135  struct CollectBaseImpl<3,Ft>
136  {
137  typedef typename boost::function<Ft>::arg1_type arg1_type;
138  typedef typename boost::function<Ft>::arg2_type arg2_type;
139  typedef typename boost::function<Ft>::arg3_type arg3_type;
140  virtual ~CollectBaseImpl() {}
141 
146  virtual SendStatus collect() = 0;
152  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
153  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
154  };
155 
156  template<class Ft>
157  struct CollectBaseImpl<4,Ft>
158  {
159  typedef typename boost::function<Ft>::arg1_type arg1_type;
160  typedef typename boost::function<Ft>::arg2_type arg2_type;
161  typedef typename boost::function<Ft>::arg3_type arg3_type;
162  typedef typename boost::function<Ft>::arg4_type arg4_type;
163  virtual ~CollectBaseImpl() {}
164 
169  virtual SendStatus collect() = 0;
175  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
176  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
177  };
178 
179  template<class Ft>
180  struct CollectBaseImpl<5,Ft>
181  {
182  typedef typename boost::function<Ft>::arg1_type arg1_type;
183  typedef typename boost::function<Ft>::arg2_type arg2_type;
184  typedef typename boost::function<Ft>::arg3_type arg3_type;
185  typedef typename boost::function<Ft>::arg4_type arg4_type;
186  typedef typename boost::function<Ft>::arg5_type arg5_type;
187  virtual ~CollectBaseImpl() {}
188 
193  virtual SendStatus collect() = 0;
199  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
200  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
201  };
202 
203  template<class Ft>
204  struct CollectBaseImpl<6,Ft>
205  {
206  typedef typename boost::function<Ft>::arg1_type arg1_type;
207  typedef typename boost::function<Ft>::arg2_type arg2_type;
208  typedef typename boost::function<Ft>::arg3_type arg3_type;
209  typedef typename boost::function<Ft>::arg4_type arg4_type;
210  typedef typename boost::function<Ft>::arg5_type arg5_type;
211  typedef typename boost::function<Ft>::arg6_type arg6_type;
212  virtual ~CollectBaseImpl() {}
213 
218  virtual SendStatus collect() = 0;
224  virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
225  virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
226  };
227  }
228 }
229 #endif
boost::function< Ft >::arg4_type arg4_type
boost::function< Ft >::arg2_type arg2_type
boost::function< Ft >::arg3_type arg3_type
boost::function< Ft >::arg1_type arg1_type
boost::function< Ft >::arg4_type arg4_type
boost::function< Ft >::result_type result_type
Definition: CollectBase.hpp:93
boost::shared_ptr< CollectBase< F > > shared_ptr
Definition: CollectBase.hpp:73
boost::function< Ft >::arg5_type arg5_type
SendStatus
Returns the status of a send() or collect() invocation.
Definition: SendStatus.hpp:53
boost::function< Ft >::arg2_type arg2_type
boost::function< Ft >::arg1_type arg1_type
boost::function< Ft >::arg3_type arg3_type
boost::function< Ft >::arg2_type arg2_type
The collection signature is formed by Ft, which is a transformed form of F.
Definition: CollectBase.hpp:60
boost::function< Ft >::arg6_type arg6_type
boost::function< Ft >::arg2_type arg2_type
boost::function< Ft >::arg4_type arg4_type
Implementation of ret() which takes the same signature as call().
Definition: ReturnBase.hpp:53
boost::function< Ft >::arg2_type arg2_type
boost::function< Ft >::arg3_type arg3_type
This struct takes the user&#39;s Function signature F and transforms it to the form required in the Colle...
Definition: CollectBase.hpp:69
boost::function< Ft >::arg1_type arg1_type
boost::function< Ft >::arg1_type arg1_type
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
boost::function< Ft >::arg1_type arg1_type
Definition: CollectBase.hpp:94
boost::function< Ft >::arg1_type arg1_type
boost::function< Ft >::arg5_type arg5_type
boost::function< Ft >::arg3_type arg3_type