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_NO_DEPRECATION_WARNING
14 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
15 # pragma message ("Warning: Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING.")
16 # elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
17 # warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
21 #ifndef BOOST_SIGNALS_MAX_ARGS
22 # define BOOST_SIGNALS_MAX_ARGS 10
25 #include <boost/config.hpp>
26 #include <boost/type_traits/function_traits.hpp>
27 #include <boost/signals/signal0.hpp>
28 #include <boost/signals/signal1.hpp>
29 #include <boost/signals/signal2.hpp>
30 #include <boost/signals/signal3.hpp>
31 #include <boost/signals/signal4.hpp>
32 #include <boost/signals/signal5.hpp>
33 #include <boost/signals/signal6.hpp>
34 #include <boost/signals/signal7.hpp>
35 #include <boost/signals/signal8.hpp>
36 #include <boost/signals/signal9.hpp>
37 #include <boost/signals/signal10.hpp>
38 #include <boost/function.hpp>
40 #ifdef BOOST_HAS_ABI_HEADERS
41 # include BOOST_ABI_PREFIX
45 #ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
46 namespace BOOST_SIGNALS_NAMESPACE {
52 typename GroupCompare,
53 typename SlotFunction>
54 class real_get_signal_impl;
56 template<typename Signature,
59 typename GroupCompare,
60 typename SlotFunction>
61 class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
64 typedef function_traits<Signature> traits;
67 typedef signal0<typename traits::result_type,
74 template<typename Signature,
77 typename GroupCompare,
78 typename SlotFunction>
79 class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
82 typedef function_traits<Signature> traits;
85 typedef signal1<typename traits::result_type,
86 typename traits::arg1_type,
93 template<typename Signature,
96 typename GroupCompare,
97 typename SlotFunction>
98 class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
101 typedef function_traits<Signature> traits;
104 typedef signal2<typename traits::result_type,
105 typename traits::arg1_type,
106 typename traits::arg2_type,
113 template<typename Signature,
116 typename GroupCompare,
117 typename SlotFunction>
118 class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
121 typedef function_traits<Signature> traits;
124 typedef signal3<typename traits::result_type,
125 typename traits::arg1_type,
126 typename traits::arg2_type,
127 typename traits::arg3_type,
134 template<typename Signature,
137 typename GroupCompare,
138 typename SlotFunction>
139 class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
142 typedef function_traits<Signature> traits;
145 typedef signal4<typename traits::result_type,
146 typename traits::arg1_type,
147 typename traits::arg2_type,
148 typename traits::arg3_type,
149 typename traits::arg4_type,
156 template<typename Signature,
159 typename GroupCompare,
160 typename SlotFunction>
161 class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
164 typedef function_traits<Signature> traits;
167 typedef signal5<typename traits::result_type,
168 typename traits::arg1_type,
169 typename traits::arg2_type,
170 typename traits::arg3_type,
171 typename traits::arg4_type,
172 typename traits::arg5_type,
179 template<typename Signature,
182 typename GroupCompare,
183 typename SlotFunction>
184 class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
187 typedef function_traits<Signature> traits;
190 typedef signal6<typename traits::result_type,
191 typename traits::arg1_type,
192 typename traits::arg2_type,
193 typename traits::arg3_type,
194 typename traits::arg4_type,
195 typename traits::arg5_type,
196 typename traits::arg6_type,
203 template<typename Signature,
206 typename GroupCompare,
207 typename SlotFunction>
208 class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
211 typedef function_traits<Signature> traits;
214 typedef signal7<typename traits::result_type,
215 typename traits::arg1_type,
216 typename traits::arg2_type,
217 typename traits::arg3_type,
218 typename traits::arg4_type,
219 typename traits::arg5_type,
220 typename traits::arg6_type,
221 typename traits::arg7_type,
228 template<typename Signature,
231 typename GroupCompare,
232 typename SlotFunction>
233 class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
236 typedef function_traits<Signature> traits;
239 typedef signal8<typename traits::result_type,
240 typename traits::arg1_type,
241 typename traits::arg2_type,
242 typename traits::arg3_type,
243 typename traits::arg4_type,
244 typename traits::arg5_type,
245 typename traits::arg6_type,
246 typename traits::arg7_type,
247 typename traits::arg8_type,
254 template<typename Signature,
257 typename GroupCompare,
258 typename SlotFunction>
259 class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
262 typedef function_traits<Signature> traits;
265 typedef signal9<typename traits::result_type,
266 typename traits::arg1_type,
267 typename traits::arg2_type,
268 typename traits::arg3_type,
269 typename traits::arg4_type,
270 typename traits::arg5_type,
271 typename traits::arg6_type,
272 typename traits::arg7_type,
273 typename traits::arg8_type,
274 typename traits::arg9_type,
281 template<typename Signature,
284 typename GroupCompare,
285 typename SlotFunction>
286 class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
289 typedef function_traits<Signature> traits;
292 typedef signal10<typename traits::result_type,
293 typename traits::arg1_type,
294 typename traits::arg2_type,
295 typename traits::arg3_type,
296 typename traits::arg4_type,
297 typename traits::arg5_type,
298 typename traits::arg6_type,
299 typename traits::arg7_type,
300 typename traits::arg8_type,
301 typename traits::arg9_type,
302 typename traits::arg10_type,
309 template<typename Signature,
312 typename GroupCompare,
313 typename SlotFunction>
314 struct get_signal_impl :
315 public real_get_signal_impl<(function_traits<Signature>::arity),
324 } // end namespace detail
325 } // end namespace BOOST_SIGNALS_NAMESPACE
327 // Very lightweight wrapper around the signalN classes that allows signals to
328 // be created where the number of arguments does not need to be part of the
331 typename Signature, // function type R (T1, T2, ..., TN)
332 typename Combiner = last_value<typename function_traits<Signature>::result_type>,
333 typename Group = int,
334 typename GroupCompare = std::less<Group>,
335 typename SlotFunction = function<Signature>
338 public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
344 typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<
349 SlotFunction>::type base_type;
352 explicit signal(const Combiner& combiner = Combiner(),
353 const GroupCompare& group_compare = GroupCompare()) :
354 base_type(combiner, group_compare)
358 #endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
360 } // end namespace boost
362 #ifdef BOOST_HAS_ABI_HEADERS
363 # include BOOST_ABI_SUFFIX
366 #endif // BOOST_SIGNAL_HPP