1 #include <boost/statechart/state_machine.hpp>
2 #include <boost/statechart/simple_state.hpp>
3 #include <boost/statechart/transition.hpp>
4 #include <boost/statechart/event.hpp>
5 #include <boost/mpl/list.hpp>
13 namespace sc = boost::statechart;
14 namespace mpl = boost::mpl;
16 struct state_1; // definice stavu
17 struct state_8; // definice stavu
18 struct state_9; // definice stavu
19 struct state_10; // definice stavu
20 struct state_11; // definice stavu
21 struct state_12; // definice stavu
22 struct state_13; // definice stavu
23 struct state_2; // definice stavu
25 struct state_3; // definice stavu
26 struct state_4; // definice stavu
27 struct state_5; // definice stavu
28 struct state_6; // definice stavu
29 struct state_7; // definice stavu
31 struct Ev1 : sc::event< Ev1 > {};//stisteno A
32 struct Ev2 : sc::event< Ev2 > {};//stisteno N
33 struct Ev3 : sc::event< Ev3 > {};//stisteno N
34 struct Ev4 : sc::event< Ev4 > {};//stisteno N
35 struct MyMachine : sc::state_machine< MyMachine, state_1 > {};//Nastaveni inicializacniho stavu
37 struct state_1 : sc::simple_state< state_1, MyMachine> // stav
39 state_1() {}//FSM_Entry
40 ~state_1() {}//FSM_Exit
41 typedef mpl::list< // reakce na udalosti
42 sc::transition< Ev2, state_1 >,
43 sc::transition< Ev1, state_2 >,
44 sc::transition< Ev3, state_8 > > reactions;
46 struct state_2 : sc::simple_state< state_2, MyMachine, state_3 >
50 typedef sc::transition< Ev2, state_2 > reactions;
52 struct state_8 : sc::simple_state< state_8, MyMachine> // stav
54 state_8() {}//FSM_Entry
55 ~state_8() {}//FSM_Exit
56 typedef mpl::list< // reakce na udalosti
57 sc::transition< Ev2, state_10 >,
58 sc::transition< Ev1, state_9 >,
59 sc::transition< Ev3, state_11 >,
60 sc::transition< Ev4, state_12 > > reactions;
63 struct state_9 : sc::simple_state< state_9, MyMachine >
67 typedef sc::transition< Ev1, state_13 > reactions;
70 struct state_10 : sc::simple_state< state_10, MyMachine >
74 typedef sc::transition< Ev2, state_13 > reactions;
77 struct state_11 : sc::simple_state< state_11, MyMachine >
81 typedef sc::transition< Ev3, state_13 > reactions;
84 struct state_12 : sc::simple_state< state_12, MyMachine >
88 typedef sc::transition< Ev4, state_13 > reactions;
91 struct state_13 : sc::simple_state< state_13, MyMachine >
95 typedef sc::transition< Ev2, state_8 > reactions;
98 struct state_3 : sc::simple_state< state_3, state_2 >
102 typedef sc::transition< Ev1, state_4 > reactions;
104 struct state_4 : sc::simple_state< state_4, state_2 >
109 sc::transition< Ev3, state_3 >,
110 sc::transition< Ev2, state_5 > > reactions;
112 struct state_5 : sc::simple_state< state_5, state_2, state_6 >
116 typedef sc::transition< Ev3, state_1 > reactions;
118 struct state_6 : sc::simple_state< state_6, state_5 >
122 typedef sc::transition< Ev4, state_7 > reactions;
124 struct state_7 : sc::simple_state< state_7, state_5 >
128 typedef sc::transition< Ev2, state_6 > reactions;