ReturnSignature.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 ReturnSignature.hpp
3 
4  ReturnSignature.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_RETURN_SIGNATURE_HPP
40 #define ORO_RETURN_SIGNATURE_HPP
41 
42 #include <boost/type_traits.hpp>
43 #include "NA.hpp"
44 #include "../rtt-fwd.hpp"
45 
46 namespace RTT
47 {
48  namespace internal
49  {
56  template<int, class Signature, class ToInvoke>
58 
59  template<class F, class ToInvoke>
60  struct ReturnSignature<0,F,ToInvoke>
61  {
62  typedef typename boost::function_traits<F>::result_type result_type;
63 
64  ReturnSignature() : impl() {}
65  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
67 
68  result_type ret() const {
69  if (impl)
70  return impl->ret();
71  return NA<result_type>::na();
72  }
73 
74  protected:
75  ToInvoke impl;
76  };
77 
78  template<class F, class ToInvoke>
79  struct ReturnSignature<1,F,ToInvoke>
80  {
81  typedef typename boost::function_traits<F>::result_type result_type;
82  typedef typename boost::function_traits<F>::arg1_type arg1_type;
83 
84  ReturnSignature() : impl() {}
85  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
87 
88  result_type ret(arg1_type a1) const {
89  if (impl)
90  return impl->ret( a1 );
91  return NA<result_type>::na();
92  }
93 
94  result_type ret() const {
95  if (impl)
96  return impl->ret();
97  return NA<result_type>::na();
98  }
99 
100  protected:
101  ToInvoke impl;
102  };
103 
104  template<class F, class ToInvoke>
105  struct ReturnSignature<2,F,ToInvoke>
106  {
107  typedef typename boost::function_traits<F>::result_type result_type;
108  typedef typename boost::function_traits<F>::arg1_type arg1_type;
109  typedef typename boost::function_traits<F>::arg2_type arg2_type;
110 
111  ReturnSignature() : impl() {}
112  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
114 
115  result_type ret(arg1_type a1, arg2_type a2) const {
116  if (impl)
117  return impl->ret( a1,a2 );
118  return NA<result_type>::na();
119  }
120 
121  result_type ret() const {
122  if (impl)
123  return impl->ret();
124  return NA<result_type>::na();
125  }
126  protected:
127  ToInvoke impl;
128  };
129 
130  template<class F, class ToInvoke>
131  struct ReturnSignature<3,F,ToInvoke>
132  {
133  typedef typename boost::function_traits<F>::result_type result_type;
134  typedef typename boost::function_traits<F>::arg1_type arg1_type;
135  typedef typename boost::function_traits<F>::arg2_type arg2_type;
136  typedef typename boost::function_traits<F>::arg3_type arg3_type;
137 
138  ReturnSignature() : impl() {}
139  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
141 
142  result_type ret(arg1_type a1, arg2_type a2, arg3_type a3) const {
143  if (impl)
144  return impl->ret( a1,a2,a3 );
145  return NA<result_type>::na();
146  }
147 
148  result_type ret() const {
149  if (impl)
150  return impl->ret();
151  return NA<result_type>::na();
152  }
153 
154  protected:
155  ToInvoke impl;
156  };
157 
158  template<class F, class ToInvoke>
159  struct ReturnSignature<4,F,ToInvoke>
160  {
161  typedef typename boost::function_traits<F>::result_type result_type;
162  typedef typename boost::function_traits<F>::arg1_type arg1_type;
163  typedef typename boost::function_traits<F>::arg2_type arg2_type;
164  typedef typename boost::function_traits<F>::arg3_type arg3_type;
165  typedef typename boost::function_traits<F>::arg4_type arg4_type;
166 
167  ReturnSignature() : impl() {}
168  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
170 
171  result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) const {
172  if (impl)
173  return impl->ret( a1,a2,a3,a4 );
174  return NA<result_type>::na();
175  }
176 
177  result_type ret() const {
178  if (impl)
179  return impl->ret();
180  return NA<result_type>::na();
181  }
182  protected:
183  ToInvoke impl;
184  };
185 
186  template<class F, class ToInvoke>
187  struct ReturnSignature<5,F,ToInvoke>
188  {
189  typedef typename boost::function_traits<F>::result_type result_type;
190  typedef typename boost::function_traits<F>::arg1_type arg1_type;
191  typedef typename boost::function_traits<F>::arg2_type arg2_type;
192  typedef typename boost::function_traits<F>::arg3_type arg3_type;
193  typedef typename boost::function_traits<F>::arg4_type arg4_type;
194  typedef typename boost::function_traits<F>::arg5_type arg5_type;
195 
196  ReturnSignature() : impl() {}
197  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
199 
200  result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) const {
201  if (impl)
202  return impl->ret( a1,a2,a3,a4,a5 );
203  return NA<result_type>::na();
204  }
205 
206  result_type ret() const {
207  if (impl)
208  return impl->ret();
209  return NA<result_type>::na();
210  }
211  protected:
212  ToInvoke impl;
213  };
214 
215  template<class F, class ToInvoke>
216  struct ReturnSignature<6,F,ToInvoke>
217  {
218  typedef typename boost::function_traits<F>::result_type result_type;
219  typedef typename boost::function_traits<F>::arg1_type arg1_type;
220  typedef typename boost::function_traits<F>::arg2_type arg2_type;
221  typedef typename boost::function_traits<F>::arg3_type arg3_type;
222  typedef typename boost::function_traits<F>::arg4_type arg4_type;
223  typedef typename boost::function_traits<F>::arg5_type arg5_type;
224  typedef typename boost::function_traits<F>::arg6_type arg6_type;
225 
226  ReturnSignature() : impl() {}
227  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
229 
230  result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) const {
231  if (impl)
232  return impl->ret( a1,a2,a3,a4,a5,a6 );
233  return NA<result_type>::na();
234  }
235 
236  result_type ret() const {
237  if (impl)
238  return impl->ret();
239  return NA<result_type>::na();
240  }
241  protected:
242  ToInvoke impl;
243  };
244 
245  template<class F, class ToInvoke>
246  struct ReturnSignature<7,F,ToInvoke>
247  {
248  typedef typename boost::function_traits<F>::result_type result_type;
249  typedef typename boost::function_traits<F>::arg1_type arg1_type;
250  typedef typename boost::function_traits<F>::arg2_type arg2_type;
251  typedef typename boost::function_traits<F>::arg3_type arg3_type;
252  typedef typename boost::function_traits<F>::arg4_type arg4_type;
253  typedef typename boost::function_traits<F>::arg5_type arg5_type;
254  typedef typename boost::function_traits<F>::arg6_type arg6_type;
255  typedef typename boost::function_traits<F>::arg7_type arg7_type;
256 
257  ReturnSignature() : impl() {}
258  ReturnSignature(ToInvoke implementation) : impl(implementation) {}
260 
261  result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) const {
262  if (impl)
263  return impl->ret( a1,a2,a3,a4,a5,a6,a7 );
264  return NA<result_type>::na();
265  }
266 
267  result_type ret() const {
268  if (impl)
269  return impl->ret();
270  return NA<result_type>::na();
271  }
272  protected:
273  ToInvoke impl;
274  };
275 
276  }
277 }
278 #endif
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::arg7_type arg7_type
boost::function_traits< F >::arg6_type arg6_type
boost::function_traits< F >::arg2_type arg2_type
boost::function_traits< F >::result_type result_type
result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) const
static T na()
Definition: NA.hpp:57
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::arg1_type arg1_type
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::arg3_type arg3_type
boost::function_traits< F >::arg1_type arg1_type
boost::function_traits< F >::arg3_type arg3_type
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::arg1_type arg1_type
result_type ret(arg1_type a1, arg2_type a2) const
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::result_type result_type
boost::function_traits< F >::arg2_type arg2_type
boost::function_traits< F >::arg2_type arg2_type
boost::function_traits< F >::arg4_type arg4_type
boost::function_traits< F >::arg3_type arg3_type
boost::function_traits< F >::arg4_type arg4_type
boost::function_traits< F >::arg4_type arg4_type
boost::function_traits< F >::arg5_type arg5_type
boost::function_traits< F >::arg5_type arg5_type
boost::function_traits< F >::arg1_type arg1_type
result_type ret(arg1_type a1, arg2_type a2, arg3_type a3) const
boost::function_traits< F >::arg1_type arg1_type
boost::function_traits< F >::arg1_type arg1_type
result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) const
boost::function_traits< F >::arg5_type arg5_type
result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) const
boost::function_traits< F >::arg2_type arg2_type
boost::function_traits< F >::arg4_type arg4_type
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
boost::function_traits< F >::arg2_type arg2_type
result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) const
boost::function_traits< F >::arg1_type arg1_type
boost::function_traits< F >::arg6_type arg6_type
boost::function_traits< F >::arg3_type arg3_type
boost::function_traits< F >::arg3_type arg3_type
boost::function_traits< F >::arg2_type arg2_type


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:35