Update contrib.
1 // Boost.Signals library
3 // Copyright Douglas Gregor 2001-2006. 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 #ifndef BOOST_SIGNALS_MAX_ARGS
14 # define BOOST_SIGNALS_MAX_ARGS 10
17 #include <boost/config.hpp>
18 #include <boost/type_traits/function_traits.hpp>
19 #include <boost/signals/signal0.hpp>
20 #include <boost/signals/signal1.hpp>
21 #include <boost/signals/signal2.hpp>
22 #include <boost/signals/signal3.hpp>
23 #include <boost/signals/signal4.hpp>
24 #include <boost/signals/signal5.hpp>
25 #include <boost/signals/signal6.hpp>
26 #include <boost/signals/signal7.hpp>
27 #include <boost/signals/signal8.hpp>
28 #include <boost/signals/signal9.hpp>
29 #include <boost/signals/signal10.hpp>
30 #include <boost/function.hpp>
32 #ifdef BOOST_HAS_ABI_HEADERS
33 # include BOOST_ABI_PREFIX
37 #ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
38 namespace BOOST_SIGNALS_NAMESPACE {
44 typename GroupCompare,
45 typename SlotFunction>
46 class real_get_signal_impl;
48 template<typename Signature,
51 typename GroupCompare,
52 typename SlotFunction>
53 class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
56 typedef function_traits<Signature> traits;
59 typedef signal0<typename traits::result_type,
66 template<typename Signature,
69 typename GroupCompare,
70 typename SlotFunction>
71 class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
74 typedef function_traits<Signature> traits;
77 typedef signal1<typename traits::result_type,
78 typename traits::arg1_type,
85 template<typename Signature,
88 typename GroupCompare,
89 typename SlotFunction>
90 class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
93 typedef function_traits<Signature> traits;
96 typedef signal2<typename traits::result_type,
97 typename traits::arg1_type,
98 typename traits::arg2_type,
105 template<typename Signature,
108 typename GroupCompare,
109 typename SlotFunction>
110 class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
113 typedef function_traits<Signature> traits;
116 typedef signal3<typename traits::result_type,
117 typename traits::arg1_type,
118 typename traits::arg2_type,
119 typename traits::arg3_type,
126 template<typename Signature,
129 typename GroupCompare,
130 typename SlotFunction>
131 class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
134 typedef function_traits<Signature> traits;
137 typedef signal4<typename traits::result_type,
138 typename traits::arg1_type,
139 typename traits::arg2_type,
140 typename traits::arg3_type,
141 typename traits::arg4_type,
148 template<typename Signature,
151 typename GroupCompare,
152 typename SlotFunction>
153 class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
156 typedef function_traits<Signature> traits;
159 typedef signal5<typename traits::result_type,
160 typename traits::arg1_type,
161 typename traits::arg2_type,
162 typename traits::arg3_type,
163 typename traits::arg4_type,
164 typename traits::arg5_type,
171 template<typename Signature,
174 typename GroupCompare,
175 typename SlotFunction>
176 class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
179 typedef function_traits<Signature> traits;
182 typedef signal6<typename traits::result_type,
183 typename traits::arg1_type,
184 typename traits::arg2_type,
185 typename traits::arg3_type,
186 typename traits::arg4_type,
187 typename traits::arg5_type,
188 typename traits::arg6_type,
195 template<typename Signature,
198 typename GroupCompare,
199 typename SlotFunction>
200 class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
203 typedef function_traits<Signature> traits;
206 typedef signal7<typename traits::result_type,
207 typename traits::arg1_type,
208 typename traits::arg2_type,
209 typename traits::arg3_type,
210 typename traits::arg4_type,
211 typename traits::arg5_type,
212 typename traits::arg6_type,
213 typename traits::arg7_type,
220 template<typename Signature,
223 typename GroupCompare,
224 typename SlotFunction>
225 class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
228 typedef function_traits<Signature> traits;
231 typedef signal8<typename traits::result_type,
232 typename traits::arg1_type,
233 typename traits::arg2_type,
234 typename traits::arg3_type,
235 typename traits::arg4_type,
236 typename traits::arg5_type,
237 typename traits::arg6_type,
238 typename traits::arg7_type,
239 typename traits::arg8_type,
246 template<typename Signature,
249 typename GroupCompare,
250 typename SlotFunction>
251 class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
254 typedef function_traits<Signature> traits;
257 typedef signal9<typename traits::result_type,
258 typename traits::arg1_type,
259 typename traits::arg2_type,
260 typename traits::arg3_type,
261 typename traits::arg4_type,
262 typename traits::arg5_type,
263 typename traits::arg6_type,
264 typename traits::arg7_type,
265 typename traits::arg8_type,
266 typename traits::arg9_type,
273 template<typename Signature,
276 typename GroupCompare,
277 typename SlotFunction>
278 class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
281 typedef function_traits<Signature> traits;
284 typedef signal10<typename traits::result_type,
285 typename traits::arg1_type,
286 typename traits::arg2_type,
287 typename traits::arg3_type,
288 typename traits::arg4_type,
289 typename traits::arg5_type,
290 typename traits::arg6_type,
291 typename traits::arg7_type,
292 typename traits::arg8_type,
293 typename traits::arg9_type,
294 typename traits::arg10_type,
301 template<typename Signature,
304 typename GroupCompare,
305 typename SlotFunction>
306 struct get_signal_impl :
307 public real_get_signal_impl<(function_traits<Signature>::arity),
316 } // end namespace detail
317 } // end namespace BOOST_SIGNALS_NAMESPACE
319 // Very lightweight wrapper around the signalN classes that allows signals to
320 // be created where the number of arguments does not need to be part of the
323 typename Signature, // function type R (T1, T2, ..., TN)
324 typename Combiner = last_value<typename function_traits<Signature>::result_type>,
325 typename Group = int,
326 typename GroupCompare = std::less<Group>,
327 typename SlotFunction = function<Signature>
330 public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
336 typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<
341 SlotFunction>::type base_type;
344 explicit signal(const Combiner& combiner = Combiner(),
345 const GroupCompare& group_compare = GroupCompare()) :
346 base_type(combiner, group_compare)
350 #endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
352 } // end namespace boost
354 #ifdef BOOST_HAS_ABI_HEADERS
355 # include BOOST_ABI_SUFFIX
358 #endif // BOOST_SIGNAL_HPP