Orocos Real-Time Toolkit  2.8.3
InvokerBase.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 InvokerBase.hpp
3 
4  InvokerBase.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_INVOKER_BASE_HPP
40 #define ORO_INVOKER_BASE_HPP
41 
42 #include <boost/function.hpp>
43 #include <boost/function_types/function_type.hpp>
44 #include <boost/type_traits.hpp>
45 #include "NA.hpp"
46 #include "../SendHandle.hpp"
47 #include "../rtt-fwd.hpp"
48 
49 namespace RTT
50 {
51  namespace internal
52  {
58  template<int, class F>
60 
68  template<class F>
69  struct InvokerBase
70  : public InvokerBaseImpl<boost::function_traits<F>::arity, F>
71  {};
72 
73  template<class F>
74  struct InvokerBaseImpl<0,F>
75  {
76  typedef typename boost::function_traits<F>::result_type result_type;
77  typedef typename boost::function_traits<F>::result_type result_reference;
78  virtual ~InvokerBaseImpl() {}
79  virtual SendHandle<F> send() = 0;
80  virtual result_type call() = 0;
81  };
82 
83  template<class F>
84  struct InvokerBaseImpl<1,F>
85  {
86  typedef typename boost::function_traits<F>::result_type result_type;
87  typedef typename boost::function<F>::arg1_type arg1_type;
88  virtual ~InvokerBaseImpl() {}
89  virtual result_type call(arg1_type a1) = 0;
90  virtual SendHandle<F> send(arg1_type a1) = 0;
91  };
92 
93  template<class F>
94  struct InvokerBaseImpl<2,F>
95  {
96  typedef typename boost::function_traits<F>::result_type result_type;
97  typedef typename boost::function<F>::arg1_type arg1_type;
98  typedef typename boost::function<F>::arg2_type arg2_type;
99  virtual ~InvokerBaseImpl() {}
100  virtual result_type call(arg1_type a1, arg2_type a2) = 0;
101  virtual SendHandle<F> send(arg1_type a1, arg2_type a2) = 0;
102  };
103 
104  template<class F>
105  struct InvokerBaseImpl<3,F>
106  {
107  typedef typename boost::function_traits<F>::result_type result_type;
108  typedef typename boost::function<F>::arg1_type arg1_type;
109  typedef typename boost::function<F>::arg2_type arg2_type;
110  typedef typename boost::function<F>::arg3_type arg3_type;
111  virtual ~InvokerBaseImpl() {}
112  virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
113  virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
114  };
115 
116  template<class F>
117  struct InvokerBaseImpl<4,F>
118  {
119  typedef typename boost::function_traits<F>::result_type result_type;
120  typedef typename boost::function<F>::arg1_type arg1_type;
121  typedef typename boost::function<F>::arg2_type arg2_type;
122  typedef typename boost::function<F>::arg3_type arg3_type;
123  typedef typename boost::function<F>::arg4_type arg4_type;
124  virtual ~InvokerBaseImpl() {}
125  virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
126  virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
127  };
128 
129  template<class F>
130  struct InvokerBaseImpl<5,F>
131  {
132  typedef typename boost::function_traits<F>::result_type result_type;
133  typedef typename boost::function<F>::arg1_type arg1_type;
134  typedef typename boost::function<F>::arg2_type arg2_type;
135  typedef typename boost::function<F>::arg3_type arg3_type;
136  typedef typename boost::function<F>::arg4_type arg4_type;
137  typedef typename boost::function<F>::arg5_type arg5_type;
138  virtual ~InvokerBaseImpl() {}
139  virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
140  virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
141  };
142 
143  template<class F>
144  struct InvokerBaseImpl<6,F>
145  {
146  typedef typename boost::function_traits<F>::result_type result_type;
147  typedef typename boost::function<F>::arg1_type arg1_type;
148  typedef typename boost::function<F>::arg2_type arg2_type;
149  typedef typename boost::function<F>::arg3_type arg3_type;
150  typedef typename boost::function<F>::arg4_type arg4_type;
151  typedef typename boost::function<F>::arg5_type arg5_type;
152  typedef typename boost::function<F>::arg6_type arg6_type;
153  virtual ~InvokerBaseImpl() {}
154  virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
155  virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
156  };
157 
158  template<class F>
159  struct InvokerBaseImpl<7,F>
160  {
161  typedef typename boost::function_traits<F>::result_type result_type;
162  typedef typename boost::function<F>::arg1_type arg1_type;
163  typedef typename boost::function<F>::arg2_type arg2_type;
164  typedef typename boost::function<F>::arg3_type arg3_type;
165  typedef typename boost::function<F>::arg4_type arg4_type;
166  typedef typename boost::function<F>::arg5_type arg5_type;
167  typedef typename boost::function<F>::arg6_type arg6_type;
168  typedef typename boost::function<F>::arg7_type arg7_type;
169  virtual ~InvokerBaseImpl() {}
170  virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) = 0;
171  virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) = 0;
172  };
173  }
174 }
175 #endif
boost::function< F >::arg6_type arg6_type
boost::function< F >::arg1_type arg1_type
A class which converts a function type signature F to a virtual send()/call() interface.
Definition: InvokerBase.hpp:59
boost::function_traits< F >::result_type result_type
Definition: InvokerBase.hpp:86
boost::function< F >::arg2_type arg2_type
boost::function< F >::arg4_type arg4_type
boost::function< F >::arg2_type arg2_type
This is the base class that defines the interface of all invocable method implementations.
Definition: InvokerBase.hpp:69
boost::function< F >::arg5_type arg5_type
boost::function< F >::arg3_type arg3_type
boost::function< F >::arg2_type arg2_type
boost::function< F >::arg5_type arg5_type
boost::function< F >::arg1_type arg1_type
Definition: InvokerBase.hpp:87
boost::function_traits< F >::result_type result_type
boost::function< F >::arg6_type arg6_type
boost::function_traits< F >::result_type result_type
The SendHandle is used to collect the result values of an asynchronous invocation.
Definition: rtt-fwd.hpp:79
boost::function_traits< F >::result_type result_type
boost::function< F >::arg3_type arg3_type
boost::function< F >::arg3_type arg3_type
boost::function< F >::arg2_type arg2_type
boost::function_traits< F >::result_type result_type
boost::function< F >::arg1_type arg1_type
boost::function_traits< F >::result_type result_type
Definition: InvokerBase.hpp:76
boost::function< F >::arg1_type arg1_type
boost::function< F >::arg2_type arg2_type
Definition: InvokerBase.hpp:98
boost::function< F >::arg7_type arg7_type
boost::function< F >::arg4_type arg4_type
boost::function< F >::arg4_type arg4_type
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
boost::function_traits< F >::result_type result_type
Definition: InvokerBase.hpp:96
boost::function< F >::arg4_type arg4_type
boost::function< F >::arg5_type arg5_type
boost::function_traits< F >::result_type result_reference
Definition: InvokerBase.hpp:77
boost::function_traits< F >::result_type result_type
boost::function< F >::arg3_type arg3_type
boost::function< F >::arg1_type arg1_type
boost::function< F >::arg1_type arg1_type
boost::function< F >::arg1_type arg1_type
Definition: InvokerBase.hpp:97
boost::function< F >::arg2_type arg2_type
boost::function< F >::arg3_type arg3_type