preprocessed_signal.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. A thread-safe version of Boost.Signals.
  3. Author: Frank Mori Hess <fmhess@users.sourceforge.net>
  4. Begin: 2007-01-23
  5. */
  6. // Copyright Frank Mori Hess 2007-2008
  7. // Use, modification and
  8. // distribution is subject to the Boost Software License, Version
  9. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. // For more information, see http://www.boost.org
  12. #ifndef BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP
  13. #define BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP
  14. #include <boost/preprocessor/arithmetic.hpp>
  15. #include <boost/preprocessor/cat.hpp>
  16. #include <boost/preprocessor/control/expr_if.hpp>
  17. #include <boost/preprocessor/iteration.hpp>
  18. #include <boost/preprocessor/repetition.hpp>
  19. #include <boost/signals2/detail/preprocessed_arg_type.hpp>
  20. #include <boost/type_traits/add_reference.hpp>
  21. #include <boost/type_traits/is_void.hpp>
  22. #include <boost/utility/enable_if.hpp>
  23. #define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS2_MAX_ARGS)
  24. #define BOOST_PP_FILENAME_1 <boost/signals2/detail/signal_template.hpp>
  25. #include BOOST_PP_ITERATE()
  26. namespace boost
  27. {
  28. namespace signals2
  29. {
  30. template<typename Signature,
  31. typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>,
  32. typename Group = int,
  33. typename GroupCompare = std::less<Group>,
  34. typename SlotFunction = function<Signature>,
  35. typename ExtendedSlotFunction = typename detail::extended_signature<function_traits<Signature>::arity, Signature>::function_type,
  36. typename Mutex = mutex >
  37. class signal: public detail::signalN<function_traits<Signature>::arity,
  38. Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type
  39. {
  40. private:
  41. typedef typename detail::signalN<boost::function_traits<Signature>::arity,
  42. Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type base_type;
  43. public:
  44. signal(const Combiner &combiner_arg = Combiner(), const GroupCompare &group_compare = GroupCompare()):
  45. base_type(combiner_arg, group_compare)
  46. {}
  47. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_WORKAROUND(BOOST_MSVC, < 1800)
  48. signal(signal && other) : base_type(std::move(other)) {}
  49. signal & operator=(signal && other) { base_type::operator=(std::move(other)); return *this; }
  50. #endif
  51. };
  52. }
  53. }
  54. #endif // BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP