signal.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // A thread-safe version of Boost.Signals.
  2. // Copyright Frank Mori Hess 2007-2009
  3. //
  4. // Use, modification and
  5. // distribution is subject to the Boost Software License, Version
  6. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. // For more information, see http://www.boost.org
  9. #ifndef BOOST_SIGNALS2_SIGNAL_HPP
  10. #define BOOST_SIGNALS2_SIGNAL_HPP
  11. #include <algorithm>
  12. #include <boost/assert.hpp>
  13. #include <boost/config.hpp>
  14. #include <boost/function.hpp>
  15. #include <boost/mpl/identity.hpp>
  16. #include <boost/noncopyable.hpp>
  17. #include <boost/shared_ptr.hpp>
  18. #include <boost/signals2/connection.hpp>
  19. #include <boost/signals2/detail/unique_lock.hpp>
  20. #include <boost/signals2/detail/replace_slot_function.hpp>
  21. #include <boost/signals2/detail/result_type_wrapper.hpp>
  22. #include <boost/signals2/detail/signals_common.hpp>
  23. #include <boost/signals2/detail/signals_common_macros.hpp>
  24. #include <boost/signals2/detail/slot_groups.hpp>
  25. #include <boost/signals2/detail/slot_call_iterator.hpp>
  26. #include <boost/signals2/optional_last_value.hpp>
  27. #include <boost/signals2/mutex.hpp>
  28. #include <boost/signals2/slot.hpp>
  29. #include <functional>
  30. #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
  31. #include <boost/signals2/preprocessed_signal.hpp>
  32. #else
  33. #include <boost/signals2/variadic_signal.hpp>
  34. #endif
  35. namespace boost
  36. {
  37. namespace signals2
  38. {
  39. // free swap function, findable by ADL
  40. template<typename Signature,
  41. typename Combiner,
  42. typename Group,
  43. typename GroupCompare,
  44. typename SlotFunction,
  45. typename ExtendedSlotFunction,
  46. typename Mutex>
  47. void swap(
  48. signal<Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> &sig1,
  49. signal<Signature, Combiner, Group, GroupCompare, SlotFunction, ExtendedSlotFunction, Mutex> &sig2) BOOST_NOEXCEPT
  50. {
  51. sig1.swap(sig2);
  52. }
  53. }
  54. }
  55. #endif // BOOST_SIGNALS2_SIGNAL_HPP