InconsistentHistoryTest8.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //////////////////////////////////////////////////////////////////////////////
  2. // Copyright 2005-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/custom_reaction.hpp>
  10. namespace sc = boost::statechart;
  11. struct EvX : sc::event< EvX > {};
  12. struct A;
  13. struct InconsistentHistoryTest : sc::state_machine<
  14. InconsistentHistoryTest, A > {};
  15. struct B;
  16. // A only has deep history
  17. struct A : sc::simple_state<
  18. A, InconsistentHistoryTest, B, sc::has_shallow_history >
  19. {
  20. typedef sc::custom_reaction< EvX > reactions;
  21. sc::result react( const EvX & )
  22. {
  23. // A only has shallow history
  24. clear_deep_history< A, 0 >();
  25. return discard_event();
  26. }
  27. };
  28. struct B : sc::simple_state< B, A > {};
  29. int main()
  30. {
  31. InconsistentHistoryTest machine;
  32. machine.initiate();
  33. return 0;
  34. }