Open.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2010 Christophe Henry
  2. // henry UNDERSCORE christophe AT hotmail DOT com
  3. // This is an extended version of the state machine available in the boost::mpl library
  4. // Distributed under the same license as the original.
  5. // Copyright for the original version:
  6. // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
  7. // under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef OPEN_HPP
  11. #define OPEN_HPP
  12. // back-end
  13. #include <boost/msm/back/state_machine.hpp>
  14. //front-end
  15. #include <boost/msm/front/state_machine_def.hpp>
  16. #include <boost/msm/front/row2.hpp>
  17. #include "Events.hpp"
  18. struct Empty;
  19. namespace msm = boost::msm;
  20. namespace mpl = boost::mpl;
  21. using namespace msm::front;
  22. struct Open : public msm::front::state<>
  23. {
  24. template <class Event,class FSM>
  25. void on_entry(Event const& ,FSM&) {std::cout << "entering: Open" << std::endl;}
  26. template <class Event,class FSM>
  27. void on_exit(Event const&,FSM& ) {std::cout << "leaving: Open" << std::endl;}
  28. void close_drawer(open_close const&);
  29. struct internal_transition_table : mpl::vector<
  30. // Start Event Next Action Guard
  31. //+-------------+---------+-------------+---------+---------------------------+----------------------+
  32. msm::front::a_row2 < Open , open_close , Empty , Open,&Open::close_drawer >
  33. //+-------------+---------+-------------+---------+---------------------------+----------------------+
  34. > {};
  35. };
  36. #endif