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 { after_guardboost::msm::active_state_switch_after_entry21 static int after_guard(int current_state,int){return current_state;} after_exitboost::msm::active_state_switch_after_entry22 static int after_exit(int current_state,int){return current_state;} after_actionboost::msm::active_state_switch_after_entry23 static int after_action(int current_state,int){return current_state;} after_entryboost::msm::active_state_switch_after_entry24 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 { after_guardboost::msm::active_state_switch_before_transition30 static int after_guard(int,int next_state){return next_state;} after_exitboost::msm::active_state_switch_before_transition31 static int after_exit(int,int next_state){return next_state;} after_actionboost::msm::active_state_switch_before_transition32 static int after_action(int,int next_state){return next_state;} after_entryboost::msm::active_state_switch_before_transition33 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 { after_guardboost::msm::active_state_switch_after_exit39 static int after_guard(int current_state,int){return current_state;} after_exitboost::msm::active_state_switch_after_exit40 static int after_exit(int,int next_state){return next_state;} after_actionboost::msm::active_state_switch_after_exit41 static int after_action(int,int next_state){return next_state;} after_entryboost::msm::active_state_switch_after_exit42 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 { after_guardboost::msm::active_state_switch_after_transition_action48 static int after_guard(int current_state,int){return current_state;} after_exitboost::msm::active_state_switch_after_transition_action49 static int after_exit(int current_state,int){return current_state;} after_actionboost::msm::active_state_switch_after_transition_action50 static int after_action(int,int next_state){return next_state;} after_entryboost::msm::active_state_switch_after_transition_action51 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