1 // Boost.Signals library
3 // Copyright Doug Gregor 2001-2003. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/signals
10 #ifndef BOOST_SIGNAL_HPP
11 #define BOOST_SIGNAL_HPP
13 #define BOOST_SIGNALS_MAX_ARGS 10
15 #include <boost/config.hpp>
16 #include <boost/type_traits/function_traits.hpp>
17 #include <boost/signals/signal0.hpp>
18 #include <boost/signals/signal1.hpp>
19 #include <boost/signals/signal2.hpp>
20 #include <boost/signals/signal3.hpp>
21 #include <boost/signals/signal4.hpp>
22 #include <boost/signals/signal5.hpp>
23 #include <boost/signals/signal6.hpp>
24 #include <boost/signals/signal7.hpp>
25 #include <boost/signals/signal8.hpp>
26 #include <boost/signals/signal9.hpp>
27 #include <boost/signals/signal10.hpp>
28 #include <boost/function.hpp>
30 #ifdef BOOST_HAS_ABI_HEADERS
31 # include BOOST_ABI_PREFIX
35 #ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
36 namespace BOOST_SIGNALS_NAMESPACE {
42 typename GroupCompare,
43 typename SlotFunction>
44 class real_get_signal_impl;
46 template<typename Signature,
49 typename GroupCompare,
50 typename SlotFunction>
51 class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
54 typedef function_traits<Signature> traits;
57 typedef signal0<typename traits::result_type,
64 template<typename Signature,
67 typename GroupCompare,
68 typename SlotFunction>
69 class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
72 typedef function_traits<Signature> traits;
75 typedef signal1<typename traits::result_type,
76 typename traits::arg1_type,
83 template<typename Signature,
86 typename GroupCompare,
87 typename SlotFunction>
88 class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
91 typedef function_traits<Signature> traits;
94 typedef signal2<typename traits::result_type,
95 typename traits::arg1_type,
96 typename traits::arg2_type,
103 template<typename Signature,
106 typename GroupCompare,
107 typename SlotFunction>
108 class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
111 typedef function_traits<Signature> traits;
114 typedef signal3<typename traits::result_type,
115 typename traits::arg1_type,
116 typename traits::arg2_type,
117 typename traits::arg3_type,
124 template<typename Signature,
127 typename GroupCompare,
128 typename SlotFunction>
129 class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
132 typedef function_traits<Signature> traits;
135 typedef signal4<typename traits::result_type,
136 typename traits::arg1_type,
137 typename traits::arg2_type,
138 typename traits::arg3_type,
139 typename traits::arg4_type,
146 template<typename Signature,
149 typename GroupCompare,
150 typename SlotFunction>
151 class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
154 typedef function_traits<Signature> traits;
157 typedef signal5<typename traits::result_type,
158 typename traits::arg1_type,
159 typename traits::arg2_type,
160 typename traits::arg3_type,
161 typename traits::arg4_type,
162 typename traits::arg5_type,
169 template<typename Signature,
172 typename GroupCompare,
173 typename SlotFunction>
174 class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
177 typedef function_traits<Signature> traits;
180 typedef signal6<typename traits::result_type,
181 typename traits::arg1_type,
182 typename traits::arg2_type,
183 typename traits::arg3_type,
184 typename traits::arg4_type,
185 typename traits::arg5_type,
186 typename traits::arg6_type,
193 template<typename Signature,
196 typename GroupCompare,
197 typename SlotFunction>
198 class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
201 typedef function_traits<Signature> traits;
204 typedef signal7<typename traits::result_type,
205 typename traits::arg1_type,
206 typename traits::arg2_type,
207 typename traits::arg3_type,
208 typename traits::arg4_type,
209 typename traits::arg5_type,
210 typename traits::arg6_type,
211 typename traits::arg7_type,
218 template<typename Signature,
221 typename GroupCompare,
222 typename SlotFunction>
223 class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
226 typedef function_traits<Signature> traits;
229 typedef signal8<typename traits::result_type,
230 typename traits::arg1_type,
231 typename traits::arg2_type,
232 typename traits::arg3_type,
233 typename traits::arg4_type,
234 typename traits::arg5_type,
235 typename traits::arg6_type,
236 typename traits::arg7_type,
237 typename traits::arg8_type,
244 template<typename Signature,
247 typename GroupCompare,
248 typename SlotFunction>
249 class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
252 typedef function_traits<Signature> traits;
255 typedef signal9<typename traits::result_type,
256 typename traits::arg1_type,
257 typename traits::arg2_type,
258 typename traits::arg3_type,
259 typename traits::arg4_type,
260 typename traits::arg5_type,
261 typename traits::arg6_type,
262 typename traits::arg7_type,
263 typename traits::arg8_type,
264 typename traits::arg9_type,
271 template<typename Signature,
274 typename GroupCompare,
275 typename SlotFunction>
276 class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
279 typedef function_traits<Signature> traits;
282 typedef signal10<typename traits::result_type,
283 typename traits::arg1_type,
284 typename traits::arg2_type,
285 typename traits::arg3_type,
286 typename traits::arg4_type,
287 typename traits::arg5_type,
288 typename traits::arg6_type,
289 typename traits::arg7_type,
290 typename traits::arg8_type,
291 typename traits::arg9_type,
292 typename traits::arg10_type,
299 template<typename Signature,
302 typename GroupCompare,
303 typename SlotFunction>
304 struct get_signal_impl :
305 public real_get_signal_impl<(function_traits<Signature>::arity),
314 } // end namespace detail
315 } // end namespace BOOST_SIGNALS_NAMESPACE
317 // Very lightweight wrapper around the signalN classes that allows signals to
318 // be created where the number of arguments does not need to be part of the
321 typename Signature, // function type R (T1, T2, ..., TN)
322 typename Combiner = last_value<typename function_traits<Signature>::result_type>,
323 typename Group = int,
324 typename GroupCompare = std::less<Group>,
325 typename SlotFunction = function<Signature>
328 public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
334 typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<
339 SlotFunction>::type base_type;
342 explicit signal(const Combiner& combiner = Combiner(),
343 const GroupCompare& group_compare = GroupCompare()) :
344 base_type(combiner, group_compare)
348 #endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
350 } // end namespace boost
352 #ifdef BOOST_HAS_ABI_HEADERS
353 # include BOOST_ABI_SUFFIX
356 #endif // BOOST_SIGNAL_HPP