2 A meta function which supports using named template type parameters
3 via Boost.Parameter to specify the template type parameters for
4 the boost::signals2::signal class.
6 Author: Frank Mori Hess <fmhess@users.sourceforge.net>
9 // Copyright Frank Mori Hess 2009
10 // Use, modification and
11 // distribution is subject to the Boost Software License, Version
12 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
15 // For more information, see http://www.boost.org
17 #ifndef BOOST_SIGNALS2_SIGNAL_TYPE_HPP
18 #define BOOST_SIGNALS2_SIGNAL_TYPE_HPP
20 // support for function types is currently broken in Boost.Parameter
21 // #define BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
23 #include <boost/signals2/signal.hpp>
25 #if !defined(BOOST_PARAMETER_MAX_ARITY)
26 #define BOOST_PARAMETER_MAX_ARITY 7
28 #if BOOST_PARAMETER_MAX_ARITY < 7
29 #error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers
30 #endif // BOOST_PARAMETER_MAX_ARITY < 7
31 #endif // !defined(BOOST_PARAMETER_MAX_ARITY)
32 #include <boost/parameter.hpp>
34 #include <boost/type_traits/is_function.hpp>
42 #ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
43 BOOST_PARAMETER_TEMPLATE_KEYWORD(signature_type
)
45 BOOST_PARAMETER_TEMPLATE_KEYWORD(combiner_type
)
46 BOOST_PARAMETER_TEMPLATE_KEYWORD(group_type
)
47 BOOST_PARAMETER_TEMPLATE_KEYWORD(group_compare_type
)
48 BOOST_PARAMETER_TEMPLATE_KEYWORD(slot_function_type
)
49 BOOST_PARAMETER_TEMPLATE_KEYWORD(extended_slot_function_type
)
50 BOOST_PARAMETER_TEMPLATE_KEYWORD(mutex_type
)
51 } // namespace keywords
54 #ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
59 typename A1
= parameter::void_
,
60 typename A2
= parameter::void_
,
61 typename A3
= parameter::void_
,
62 typename A4
= parameter::void_
,
63 typename A5
= parameter::void_
,
64 typename A6
= parameter::void_
68 typedef parameter::parameters
<
69 #ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
70 parameter::required
<keywords::tag::signature_type
, is_function
<boost::mpl::_
> >,
72 parameter::optional
<keywords::tag::combiner_type
>,
73 parameter::optional
<keywords::tag::group_type
>,
74 parameter::optional
<keywords::tag::group_compare_type
>,
75 parameter::optional
<keywords::tag::slot_function_type
>,
76 parameter::optional
<keywords::tag::extended_slot_function_type
>,
77 parameter::optional
<keywords::tag::mutex_type
>
84 #ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
87 A1
, A2
, A3
, A4
, A5
, A6
>::type
90 #ifdef BOOST_SIGNALS2_NAMED_SIGNATURE_PARAMETER
91 typedef typename
parameter::value_type
<args
, keywords::tag::signature_type
>::type
94 typedef Signature signature_type
;
97 typedef typename
parameter::value_type
100 keywords::tag::combiner_type
,
103 typename
boost::function_traits
<signature_type
>::result_type
105 >::type combiner_type
;
108 parameter::value_type
<args
, keywords::tag::group_type
, int>::type group_type
;
111 parameter::value_type
<args
, keywords::tag::group_compare_type
, std::less
<group_type
> >::type
115 parameter::value_type
<args
, keywords::tag::slot_function_type
, function
<signature_type
> >::type
119 parameter::value_type
122 keywords::tag::extended_slot_function_type
,
123 typename
detail::extended_signature
<function_traits
<signature_type
>::arity
, signature_type
>::function_type
125 extended_slot_function_type
;
128 parameter::value_type
<args
, keywords::tag::mutex_type
, mutex
>::type mutex_type
;
137 extended_slot_function_type
,
141 } // namespace signals2
144 #endif // BOOST_SIGNALS2_SIGNAL_TYPE_HPP