1 | #ifndef BOOST_STATECHART_TEST_INNERMOST_DEFAULT_HPP_INCLUDED |
---|
2 | #define BOOST_STATECHART_TEST_INNERMOST_DEFAULT_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 | |
---|
13 | |
---|
14 | |
---|
15 | namespace sc = boost::statechart; |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | ////////////////////////////////////////////////////////////////////////////// |
---|
20 | template< class MostDerived, class Context > |
---|
21 | struct InnermostDefault : sc::state< MostDerived, Context > |
---|
22 | { |
---|
23 | typedef sc::state< MostDerived, Context > base_type; |
---|
24 | typedef typename base_type::my_context my_context; |
---|
25 | typedef InnermostDefault my_base; |
---|
26 | |
---|
27 | InnermostDefault( my_context ctx ) : base_type( ctx ) |
---|
28 | { |
---|
29 | this->outermost_context().template ActualEntry< MostDerived >(); |
---|
30 | } |
---|
31 | |
---|
32 | ~InnermostDefault() |
---|
33 | { |
---|
34 | this->outermost_context().template ActualDestructor< MostDerived >(); |
---|
35 | } |
---|
36 | |
---|
37 | void exit() |
---|
38 | { |
---|
39 | this->outermost_context().template ActualExitFunction< MostDerived >(); |
---|
40 | } |
---|
41 | }; |
---|
42 | |
---|
43 | ////////////////////////////////////////////////////////////////////////////// |
---|
44 | template< class Context > |
---|
45 | struct Default0 : InnermostDefault< |
---|
46 | Default0< Context >, typename Context::template orthogonal< 0 > > |
---|
47 | { |
---|
48 | typedef InnermostDefault< |
---|
49 | Default0, typename Context::template orthogonal< 0 > > base_type; |
---|
50 | typedef typename base_type::my_context my_context; |
---|
51 | |
---|
52 | Default0( my_context ctx ) : base_type( ctx ) {} |
---|
53 | }; |
---|
54 | |
---|
55 | ////////////////////////////////////////////////////////////////////////////// |
---|
56 | template< class Context > |
---|
57 | struct Default1 : InnermostDefault< |
---|
58 | Default1< Context >, typename Context::template orthogonal< 1 > > |
---|
59 | { |
---|
60 | typedef InnermostDefault< |
---|
61 | Default1, typename Context::template orthogonal< 1 > > base_type; |
---|
62 | typedef typename base_type::my_context my_context; |
---|
63 | |
---|
64 | Default1( my_context ctx ) : base_type( ctx ) {} |
---|
65 | }; |
---|
66 | |
---|
67 | ////////////////////////////////////////////////////////////////////////////// |
---|
68 | template< class Context > |
---|
69 | struct Default2 : InnermostDefault< |
---|
70 | Default2< Context >, typename Context::template orthogonal< 2 > > |
---|
71 | { |
---|
72 | typedef InnermostDefault< |
---|
73 | Default2, typename Context::template orthogonal< 2 > > base_type; |
---|
74 | typedef typename base_type::my_context my_context; |
---|
75 | |
---|
76 | Default2( my_context ctx ) : base_type( ctx ) {} |
---|
77 | }; |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | #endif |
---|