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