Chris@16
|
1 // Copyright 2008 Christophe Henry
|
Chris@16
|
2 // henry UNDERSCORE christophe AT hotmail DOT com
|
Chris@16
|
3 // This is an extended version of the state machine available in the boost::mpl library
|
Chris@16
|
4 // Distributed under the same license as the original.
|
Chris@16
|
5 // Copyright for the original version:
|
Chris@16
|
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
|
Chris@16
|
7 // under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
8 // file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_MSM_ACTIVE_STATE_SWITCHING_POLICIES_H
|
Chris@16
|
12 #define BOOST_MSM_ACTIVE_STATE_SWITCHING_POLICIES_H
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost { namespace msm
|
Chris@16
|
15 {
|
Chris@16
|
16 // policy classes
|
Chris@16
|
17
|
Chris@16
|
18 // Default: new active state set after the transition (after entry)
|
Chris@16
|
19 struct active_state_switch_after_entry
|
Chris@16
|
20 {
|
Chris@16
|
21 static int after_guard(int current_state,int){return current_state;}
|
Chris@16
|
22 static int after_exit(int current_state,int){return current_state;}
|
Chris@16
|
23 static int after_action(int current_state,int){return current_state;}
|
Chris@16
|
24 static int after_entry(int,int next_state){return next_state;}
|
Chris@16
|
25 };
|
Chris@16
|
26
|
Chris@16
|
27 // new state set before the transition starts
|
Chris@16
|
28 struct active_state_switch_before_transition
|
Chris@16
|
29 {
|
Chris@16
|
30 static int after_guard(int,int next_state){return next_state;}
|
Chris@16
|
31 static int after_exit(int,int next_state){return next_state;}
|
Chris@16
|
32 static int after_action(int,int next_state){return next_state;}
|
Chris@16
|
33 static int after_entry(int,int next_state){return next_state;}
|
Chris@16
|
34 };
|
Chris@16
|
35
|
Chris@16
|
36 // new state set after exit action completed
|
Chris@16
|
37 struct active_state_switch_after_exit
|
Chris@16
|
38 {
|
Chris@16
|
39 static int after_guard(int current_state,int){return current_state;}
|
Chris@16
|
40 static int after_exit(int,int next_state){return next_state;}
|
Chris@16
|
41 static int after_action(int,int next_state){return next_state;}
|
Chris@16
|
42 static int after_entry(int,int next_state){return next_state;}
|
Chris@16
|
43 };
|
Chris@16
|
44
|
Chris@16
|
45 // new state set after transition action completed
|
Chris@16
|
46 struct active_state_switch_after_transition_action
|
Chris@16
|
47 {
|
Chris@16
|
48 static int after_guard(int current_state,int){return current_state;}
|
Chris@16
|
49 static int after_exit(int current_state,int){return current_state;}
|
Chris@16
|
50 static int after_action(int,int next_state){return next_state;}
|
Chris@16
|
51 static int after_entry(int,int next_state){return next_state;}
|
Chris@16
|
52 };
|
Chris@16
|
53
|
Chris@16
|
54 } }//boost::msm
|
Chris@16
|
55 #endif //BOOST_MSM_ACTIVE_STATE_SWITCHING_POLICIES_H
|