• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
7 
8 
9 #include <boost/statechart/state_machine.hpp>
10 #include <boost/statechart/simple_state.hpp>
11 #include <boost/statechart/event.hpp>
12 #include <boost/statechart/custom_reaction.hpp>
13 
14 
15 
16 namespace sc = boost::statechart;
17 
18 
19 
20 struct EvX : sc::event< EvX > {};
21 
22 struct A;
23 struct InconsistentHistoryTest : sc::state_machine<
24   InconsistentHistoryTest, A > {};
25 
26 struct B;
27 // A only has deep history
28 struct A : sc::simple_state<
29   A, InconsistentHistoryTest, B, sc::has_deep_history >
30 {
31   typedef sc::custom_reaction< EvX > reactions;
32 
reactA33   sc::result react( const EvX & )
34   {
35     // A only has deep history
36     clear_shallow_history< A, 0 >();
37     return discard_event();
38   }
39 };
40 
41   struct B : sc::simple_state< B, A > {};
42 
43 
main()44 int main()
45 {
46   InconsistentHistoryTest machine;
47   machine.initiate();
48   return 0;
49 }
50