Chris@16
|
1 /*
|
Chris@16
|
2 A thread-safe version of Boost.Signals.
|
Chris@16
|
3
|
Chris@16
|
4 Author: Frank Mori Hess <fmhess@users.sourceforge.net>
|
Chris@16
|
5 Begin: 2007-01-23
|
Chris@16
|
6 */
|
Chris@16
|
7 // Copyright Frank Mori Hess 2007-2008
|
Chris@16
|
8 // Use, modification and
|
Chris@16
|
9 // distribution is subject to the Boost Software License, Version
|
Chris@16
|
10 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
11 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
12
|
Chris@16
|
13 // For more information, see http://www.boost.org
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP
|
Chris@16
|
16 #define BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/preprocessor/arithmetic.hpp>
|
Chris@16
|
19 #include <boost/preprocessor/cat.hpp>
|
Chris@16
|
20 #include <boost/preprocessor/control/expr_if.hpp>
|
Chris@16
|
21 #include <boost/preprocessor/iteration.hpp>
|
Chris@16
|
22 #include <boost/preprocessor/repetition.hpp>
|
Chris@16
|
23 #include <boost/signals2/detail/preprocessed_arg_type.hpp>
|
Chris@16
|
24 #include <boost/type_traits/add_reference.hpp>
|
Chris@16
|
25
|
Chris@16
|
26 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS2_MAX_ARGS)
|
Chris@16
|
27 #define BOOST_PP_FILENAME_1 <boost/signals2/detail/signal_template.hpp>
|
Chris@16
|
28 #include BOOST_PP_ITERATE()
|
Chris@16
|
29
|
Chris@16
|
30 namespace boost
|
Chris@16
|
31 {
|
Chris@16
|
32 namespace signals2
|
Chris@16
|
33 {
|
Chris@16
|
34 template<typename Signature,
|
Chris@16
|
35 typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>,
|
Chris@16
|
36 typename Group = int,
|
Chris@16
|
37 typename GroupCompare = std::less<Group>,
|
Chris@16
|
38 typename SlotFunction = function<Signature>,
|
Chris@16
|
39 typename ExtendedSlotFunction = typename detail::extended_signature<function_traits<Signature>::arity, Signature>::function_type,
|
Chris@16
|
40 typename Mutex = mutex >
|
Chris@16
|
41 class signal: public detail::signalN<function_traits<Signature>::arity,
|
Chris@16
|
42 Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type
|
Chris@16
|
43 {
|
Chris@16
|
44 private:
|
Chris@16
|
45 typedef typename detail::signalN<boost::function_traits<Signature>::arity,
|
Chris@16
|
46 Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type base_type;
|
Chris@16
|
47 public:
|
Chris@16
|
48 signal(const Combiner &combiner_arg = Combiner(), const GroupCompare &group_compare = GroupCompare()):
|
Chris@16
|
49 base_type(combiner_arg, group_compare)
|
Chris@16
|
50 {}
|
Chris@101
|
51 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
Chris@101
|
52 signal(signal && other) : base_type(std::move(other)) {}
|
Chris@101
|
53 signal & operator=(signal && other) { base_type::operator=(std::move(other)); return *this; }
|
Chris@101
|
54 #endif
|
Chris@16
|
55 };
|
Chris@16
|
56 }
|
Chris@16
|
57 }
|
Chris@16
|
58
|
Chris@16
|
59 #endif // BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP
|