Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:48

0001 // Boost.Signals2 library
0002 
0003 // Copyright Frank Mori Hess 2007-2009.
0004 // Copyright Timmo Stange 2007.
0005 // Copyright Douglas Gregor 2001-2004. Use, modification and
0006 // distribution is subject to the Boost Software License, Version
0007 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 // For more information, see http://www.boost.org
0011 
0012 #ifndef BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP
0013 #define BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP
0014 
0015 #include <boost/preprocessor/repetition.hpp>
0016 #include <boost/signals2/detail/preprocessed_arg_type.hpp>
0017 #include <boost/type_traits/function_traits.hpp>
0018 
0019 #ifndef BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS
0020 #define BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS 10
0021 #endif
0022 
0023 
0024 // template<typename Func, typename BindArgT0, typename BindArgT1, ..., typename BindArgTN-1> slotN(...
0025 #define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR(z, n, data) \
0026   template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \
0027   BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)( \
0028     const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)) \
0029   { \
0030     init_slot_function(boost::bind(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n))); \
0031   }
0032 #define BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS \
0033   BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR, ~)
0034 
0035 
0036 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_SIGNALS2_MAX_ARGS))
0037 #define BOOST_PP_FILENAME_1 <boost/signals2/detail/slot_template.hpp>
0038 #include BOOST_PP_ITERATE()
0039 
0040 #undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTOR
0041 #undef BOOST_SIGNALS2_SLOT_N_BINDING_CONSTRUCTORS
0042 
0043 namespace boost
0044 {
0045   namespace signals2
0046   {
0047     template<typename Signature,
0048       typename SlotFunction = boost::function<Signature> >
0049     class slot: public detail::slotN<function_traits<Signature>::arity,
0050       Signature, SlotFunction>::type
0051     {
0052     private:
0053       typedef typename detail::slotN<boost::function_traits<Signature>::arity,
0054         Signature, SlotFunction>::type base_type;
0055     public:
0056       template<typename F>
0057       slot(const F& f): base_type(f)
0058       {}
0059       // bind syntactic sugar
0060 // template<typename F, typename BindArgT0, typename BindArgT1, ..., typename BindArgTn-1> slot(...
0061 #define BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR(z, n, data) \
0062   template<typename Func, BOOST_SIGNALS2_PREFIXED_ARGS_TEMPLATE_DECL(n, BindArg)> \
0063     slot(const Func &func, BOOST_SIGNALS2_PREFIXED_FULL_REF_ARGS(n, const BindArg)): \
0064     base_type(func, BOOST_SIGNALS2_SIGNATURE_ARG_NAMES(n)) \
0065   {}
0066       BOOST_PP_REPEAT_FROM_TO(1, BOOST_SIGNALS2_SLOT_MAX_BINDING_ARGS, BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR, ~)
0067 #undef BOOST_SIGNALS2_SLOT_BINDING_CONSTRUCTOR
0068     };
0069   } // namespace signals2
0070 }
0071 
0072 #endif // BOOST_SIGNALS2_PREPROCESSED_SLOT_HPP