]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/signals2/include/boost/signals2/detail/signals_common_macros.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / signals2 / include / boost / signals2 / detail / signals_common_macros.hpp
1 /*
2 Author: Frank Mori Hess <fmhess@users.sourceforge.net>
3 Begin: 2007-01-23
4 */
5 // Copyright Frank Mori Hess 2007-2008
6 // Use, modification and
7 // distribution is subject to the Boost Software License, Version
8 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 #ifndef BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP
12 #define BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP
13
14 #include <boost/config.hpp>
15
16 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
17
18 #ifndef BOOST_SIGNALS2_MAX_ARGS
19 #define BOOST_SIGNALS2_MAX_ARGS 9
20 #endif
21
22 // signaln
23 #define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(signal, arity)
24 // weak_signaln
25 #define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(weak_, BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity))
26 // signaln_impl
27 #define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) BOOST_PP_CAT(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity), _impl)
28 // argn
29 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n))
30 // Tn argn
31 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARG(z, n, data) \
32 BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
33 // T1 arg1, T2 arg2, ..., Tn argn
34 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) \
35 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_FULL_ARG, ~)
36 // arg1, arg2, ..., argn
37 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_ARG_NAME, ~)
38 // T1, T2, ..., TN
39 #define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) \
40 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
41 // R (T1, T2, ..., TN)
42 #define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) \
43 R ( BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) )
44 // typename prefixR, typename prefixT1, typename prefixT2, ..., typename prefixTN
45 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) \
46 typename BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) \
47 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T))
48 // typename R, typename T1, typename T2, ..., typename TN
49 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) \
50 typename R BOOST_PP_COMMA_IF(arity) \
51 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T)
52 // typename prefixT1, typename prefixT2, ..., typename prefixTN
53 #define BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(arity, prefix) \
54 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T))
55 // typename T1, typename T2, ..., typename TN
56 #define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) \
57 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T)
58 // prefixR, prefixT1, prefixT2, ..., prefixTN
59 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) \
60 BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), BOOST_PP_CAT(prefix, T))
61 // R, T1, T2, ..., TN
62 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) \
63 R BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
64 // boost::functionN<R, T1, T2, ..., TN>
65 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, arity)<\
66 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) >
67 // R, const boost::signals2::connection&, T1, T2, ..., TN
68 #define BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) \
69 R, const boost::signals2::connection& BOOST_PP_COMMA_IF(arity) \
70 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
71 // boost::functionN<R, const boost::signals2::connection &, T1, T2, ..., TN>
72 #define BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, BOOST_PP_INC(arity))<\
73 BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) >
74 // slotN
75 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) BOOST_PP_CAT(slot, arity)
76 // slotN+1<R, const connection &, T1, T2, ..., TN, extended_slot_function_type>
77 #define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) \
78 BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_PP_INC(arity))< \
79 BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity), \
80 extended_slot_function_type>
81 // bound_extended_slot_functionN
82 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) BOOST_PP_CAT(bound_extended_slot_function, arity)
83 // bound_extended_slot_function_helperN
84 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) BOOST_PP_CAT(bound_extended_slot_function_invoker, arity)
85 // typename function_traits<Signature>::argn_type
86 #define BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE(z, n, Signature) \
87 BOOST_PP_CAT(BOOST_PP_CAT(typename function_traits<Signature>::arg, BOOST_PP_INC(n)), _type)
88 // typename function_traits<Signature>::result_type,
89 // typename function_traits<Signature>::arg1_type,
90 // typename function_traits<Signature>::arg2_type,
91 // ...,
92 // typename function_traits<Signature>::argn_type
93 #define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) \
94 typename function_traits<Signature>::result_type \
95 BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE, Signature)
96 // prefixTn & argn
97 #define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG(z, n, prefix) \
98 BOOST_PP_CAT(BOOST_PP_CAT(prefix, T), BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
99 // prefixT1 & arg1, prefixT2 & arg2, ..., prefixTn & argn
100 #define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(arity, prefix) \
101 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG, prefix)
102 // Tn & argn
103 #define BOOST_SIGNALS2_FULL_CREF_ARG(z, n, data) \
104 const BOOST_PP_CAT(T, BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
105 // const T1 & arg1, const T2 & arg2, ..., const Tn & argn
106 #define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) \
107 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_FULL_CREF_ARG, ~)
108 #define BOOST_SIGNALS2_FORWARDED_ARGS(arity) \
109 BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity)
110 // preprocessed_arg_typeN
111 #define BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(arity) BOOST_PP_CAT(preprocessed_arg_type, arity)
112
113 // typename R, typename T1, typename T2, ..., typename TN, typename SlotFunction
114 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \
115 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
116 typename SlotFunction
117 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION
118
119 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ...
120 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \
121 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
122 typename Combiner, \
123 typename Group, \
124 typename GroupCompare, \
125 typename SlotFunction, \
126 typename ExtendedSlotFunction, \
127 typename Mutex
128 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner = optional_last_value<R>, ...
129 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \
130 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
131 typename Combiner = optional_last_value<R>, \
132 typename Group = int, \
133 typename GroupCompare = std::less<Group>, \
134 typename SlotFunction = BOOST_SIGNALS2_FUNCTION_N_DECL(arity), \
135 typename ExtendedSlotFunction = BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity), \
136 typename Mutex = signals2::mutex
137 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity)
138 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION
139
140 #define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) std_functional_base
141
142 #define BOOST_SIGNALS2_PP_COMMA_IF(arity) BOOST_PP_COMMA_IF(arity)
143
144 #else // BOOST_NO_CXX11_VARIADIC_TEMPLATES
145
146 #define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) signal
147 #define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) weak_signal
148 #define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) signal_impl
149 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) typename Signature
150 #define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) Args...
151 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) R (Args...)
152 #define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) R (Args...)
153 #define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) typename ... Args
154 #define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) Args && ... args
155 #define BOOST_SIGNALS2_FORWARDED_ARGS(arity) std::forward<Args>(args)...
156 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) slot
157 #define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) slot<R (const connection &, Args...), extended_slot_function_type>
158 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) bound_extended_slot_function
159 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) bound_extended_slot_function_invoker
160 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) boost::function<Signature>
161 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) typename prefixSignature
162 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) prefixSignature
163 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) Args ... args
164 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) args...
165 #define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) Signature
166
167 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \
168 typename SlotFunction, \
169 typename R, \
170 typename ... Args
171 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION \
172 <R (Args...), SlotFunction>
173
174 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \
175 typename Signature, \
176 typename Combiner, \
177 typename Group, \
178 typename GroupCompare, \
179 typename SlotFunction, \
180 typename ExtendedSlotFunction, \
181 typename Mutex
182 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \
183 typename Signature, \
184 typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>, \
185 typename Group = int, \
186 typename GroupCompare = std::less<Group>, \
187 typename SlotFunction = boost::function<Signature>, \
188 typename ExtendedSlotFunction = typename detail::variadic_extended_signature<Signature>::function_type, \
189 typename Mutex = signals2::mutex
190 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) \
191 typename Combiner, \
192 typename Group, \
193 typename GroupCompare, \
194 typename SlotFunction, \
195 typename ExtendedSlotFunction, \
196 typename Mutex, \
197 typename R, \
198 typename ... Args
199 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION <\
200 R (Args...), \
201 Combiner, \
202 Group, \
203 GroupCompare, \
204 SlotFunction, \
205 ExtendedSlotFunction, \
206 Mutex>
207
208 #define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) \
209 std_functional_base<result_type , Args...>
210
211 #define BOOST_SIGNALS2_PP_COMMA_IF(arity) ,
212
213 #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
214
215 #endif // BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP