2 A thread-safe version of Boost.Signals.
4 Author: Frank Mori Hess <fmhess@users.sourceforge.net>
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)
13 // For more information, see http://www.boost.org
15 #ifndef BOOST_SIGNALS2_SIGNAL_HPP
16 #define BOOST_SIGNALS2_SIGNAL_HPP
19 #include <boost/assert.hpp>
20 #include <boost/config.hpp>
21 #include <boost/function.hpp>
22 #include <boost/preprocessor/arithmetic.hpp>
23 #include <boost/preprocessor/cat.hpp>
24 #include <boost/preprocessor/iteration.hpp>
25 #include <boost/preprocessor/repetition.hpp>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/signals2/detail/unique_lock.hpp>
28 #include <boost/signals2/optional_last_value.hpp>
29 #include <boost/signals2/detail/result_type_wrapper.hpp>
30 #include <boost/signals2/detail/signals_common.hpp>
31 #include <boost/signals2/detail/signals_common_macros.hpp>
32 #include <boost/signals2/detail/slot_groups.hpp>
33 #include <boost/signals2/detail/slot_call_iterator.hpp>
34 #include <boost/signals2/mutex.hpp>
35 #include <boost/signals2/connection.hpp>
36 #include <boost/signals2/slot.hpp>
37 #include <boost/throw_exception.hpp>
38 #include <boost/type_traits.hpp>
47 template<typename ResultSlot
, typename SlotIn
, typename SlotFunction
>
48 ResultSlot
replace_slot_function(const SlotIn
&slot_in
, const SlotFunction
&fun
)
51 slot_base::tracked_container_type tracked_objects
= slot_in
.tracked_objects();
52 slot_base::tracked_container_type::const_iterator it
;
53 for(it
= tracked_objects
.begin(); it
!= tracked_objects
.end(); ++it
)
60 } // namespace signals2
64 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS2_MAX_ARGS)
65 #define BOOST_PP_FILENAME_1 <boost/signals2/detail/signal_template.hpp>
66 #include BOOST_PP_ITERATE()
72 template<typename Signature
,
73 typename Combiner
= optional_last_value
<typename
boost::function_traits
<Signature
>::result_type
>,
75 typename GroupCompare
= std::less
<Group
>,
76 typename SlotFunction
= function
<Signature
>,
77 typename ExtendedSlotFunction
= typename
detail::extended_signature
<function_traits
<Signature
>::arity
, Signature
>::function_type
,
78 typename Mutex
= mutex
>
79 class signal
: public detail::signalN
<function_traits
<Signature
>::arity
,
80 Signature
, Combiner
, Group
, GroupCompare
, SlotFunction
, ExtendedSlotFunction
, Mutex
>::type
83 typedef typename
detail::signalN
<boost::function_traits
<Signature
>::arity
,
84 Signature
, Combiner
, Group
, GroupCompare
, SlotFunction
, ExtendedSlotFunction
, Mutex
>::type base_type
;
86 typedef Signature signature_type
;
87 signal(const Combiner
&combiner
= Combiner(), const GroupCompare
&group_compare
= GroupCompare()):
88 base_type(combiner
, group_compare
)
94 #endif // BOOST_SIGNALS2_SIGNAL_HPP