InvalidTransitionTest2.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //////////////////////////////////////////////////////////////////////////////
  2. // Copyright 2004-2006 Andreas Huber Doenni
  3. // Distributed under the Boost Software License, Version 1.0. (See accompany-
  4. // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. //////////////////////////////////////////////////////////////////////////////
  6. #include <boost/statechart/state_machine.hpp>
  7. #include <boost/statechart/simple_state.hpp>
  8. #include <boost/statechart/event.hpp>
  9. #include <boost/statechart/transition.hpp>
  10. #include <boost/mpl/list.hpp>
  11. namespace sc = boost::statechart;
  12. namespace mpl = boost::mpl;
  13. struct EvX : sc::event< EvX > {};
  14. struct Active;
  15. struct InvalidTransitionTest : sc::state_machine<
  16. InvalidTransitionTest, Active > {};
  17. struct Idle0;
  18. struct Idle1;
  19. struct Active : sc::simple_state<
  20. Active, InvalidTransitionTest, mpl::list< Idle0, Idle1 > > {};
  21. struct Idle00;
  22. struct Idle0 : sc::simple_state<
  23. Idle0, Active::orthogonal< 0 >, Idle00 > {};
  24. struct Idle00 : sc::simple_state< Idle00, Idle0 > {};
  25. struct Idle10;
  26. struct Idle1 : sc::simple_state<
  27. Idle1, Active::orthogonal< 1 >, Idle10 > {};
  28. // Invalid transition between different orthogonal regions.
  29. struct Idle10 : sc::simple_state< Idle10, Idle1 >
  30. {
  31. typedef sc::transition< EvX, Idle00 > reactions;
  32. };
  33. int main()
  34. {
  35. InvalidTransitionTest machine;
  36. machine.initiate();
  37. return 0;
  38. }