1 | #ifndef BOOST_STATECHART_TEST_OUTER_ORTHOGONAL_HPP_INCLUDED |
2 | #define BOOST_STATECHART_TEST_OUTER_ORTHOGONAL_HPP_INCLUDED |
3 | ////////////////////////////////////////////////////////////////////////////// |
4 | // Copyright 2004-2006 Andreas Huber Doenni |
5 | // Distributed under the Boost Software License, Version 1.0. (See accompany- |
6 | // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
7 | ////////////////////////////////////////////////////////////////////////////// |
8 | |
9 | |
10 | |
11 | #include <boost/statechart/state.hpp> |
12 | #include <boost/mpl/list.hpp> |
13 | |
14 | #include "InnermostDefault.hpp" |
15 | |
16 | |
17 | |
18 | namespace sc = boost::statechart; |
19 | namespace mpl = boost::mpl; |
20 | |
21 | |
22 | |
23 | ////////////////////////////////////////////////////////////////////////////// |
24 | template< class MostDerived, class Context, class InitialState0 > |
25 | struct Orthogonal0 : sc::state< MostDerived, Context, |
26 | mpl::list< |
27 | InitialState0, |
28 | Default1< MostDerived >, |
29 | Default2< MostDerived > > > |
30 | { |
31 | typedef sc::state< |
32 | MostDerived, Context, mpl::list< InitialState0, |
33 | Default1< MostDerived >, Default2< MostDerived > > > base_type; |
34 | typedef typename base_type::my_context my_context; |
35 | typedef Orthogonal0 my_base; |
36 | |
37 | Orthogonal0( my_context ctx ) : base_type( ctx ) |
38 | { |
39 | this->outermost_context().template ActualEntry< MostDerived >(); |
40 | } |
41 | |
42 | ~Orthogonal0() |
43 | { |
44 | this->outermost_context().template ActualDestructor< MostDerived >(); |
45 | } |
46 | |
47 | void exit() |
48 | { |
49 | this->outermost_context().template ActualExitFunction< MostDerived >(); |
50 | } |
51 | }; |
52 | |
53 | ////////////////////////////////////////////////////////////////////////////// |
54 | template< class MostDerived, class Context, class InitialState1 > |
55 | struct Orthogonal1 : sc::state< MostDerived, Context, |
56 | mpl::list< |
57 | Default0< MostDerived >, |
58 | InitialState1, |
59 | Default2< MostDerived > > > |
60 | { |
61 | typedef sc::state< |
62 | MostDerived, Context, mpl::list< Default0< MostDerived >, |
63 | InitialState1, Default2< MostDerived > > > base_type; |
64 | typedef typename base_type::my_context my_context; |
65 | typedef Orthogonal1 my_base; |
66 | |
67 | Orthogonal1( my_context ctx ) : base_type( ctx ) |
68 | { |
69 | this->outermost_context().template ActualEntry< MostDerived >(); |
70 | } |
71 | |
72 | ~Orthogonal1() |
73 | { |
74 | this->outermost_context().template ActualDestructor< MostDerived >(); |
75 | } |
76 | |
77 | void exit() |
78 | { |
79 | this->outermost_context().template ActualExitFunction< MostDerived >(); |
80 | } |
81 | }; |
82 | |
83 | ////////////////////////////////////////////////////////////////////////////// |
84 | template< class MostDerived, class Context, class InitialState2 > |
85 | struct Orthogonal2 : sc::state< MostDerived, Context, |
86 | mpl::list< |
87 | Default0< MostDerived >, |
88 | Default1< MostDerived >, |
89 | InitialState2 > > |
90 | { |
91 | typedef sc::state< |
92 | MostDerived, Context, mpl::list< Default0< MostDerived >, |
93 | Default1< MostDerived >, InitialState2 > > base_type; |
94 | typedef typename base_type::my_context my_context; |
95 | typedef Orthogonal2 my_base; |
96 | |
97 | Orthogonal2( my_context ctx ) : base_type( ctx ) |
98 | { |
99 | this->outermost_context().template ActualEntry< MostDerived >(); |
100 | } |
101 | |
102 | ~Orthogonal2() |
103 | { |
104 | this->outermost_context().template ActualDestructor< MostDerived >(); |
105 | } |
106 | |
107 | void exit() |
108 | { |
109 | this->outermost_context().template ActualExitFunction< MostDerived >(); |
110 | } |
111 | }; |
112 | |
113 | |
114 | |
115 | #endif |
116 | |