Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:41

0001 /*
0002   Author: Frank Mori Hess <fmhess@users.sourceforge.net>
0003   Begin: 2007-01-23
0004 */
0005 // Copyright Frank Mori Hess 2007-2008
0006 // Use, modification and
0007 // distribution is subject to the Boost Software License, Version
0008 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
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 // signaln
0023 #define BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(signal, arity)
0024 // weak_signaln
0025 #define BOOST_SIGNALS2_WEAK_SIGNAL_CLASS_NAME(arity) BOOST_PP_CAT(weak_, BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity))
0026 // signaln_impl
0027 #define BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(arity) BOOST_PP_CAT(BOOST_SIGNALS2_SIGNAL_CLASS_NAME(arity), _impl)
0028 // argn
0029 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAME(z, n, data) BOOST_PP_CAT(arg, BOOST_PP_INC(n))
0030 // Tn argn
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 // T1 arg1, T2 arg2, ..., Tn argn
0034 #define BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(arity) \
0035   BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_FULL_ARG, ~)
0036 // arg1, arg2, ..., argn
0037 #define BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(arity) BOOST_PP_ENUM(arity, BOOST_SIGNALS2_SIGNATURE_ARG_NAME, ~)
0038 // T1, T2, ..., TN
0039 #define BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) \
0040   BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), T)
0041 // R (T1, T2, ..., TN)
0042 #define BOOST_SIGNALS2_SIGNATURE_FUNCTION_TYPE(arity) \
0043   R ( BOOST_SIGNALS2_ARGS_TEMPLATE_INSTANTIATION(arity) )
0044 // typename prefixR, typename prefixT1, typename prefixT2, ..., typename prefixTN
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 // typename R, typename T1, typename T2, ..., typename TN
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 // typename prefixT1, typename prefixT2, ..., typename prefixTN
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 // typename T1, typename T2, ..., typename TN
0056 #define BOOST_SIGNALS2_ARGS_TEMPLATE_DECL(arity) \
0057   BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(arity), typename T)
0058 // prefixR, prefixT1, prefixT2, ..., prefixTN
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 // R, T1, T2, ..., TN
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 // boost::functionN<R, T1, T2, ..., TN>
0065 #define BOOST_SIGNALS2_FUNCTION_N_DECL(arity) BOOST_PP_CAT(boost::function, arity)<\
0066   BOOST_SIGNALS2_SIGNATURE_TEMPLATE_INSTANTIATION(arity) >
0067 // R, const boost::signals2::connection&, T1, T2, ..., TN
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 // boost::functionN<R, const boost::signals2::connection &, T1, T2, ..., TN>
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 // slotN
0075 #define BOOST_SIGNALS2_SLOT_CLASS_NAME(arity) BOOST_PP_CAT(slot, arity)
0076 // slotN+1<R, const connection &, T1, T2, ..., TN, extended_slot_function_type>
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 // bound_extended_slot_functionN
0082 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(arity) BOOST_PP_CAT(bound_extended_slot_function, arity)
0083 // bound_extended_slot_function_helperN
0084 #define BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_INVOKER_N(arity) BOOST_PP_CAT(bound_extended_slot_function_invoker, arity)
0085 // typename function_traits<Signature>::argn_type
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 // typename function_traits<Signature>::result_type,
0089 // typename function_traits<Signature>::arg1_type,
0090 // typename function_traits<Signature>::arg2_type,
0091 // ...,
0092 // typename function_traits<Signature>::argn_type
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 // prefixTn & argn
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 // prefixT1 & arg1, prefixT2 & arg2, ..., prefixTn & argn
0100 #define BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(arity, prefix) \
0101   BOOST_PP_ENUM(arity, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARG, prefix)
0102 // Tn & argn
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 // const T1 & arg1, const T2 & arg2, ..., const Tn & argn
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 // preprocessed_arg_typeN
0111 #define BOOST_SIGNALS2_PREPROCESSED_ARG_N_TYPE_CLASS_NAME(arity) BOOST_PP_CAT(preprocessed_arg_type, arity)
0112 
0113 // typename R, typename T1, typename T2, ..., typename TN, typename SlotFunction
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 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner, ...
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 // typename R, typename T1, typename T2, ..., typename TN, typename Combiner = optional_last_value<R>, ...
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 // BOOST_NO_CXX11_VARIADIC_TEMPLATES
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 // BOOST_NO_CXX11_VARIADIC_TEMPLATES
0214 
0215 #endif // BOOST_SIGNALS2_SIGNALS_COMMON_MACROS_HPP