• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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/transition.hpp>
13 
14 #include <boost/mpl/list.hpp>
15 
16 
17 
18 namespace sc = boost::statechart;
19 namespace mpl = boost::mpl;
20 
21 
22 
23 struct EvX : sc::event< EvX > {};
24 
25 struct Active;
26 struct InvalidTransitionTest : sc::state_machine<
27   InvalidTransitionTest, Active > {};
28 
29 struct Idle0;
30 struct Idle1;
31 struct Active : sc::simple_state<
32   Active, InvalidTransitionTest, mpl::list< Idle0, Idle1 > > {};
33 
34   struct Idle00;
35   struct Idle0 : sc::simple_state<
36     Idle0, Active::orthogonal< 0 >, Idle00 > {};
37 
38     struct Idle00 : sc::simple_state< Idle00, Idle0 > {};
39 
40   struct Idle10;
41   struct Idle1 : sc::simple_state<
42     Idle1, Active::orthogonal< 1 >, Idle10 > {};
43 
44     // Invalid transition between different orthogonal regions.
45     struct Idle10 : sc::simple_state< Idle10, Idle1 >
46     {
47       typedef sc::transition< EvX, Idle00 > reactions;
48     };
49 
50 
main()51 int main()
52 {
53   InvalidTransitionTest machine;
54   machine.initiate();
55   return 0;
56 }
57