Signal.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Wed Jan 18 14:11:38 CET 2006 Signal.hpp
3 
4  Signal.hpp - description
5  -------------------
6  begin : Wed January 18 2006
7  copyright : (C) 2006 Peter Soetens
8  email : peter.soetens@mech.kuleuven.be
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_CORELIB_SIGNAL_HPP
40 #define ORO_CORELIB_SIGNAL_HPP
41 
42 #define OROCOS_SIGNAL_MAX_ARGS 4
43 
44 #include <boost/type_traits/function_traits.hpp>
45 #include <boost/function.hpp>
46 #include "../Handle.hpp"
47 #include "signal0.hpp"
48 #include "signal1.hpp"
49 #include "signal2.hpp"
50 #include "signal3.hpp"
51 #include "signal4.hpp"
52 #include "signal5.hpp"
53 #include "signal6.hpp"
54 #include "signal7.hpp"
55 
56 namespace RTT {
57  namespace internal {
58  template<int Arity,
59  typename Signature,
60  typename SlotFunction>
62 
63  template<typename Signature,
64  typename SlotFunction>
65  class real_get_signal_impl<0, Signature,
66  SlotFunction>
67  {
68  typedef boost::function_traits<Signature> traits;
69 
70  public:
71  typedef signal0<typename traits::result_type,
72  SlotFunction> type;
73  };
74 
75  template<typename Signature,
76  typename SlotFunction>
77  class real_get_signal_impl<1, Signature,
78  SlotFunction>
79  {
80  typedef boost::function_traits<Signature> traits;
81 
82  public:
83  typedef signal1<typename traits::result_type,
84  typename traits::arg1_type,
85  SlotFunction> type;
86  };
87 
88  template<typename Signature,
89  typename SlotFunction>
90  class real_get_signal_impl<2, Signature,
91  SlotFunction>
92  {
93  typedef boost::function_traits<Signature> traits;
94 
95  public:
96  typedef signal2<typename traits::result_type,
97  typename traits::arg1_type,
98  typename traits::arg2_type,
99  SlotFunction> type;
100  };
101 
102  template<typename Signature,
103  typename SlotFunction>
104  class real_get_signal_impl<3, Signature,
105  SlotFunction>
106  {
107  typedef boost::function_traits<Signature> traits;
108 
109  public:
110  typedef signal3<typename traits::result_type,
111  typename traits::arg1_type,
112  typename traits::arg2_type,
113  typename traits::arg3_type,
114  SlotFunction> type;
115  };
116 
117  template<typename Signature,
118  typename SlotFunction>
119  class real_get_signal_impl<4, Signature,
120  SlotFunction>
121  {
122  typedef boost::function_traits<Signature> traits;
123 
124  public:
125  typedef signal4<typename traits::result_type,
126  typename traits::arg1_type,
127  typename traits::arg2_type,
128  typename traits::arg3_type,
129  typename traits::arg4_type,
130  SlotFunction> type;
131  };
132 
133  template<typename Signature,
134  typename SlotFunction>
135  class real_get_signal_impl<5, Signature,
136  SlotFunction>
137  {
138  typedef boost::function_traits<Signature> traits;
139 
140  public:
141  typedef signal5<typename traits::result_type,
142  typename traits::arg1_type,
143  typename traits::arg2_type,
144  typename traits::arg3_type,
145  typename traits::arg4_type,
146  typename traits::arg5_type,
147  SlotFunction> type;
148  };
149 
150  template<typename Signature,
151  typename SlotFunction>
152  class real_get_signal_impl<6, Signature,
153  SlotFunction>
154  {
155  typedef boost::function_traits<Signature> traits;
156 
157  public:
158  typedef signal6<typename traits::result_type,
159  typename traits::arg1_type,
160  typename traits::arg2_type,
161  typename traits::arg3_type,
162  typename traits::arg4_type,
163  typename traits::arg5_type,
164  typename traits::arg6_type,
165  SlotFunction> type;
166  };
167 
168  template<typename Signature,
169  typename SlotFunction>
170  class real_get_signal_impl<7, Signature,
171  SlotFunction>
172  {
173  typedef boost::function_traits<Signature> traits;
174 
175  public:
176  typedef signal7<typename traits::result_type,
177  typename traits::arg1_type,
178  typename traits::arg2_type,
179  typename traits::arg3_type,
180  typename traits::arg4_type,
181  typename traits::arg5_type,
182  typename traits::arg6_type,
183  typename traits::arg7_type,
184  SlotFunction> type;
185  };
186 
187 
188  template<typename Signature,
189  typename SlotFunction>
191  public real_get_signal_impl<(boost::function_traits<Signature>::arity),
192  Signature,
193  SlotFunction>
194  {
195  };
196 
202  template<
203  typename Signature,
204  typename TSlotFunction = boost::function<Signature>
205  >
206  class Signal :
207  public get_signal_impl<Signature,
208  TSlotFunction>::type
209  {
210  protected:
211  typedef typename get_signal_impl< Signature,
212  TSlotFunction>::type base_type;
213 
214  public:
215  typedef boost::shared_ptr<Signal<Signature,TSlotFunction> > shared_ptr;
216  Signal() {}
217  typedef TSlotFunction SlotFunction;
218  };
219 
220  } // end namespace detail
221 
222 } // namespace RTT
223 
224 
225 #endif
226 
get_signal_impl< Signature, TSlotFunction >::type base_type
Definition: Signal.hpp:212
signal7< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, typename traits::arg4_type, typename traits::arg5_type, typename traits::arg6_type, typename traits::arg7_type, SlotFunction > type
Definition: Signal.hpp:184
signal1< typename traits::result_type, typename traits::arg1_type, SlotFunction > type
Definition: Signal.hpp:85
signal6< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, typename traits::arg4_type, typename traits::arg5_type, typename traits::arg6_type, SlotFunction > type
Definition: Signal.hpp:165
signal2< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, SlotFunction > type
Definition: Signal.hpp:99
signal4< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, typename traits::arg4_type, SlotFunction > type
Definition: Signal.hpp:130
boost::shared_ptr< Signal< Signature, TSlotFunction > > shared_ptr
Definition: Signal.hpp:215
signal0< typename traits::result_type, SlotFunction > type
Definition: Signal.hpp:72
signal3< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, SlotFunction > type
Definition: Signal.hpp:114
signal5< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, typename traits::arg4_type, typename traits::arg5_type, SlotFunction > type
Definition: Signal.hpp:147
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
TSlotFunction SlotFunction
Definition: Signal.hpp:217


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