Orocos Real-Time Toolkit  2.9.0
ReturnBase.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 ReturnBase.hpp
3 
4  ReturnBase.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_BASE_HPP
40 #define ORO_RETURN_BASE_HPP
41 
42 #include <boost/type_traits.hpp>
43 
44 namespace RTT
45 {
46  namespace internal
47  {
52  template<int, class F>
54 
59  template<class F>
60  struct ReturnBase
61  : public ReturnBaseImpl<boost::function_traits<F>::arity, F>
62  {};
63 
64 
65  template<class F>
66  struct ReturnBaseImpl<0,F>
67  {
68  typedef typename boost::function_traits<F>::result_type result_type;
69  virtual ~ReturnBaseImpl() {}
70 
71  virtual result_type ret() = 0;
72  };
73 
74  template<class F>
75  struct ReturnBaseImpl<1,F>
76  {
77  typedef typename boost::function_traits<F>::result_type result_type;
78  typedef typename boost::function_traits<F>::arg1_type arg1_type;
79  virtual ~ReturnBaseImpl() {}
80 
81  virtual result_type ret(arg1_type a1) = 0;
82  virtual result_type ret() = 0;
83  };
84 
85  template<class F>
86  struct ReturnBaseImpl<2,F>
87  {
88  typedef typename boost::function_traits<F>::result_type result_type;
89  typedef typename boost::function_traits<F>::arg1_type arg1_type;
90  typedef typename boost::function_traits<F>::arg2_type arg2_type;
91  virtual ~ReturnBaseImpl() {}
92 
93  virtual result_type ret(arg1_type a1, arg2_type a2) = 0;
94  virtual result_type ret() = 0;
95  };
96 
97  template<class F>
98  struct ReturnBaseImpl<3,F>
99  {
100  typedef typename boost::function_traits<F>::result_type result_type;
101  typedef typename boost::function_traits<F>::arg1_type arg1_type;
102  typedef typename boost::function_traits<F>::arg2_type arg2_type;
103  typedef typename boost::function_traits<F>::arg3_type arg3_type;
104  virtual ~ReturnBaseImpl() {}
105 
106  virtual result_type ret(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
107  virtual result_type ret() = 0;
108  };
109 
110  template<class F>
111  struct ReturnBaseImpl<4,F>
112  {
113  typedef typename boost::function_traits<F>::result_type result_type;
114  typedef typename boost::function_traits<F>::arg1_type arg1_type;
115  typedef typename boost::function_traits<F>::arg2_type arg2_type;
116  typedef typename boost::function_traits<F>::arg3_type arg3_type;
117  typedef typename boost::function_traits<F>::arg4_type arg4_type;
118  virtual ~ReturnBaseImpl() {}
119 
120  virtual result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
121  virtual result_type ret() = 0;
122  };
123 
124  template<class F>
125  struct ReturnBaseImpl<5,F>
126  {
127  typedef typename boost::function_traits<F>::result_type result_type;
128  typedef typename boost::function_traits<F>::arg1_type arg1_type;
129  typedef typename boost::function_traits<F>::arg2_type arg2_type;
130  typedef typename boost::function_traits<F>::arg3_type arg3_type;
131  typedef typename boost::function_traits<F>::arg4_type arg4_type;
132  typedef typename boost::function_traits<F>::arg5_type arg5_type;
133  virtual ~ReturnBaseImpl() {}
134 
135  virtual result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
136  virtual result_type ret() = 0;
137  };
138 
139  template<class F>
140  struct ReturnBaseImpl<6,F>
141  {
142  typedef typename boost::function_traits<F>::result_type result_type;
143  typedef typename boost::function_traits<F>::arg1_type arg1_type;
144  typedef typename boost::function_traits<F>::arg2_type arg2_type;
145  typedef typename boost::function_traits<F>::arg3_type arg3_type;
146  typedef typename boost::function_traits<F>::arg4_type arg4_type;
147  typedef typename boost::function_traits<F>::arg5_type arg5_type;
148  typedef typename boost::function_traits<F>::arg6_type arg6_type;
149  virtual ~ReturnBaseImpl() {}
150 
151  virtual result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
152  virtual result_type ret() = 0;
153  };
154 
155  template<class F>
156  struct ReturnBaseImpl<7,F>
157  {
158  typedef typename boost::function_traits<F>::result_type result_type;
159  typedef typename boost::function_traits<F>::arg1_type arg1_type;
160  typedef typename boost::function_traits<F>::arg2_type arg2_type;
161  typedef typename boost::function_traits<F>::arg3_type arg3_type;
162  typedef typename boost::function_traits<F>::arg4_type arg4_type;
163  typedef typename boost::function_traits<F>::arg5_type arg5_type;
164  typedef typename boost::function_traits<F>::arg6_type arg6_type;
165  typedef typename boost::function_traits<F>::arg7_type arg7_type;
166  virtual ~ReturnBaseImpl() {}
167 
168  virtual result_type ret(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) = 0;
169  virtual result_type ret() = 0;
170  };
171  }
172 }
173 #endif
This is the base class that defines the interface of returning data from method invocations.
Definition: ReturnBase.hpp:60
boost::function_traits< F >::arg6_type arg6_type
Definition: ReturnBase.hpp:148
boost::function_traits< F >::arg6_type arg6_type
Definition: ReturnBase.hpp:164
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:127
boost::function_traits< F >::arg3_type arg3_type
Definition: ReturnBase.hpp:103
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:142
boost::function_traits< F >::arg4_type arg4_type
Definition: ReturnBase.hpp:162
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:101
boost::function_traits< F >::arg7_type arg7_type
Definition: ReturnBase.hpp:165
boost::function_traits< F >::arg5_type arg5_type
Definition: ReturnBase.hpp:147
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:89
boost::function_traits< F >::arg4_type arg4_type
Definition: ReturnBase.hpp:146
boost::function_traits< F >::arg4_type arg4_type
Definition: ReturnBase.hpp:131
boost::function_traits< F >::arg3_type arg3_type
Definition: ReturnBase.hpp:130
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:115
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:68
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:143
boost::function_traits< F >::arg5_type arg5_type
Definition: ReturnBase.hpp:132
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:128
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:144
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:77
Implementation of ret() which takes the same signature as call().
Definition: ReturnBase.hpp:53
boost::function_traits< F >::arg5_type arg5_type
Definition: ReturnBase.hpp:163
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:78
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:114
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:88
boost::function_traits< F >::arg1_type arg1_type
Definition: ReturnBase.hpp:159
boost::function_traits< F >::arg3_type arg3_type
Definition: ReturnBase.hpp:116
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:90
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:102
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:158
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:160
boost::function_traits< F >::arg3_type arg3_type
Definition: ReturnBase.hpp:145
boost::function_traits< F >::arg3_type arg3_type
Definition: ReturnBase.hpp:161
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:113
boost::function_traits< F >::result_type result_type
Definition: ReturnBase.hpp:100
boost::function_traits< F >::arg2_type arg2_type
Definition: ReturnBase.hpp:129
boost::function_traits< F >::arg4_type arg4_type
Definition: ReturnBase.hpp:117