preprocessed_signal.hpp 2.5 KB

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