preprocessed_signal.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/config.hpp>
  15. #include <boost/preprocessor/arithmetic.hpp>
  16. #include <boost/preprocessor/cat.hpp>
  17. #include <boost/preprocessor/control/expr_if.hpp>
  18. #include <boost/preprocessor/iteration.hpp>
  19. #include <boost/preprocessor/repetition.hpp>
  20. #include <boost/signals2/detail/preprocessed_arg_type.hpp>
  21. #include <boost/type_traits/add_reference.hpp>
  22. #include <boost/type_traits/is_void.hpp>
  23. #include <boost/utility/enable_if.hpp>
  24. #define BOOST_PP_ITERATION_LIMITS (0, BOOST_SIGNALS2_MAX_ARGS)
  25. #define BOOST_PP_FILENAME_1 <boost/signals2/detail/signal_template.hpp>
  26. #include BOOST_PP_ITERATE()
  27. namespace boost
  28. {
  29. namespace signals2
  30. {
  31. template<typename Signature,
  32. typename Combiner = optional_last_value<typename boost::function_traits<Signature>::result_type>,
  33. typename Group = int,
  34. typename GroupCompare = std::less<Group>,
  35. typename SlotFunction = function<Signature>,
  36. typename ExtendedSlotFunction = typename detail::extended_signature<function_traits<Signature>::arity, Signature>::function_type,
  37. typename Mutex = mutex >
  38. class signal: public detail::signalN<function_traits<Signature>::arity,
  39. Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type
  40. {
  41. private:
  42. typedef typename detail::signalN<boost::function_traits<Signature>::arity,
  43. Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex>::type base_type;
  44. public:
  45. signal(const Combiner &combiner_arg = Combiner(), const GroupCompare &group_compare = GroupCompare()):
  46. base_type(combiner_arg, group_compare)
  47. {}
  48. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_WORKAROUND(BOOST_MSVC, < 1800)
  49. signal(signal && other) BOOST_NOEXCEPT: base_type(std::move(other)) {}
  50. signal & operator=(signal && other) BOOST_NOEXCEPT{ base_type::operator=(std::move(other)); return *this; }
  51. #endif
  52. };
  53. }
  54. }
  55. #endif // BOOST_SIGNALS2_PREPROCESSED_SIGNAL_HPP