File indexing completed on 2025-01-18 09:51:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP
0012 #define BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP
0013
0014 #include <boost/config.hpp>
0015
0016 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
0017
0018 #ifndef BOOST_SIGNALS2_MAX_ARGS
0019 #define BOOST_SIGNALS2_MAX_ARGS 9
0020 #endif
0021
0022
0023 #define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(signal, arity)
0024
0025 #define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(weak_, BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity))
0026
0027 #define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) BOOST_PP_CAT(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity), _impl)
0028
0029 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n))
0030
0031 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARG(z, n, data) \
0032 BOOST_PP_CAT(T, BOOST_PP_INC(n)) BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
0033
0034 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) \
0035 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_FULL_ARG, ~)
0036
0037 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_ARG_NAME, ~)
0038
0039 #define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) \
0040 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
0041
0042 #define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) \
0043 R ( BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) )
0044
0045 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) \
0046 typename BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) \
0047 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T))
0048
0049 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) \
0050 typename R BOOST_PP_COMMA_IF(arity) \
0051 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T)
0052
0053 #define BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(arity, prefix) \
0054 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename BOOST_PP_CAT(prefix, T))
0055
0056 #define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) \
0057 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T)
0058
0059 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) \
0060 BOOST_PP_CAT(prefix, R) BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), BOOST_PP_CAT(prefix, T))
0061
0062 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) \
0063 R BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
0064
0065 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, arity)<\
0066 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) >
0067
0068 #define BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) \
0069 R, const boost::signals2::connection& BOOST_PP_COMMA_IF(arity) \
0070 BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
0071
0072 #define BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, BOOST_PP_INC(arity))<\
0073 BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity) >
0074
0075 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) BOOST_PP_CAT(slot, arity)
0076
0077 #define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) \
0078 BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_PP_INC(arity))< \
0079 BOOST_SIGNALS2_EXT_SLOT_TEMPLATE_INSTANTIATION(arity), \
0080 extended_slot_function_type>
0081
0082 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) BOOST_PP_CAT(bound_extended_slot_function, arity)
0083
0084 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) BOOST_PP_CAT(bound_extended_slot_function_invoker, arity)
0085
0086 #define BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE(z, n, Signature) \
0087 BOOST_PP_CAT(BOOST_PP_CAT(typename function_traits<Signature>::arg, BOOST_PP_INC(n)), _type)
0088
0089
0090
0091
0092
0093 #define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) \
0094 typename function_traits<Signature>::result_type \
0095 BOOST_PP_COMMA_IF(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_TO_ARGN_TYPE, Signature)
0096
0097 #define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG(z, n, prefix) \
0098 BOOST_PP_CAT(BOOST_PP_CAT(prefix, T), BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
0099
0100 #define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(arity, prefix) \
0101 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG, prefix)
0102
0103 #define BOOST_SIGNALS2_FULL_CREF_ARG(z, n, data) \
0104 const BOOST_PP_CAT(T, BOOST_PP_INC(n)) & BOOST_SIGNALS2_SIGNATURE_ARG_NAME(~, n, ~)
0105
0106 #define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) \
0107 BOOST_PP_ENUM(arity, BOOST_SIGNALS2_FULL_CREF_ARG, ~)
0108 #define BOOST_SIGNALS2_FORWARDED_ARGS(arity) \
0109 BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity)
0110
0111 #define BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(arity) BOOST_PP_CAT(preprocessed_arg_type, arity)
0112
0113
0114 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \
0115 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
0116 typename SlotFunction
0117 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION
0118
0119
0120 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \
0121 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
0122 typename Combiner, \
0123 typename Group, \
0124 typename GroupCompare, \
0125 typename SlotFunction, \
0126 typename ExtendedSlotFunction, \
0127 typename Mutex
0128
0129 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \
0130 BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity), \
0131 typename Combiner = optional_last_value<R>, \
0132 typename Group = int, \
0133 typename GroupCompare = std::less<Group>, \
0134 typename SlotFunction = BOOST_SIGNALS2_FUNCTION_N_DECL(arity), \
0135 typename ExtendedSlotFunction = BOOST_SIGNALS2_EXT_FUNCTION_N_DECL(arity), \
0136 typename Mutex = signals2::mutex
0137 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity)
0138 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION
0139
0140 #define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE std_functional_base
0141
0142 #define BOOST_SIGNALS2_PP_COMMA_IF(arity) BOOST_PP_COMMA_IF(arity)
0143
0144 #else
0145
0146 #define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) signal
0147 #define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) weak_signal
0148 #define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) signal_impl
0149 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_DECL(arity) typename Signature
0150 #define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) Args...
0151 #define BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) R (Args...)
0152 #define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) R (Args...)
0153 #define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) typename ... Args
0154 #define BOOST_SIGNALS2_FULL_FORWARD_ARGS(arity) Args && ... args
0155 #define BOOST_SIGNALS2_FORWARDED_ARGS(arity) std::forward<Args>(args)...
0156 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) slot
0157 #define BOOST_SIGNALS2_EXTENDED_SLOT_TYPE(arity) slot<R (const connection &, Args...), extended_slot_function_type>
0158 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) bound_extended_slot_function
0159 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) bound_extended_slot_function_invoker
0160 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) boost::function<Signature>
0161 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_DECL(arity, prefix) typename prefixSignature
0162 #define BOOST_SIGNALS2_PREFIXED_SIGNATURE_TEMPLATE_INSTANTIATION(arity, prefix) prefixSignature
0163 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) Args ... args
0164 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) args...
0165 #define BOOST_SIGNALS2_PORTABLE_SIGNATURE(arity, Signature) Signature
0166
0167 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(arity) \
0168 typename SlotFunction, \
0169 typename R, \
0170 typename ... Args
0171 #define BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION \
0172 <R (Args...), SlotFunction>
0173
0174 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity) \
0175 typename Signature, \
0176 typename Combiner, \
0177 typename Group, \
0178 typename GroupCompare, \
0179 typename SlotFunction, \
0180 typename ExtendedSlotFunction, \
0181 typename Mutex
0182 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_DEFAULTED_DECL(arity) \
0183 typename Signature, \
0184 typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>, \
0185 typename Group = int, \
0186 typename GroupCompare = std::less<Group>, \
0187 typename SlotFunction = boost::function<Signature>, \
0188 typename ExtendedSlotFunction = typename detail::variadic_extended_signature<Signature>::function_type, \
0189 typename Mutex = signals2::mutex
0190 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) \
0191 typename Combiner, \
0192 typename Group, \
0193 typename GroupCompare, \
0194 typename SlotFunction, \
0195 typename ExtendedSlotFunction, \
0196 typename Mutex, \
0197 typename R, \
0198 typename ... Args
0199 #define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION <\
0200 R (Args...), \
0201 Combiner, \
0202 Group, \
0203 GroupCompare, \
0204 SlotFunction, \
0205 ExtendedSlotFunction, \
0206 Mutex>
0207
0208 #define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE \
0209 std_functional_base<Args...>
0210
0211 #define BOOST_SIGNALS2_PP_COMMA_IF(arity) ,
0212
0213 #endif
0214
0215 #endif