event.hpp 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef BOOST_FSM_EVENT_INCLUDED
  2. #define BOOST_FSM_EVENT_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2002-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include "base_event.hpp"
  14. namespace fsm { namespace aux {
  15. template< typename Derived >
  16. struct event
  17. : base_event
  18. {
  19. public:
  20. typedef base_event base_t;
  21. private:
  22. #if defined(BOOST_NO_CXX11_SMART_PTR)
  23. virtual std::auto_ptr<base_event> do_clone() const
  24. {
  25. return std::auto_ptr<base_event>(
  26. new Derived(static_cast<Derived const&>(*this))
  27. );
  28. }
  29. #else
  30. virtual std::unique_ptr<base_event> do_clone() const
  31. {
  32. return std::unique_ptr<base_event>(
  33. new Derived(static_cast<Derived const&>(*this))
  34. );
  35. }
  36. #endif
  37. };
  38. }}
  39. #endif // BOOST_FSM_EVENT_INCLUDED