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