]> rtime.felk.cvut.cz Git - boost-statechart-viewer.git/blob - examples/machine_header.h
Create dir for MSVC version source files. Update commentaries at source files.
[boost-statechart-viewer.git] / examples / machine_header.h
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>
6
7 #include <iostream>
8 #include <string>
9
10 using namespace std;
11
12
13 namespace sc = boost::statechart;
14 namespace mpl = boost::mpl;
15
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
24
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
30
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
36
37 struct state_1 : sc::simple_state< state_1, MyMachine> // stav
38 {
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;
45 };
46 struct state_2 : sc::simple_state< state_2, MyMachine, state_3 >
47 {
48     state_2() { }
49     ~state_2() { }
50     typedef sc::transition< Ev2, state_2 > reactions;
51 };
52 struct state_8 : sc::simple_state< state_8, MyMachine> // stav
53 {
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;
61 };
62
63 struct state_9 : sc::simple_state< state_9, MyMachine >
64 {
65     state_9() { }
66     ~state_9() { }
67     typedef sc::transition< Ev1, state_13 > reactions;
68 };
69
70 struct state_10 : sc::simple_state< state_10, MyMachine >
71 {
72     state_10() { }
73     ~state_10() { }
74     typedef sc::transition< Ev2, state_13 > reactions;
75 };
76
77 struct state_11 : sc::simple_state< state_11, MyMachine >
78 {
79     state_11() { }
80     ~state_11() { }
81     typedef sc::transition< Ev3, state_13 > reactions;
82 };
83
84 struct state_12 : sc::simple_state< state_12, MyMachine >
85 {
86     state_12() { }
87     ~state_12() { }
88     typedef sc::transition< Ev4, state_13 > reactions;
89 };
90
91 struct state_13 : sc::simple_state< state_13, MyMachine >
92 {
93     state_13() { }
94     ~state_13() { }
95     typedef sc::transition< Ev2, state_8 > reactions;
96 };
97
98 struct state_3 : sc::simple_state< state_3, state_2 >
99 {
100     state_3() { }
101     ~state_3() { }
102     typedef sc::transition< Ev1, state_4 > reactions;
103 };
104 struct state_4 : sc::simple_state< state_4, state_2 >
105 {
106     state_4() { }
107     ~state_4() { }
108     typedef mpl::list<
109                         sc::transition< Ev3, state_3 >,
110                         sc::transition< Ev2, state_5 > > reactions;
111 };
112 struct state_5 : sc::simple_state< state_5, state_2, state_6 >
113 {
114     state_5() { }
115     ~state_5() { }
116     typedef sc::transition< Ev3, state_1 > reactions;
117 };
118 struct state_6 : sc::simple_state< state_6, state_5 >
119 {
120     state_6() { }
121     ~state_6() { }
122     typedef sc::transition< Ev4, state_7 > reactions;
123 };
124 struct state_7 : sc::simple_state< state_7, state_5 >
125 {
126     state_7() { }
127     ~state_7() { }
128     typedef sc::transition< Ev2, state_6 > reactions;
129 };
130
131
132
133