Chris@16: // Copyright 2008 Christophe Henry Chris@16: // henry UNDERSCORE christophe AT hotmail DOT com Chris@16: // This is an extended version of the state machine available in the boost::mpl library Chris@16: // Distributed under the same license as the original. Chris@16: // Copyright for the original version: Chris@16: // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed Chris@16: // under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_MSM_FRONT_EUML_COMMON_H Chris@16: #define BOOST_MSM_FRONT_EUML_COMMON_H Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if BOOST_VERSION >= 104000 Chris@16: #include Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace proto = boost::proto; Chris@16: Chris@16: BOOST_MPL_HAS_XXX_TRAIT_DEF(tag_type) Chris@16: BOOST_MPL_HAS_XXX_TRAIT_DEF(action_name) Chris@16: BOOST_MPL_HAS_XXX_TRAIT_DEF(not_intern_euml_state) Chris@16: Chris@16: namespace boost { namespace msm { namespace front { namespace euml Chris@16: { Chris@16: template Chris@16: struct get_iterator Chris@16: { Chris@16: typedef typename T::iterator type; Chris@16: }; Chris@16: template Chris@16: struct get_reverse_iterator Chris@16: { Chris@16: typedef typename T::reverse_iterator type; Chris@16: }; Chris@16: template Chris@16: struct get_reference Chris@16: { Chris@16: typedef typename T::reference type; Chris@16: }; Chris@16: template Chris@16: struct get_size_type Chris@16: { Chris@16: typedef typename T::size_type type; Chris@16: }; Chris@16: template Chris@16: struct get_value_type Chris@16: { Chris@16: typedef typename T::value_type type; Chris@16: }; Chris@16: template Chris@16: struct get_first_type Chris@16: { Chris@16: typedef typename T::first_type type; Chris@16: }; Chris@16: template Chris@16: struct get_second_type Chris@16: { Chris@16: typedef typename T::second_type type; Chris@16: }; Chris@16: template Chris@16: struct get_action_tag_type Chris@16: { Chris@16: typedef typename ::boost::mpl::has_key< Chris@16: typename T::tag_type,action_tag>::type type; Chris@16: }; Chris@16: template Chris@16: struct get_state_action_tag_type Chris@16: { Chris@16: typedef typename ::boost::mpl::has_key< Chris@16: typename T::tag_type,state_action_tag>::type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_result_type Chris@16: { Chris@16: typedef typename T::template transition_action_result::type type; Chris@16: }; Chris@16: template Chris@16: struct get_result_type2 Chris@16: { Chris@16: typedef typename T::template state_action_result::type type; Chris@16: }; Chris@16: template Chris@16: struct get_sequence Chris@16: { Chris@16: typedef typename SEQ::sequence type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_attributes_type Chris@16: { Chris@16: typedef typename T::attributes_type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_euml_tag_type Chris@16: { Chris@16: typedef typename T::euml_tag_type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_fct Chris@16: { Chris@16: typedef typename T::template In::type type; Chris@16: }; Chris@16: Chris@16: // used to differentiate between different types of euml_state's Chris@16: template Chris@16: struct get_state_name Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_state_name >::type> Chris@16: { Chris@16: typedef typename T::In::type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct get_action_name Chris@16: { Chris@16: typedef typename T::action_name type; Chris@16: }; Chris@16: template Chris@16: struct get_event_name Chris@16: { Chris@16: typedef typename T::event_name type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct euml_event: proto::extends::type, EVT, boost::msm::sm_domain> Chris@16: { Chris@16: typedef event_tag euml_tag_type; Chris@16: typedef EVT event_name; Chris@16: using proto::extends::type, EVT, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef EVT type; Chris@16: }; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct euml_state_intern: proto::extends::type, STATE, boost::msm::state_domain> Chris@16: { Chris@16: typedef state_tag euml_tag_type; Chris@16: using proto::extends::type, STATE, boost::msm::state_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef STATE type; Chris@16: }; Chris@16: }; Chris@16: template Chris@16: struct euml_state: proto::extends::type, STATE, boost::msm::state_domain> Chris@16: { Chris@16: typedef state_tag euml_tag_type; Chris@16: typedef int not_intern_euml_state; Chris@16: using proto::extends::type, STATE, boost::msm::state_domain>::operator=; Chris@16: struct In Chris@16: { Chris@16: typedef STATE type; Chris@16: }; Chris@16: }; Chris@16: template Chris@16: struct euml_action: proto::extends::type, ACTION, boost::msm::sm_domain> Chris@16: { Chris@16: typedef action_tag euml_tag_type; Chris@16: typedef ACTION action_name; Chris@16: using proto::extends::type, ACTION, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef ACTION type; Chris@16: }; Chris@16: }; Chris@16: template Chris@16: struct euml_flag: proto::extends::type, FLAG, boost::msm::sm_domain> Chris@16: { Chris@16: typedef flag_tag euml_tag_type; Chris@16: using proto::extends::type, FLAG, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef FLAG type; Chris@16: }; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct euml_config: proto::extends::type, CONFIG, boost::msm::sm_domain> Chris@16: { Chris@16: typedef config_tag euml_tag_type; Chris@16: using proto::extends::type, CONFIG, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef CONFIG type; Chris@16: }; Chris@16: }; Chris@16: Chris@16: struct No_Exception : euml_config Chris@16: { Chris@16: typedef int no_exception_thrown; Chris@16: No_Exception(){} Chris@16: }; Chris@16: struct No_Msg_Queue : euml_config Chris@16: { Chris@16: typedef int no_message_queue; Chris@16: No_Msg_Queue(){} Chris@16: }; Chris@16: struct Deferred_Events : euml_config Chris@16: { Chris@16: typedef int activate_deferred_events; Chris@16: Deferred_Events(){} Chris@16: }; Chris@16: No_Exception const no_exception=No_Exception(); Chris@16: No_Msg_Queue const no_msg_queue=No_Msg_Queue(); Chris@16: Deferred_Events const deferred_events=Deferred_Events(); Chris@16: Chris@16: struct ActiveStateSwitchBeforeTransition : euml_config Chris@16: { Chris@16: typedef boost::msm::active_state_switch_before_transition active_state_switch_policy; Chris@16: ActiveStateSwitchBeforeTransition(){} Chris@16: }; Chris@16: ActiveStateSwitchBeforeTransition const switch_active_before_transition = ActiveStateSwitchBeforeTransition(); Chris@16: Chris@16: struct ActiveStateSwitchAfterExit : euml_config Chris@16: { Chris@16: typedef boost::msm::active_state_switch_after_exit active_state_switch_policy; Chris@16: ActiveStateSwitchAfterExit(){} Chris@16: }; Chris@16: ActiveStateSwitchAfterExit const switch_active_after_exit = ActiveStateSwitchAfterExit(); Chris@16: Chris@16: struct ActiveStateSwitchAfterAction : euml_config Chris@16: { Chris@16: typedef boost::msm::active_state_switch_after_transition_action active_state_switch_policy; Chris@16: ActiveStateSwitchAfterAction(){} Chris@16: }; Chris@16: ActiveStateSwitchAfterAction const switch_active_after_action = ActiveStateSwitchAfterAction(); Chris@16: Chris@16: Chris@16: struct invalid_type{}; Chris@16: struct make_invalid_type Chris@16: { Chris@16: typedef invalid_type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct make_vector_one_row Chris@16: { Chris@16: typedef boost::mpl::vector type; Chris@16: }; Chris@16: template Chris@16: T make_T(T t) {return t;} Chris@16: Chris@16: struct make_vector_no_row Chris@16: { Chris@16: typedef boost::mpl::vector0<> type; Chris@16: }; Chris@16: Chris@16: struct NoAction : euml_action Chris@16: { Chris@16: NoAction(){} Chris@16: // return value if used inside a state action (entry/exit) Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: // return value if used inside a transition (action/guard) Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: // this functor can be used in both modes, state action and transition action Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: bool operator()(Event const&,FSM&,STATE& ) Chris@16: { Chris@16: // does nothing Chris@16: return true; Chris@16: } Chris@16: template Chris@16: bool operator()(EVT const& ,FSM& ,SourceState& ,TargetState&)const Chris@16: { Chris@16: // does nothing Chris@16: return true; Chris@16: } Chris@16: }; Chris@16: NoAction const no_action = NoAction(); Chris@16: Chris@16: struct fsm_artefact_tag {}; Chris@16: template Chris@16: struct GetSource_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& ,FSM& ,SourceState& src,TargetState&)const Chris@16: { Chris@16: return src.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template<> Chris@16: struct GetSource_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef SourceState& type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& , FSM&,SourceState& src,TargetState& )const Chris@16: { Chris@16: return src; Chris@16: } Chris@16: }; Chris@16: struct GetSource_Helper: proto::extends< proto::terminal::type, GetSource_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetSource_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetSource_ type; Chris@16: }; Chris@16: }; Chris@16: GetSource_Helper const source_ = GetSource_Helper(); Chris@16: Chris@16: template Chris@16: struct GetTarget_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const Chris@16: { Chris@16: return tgt.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template<> Chris@16: struct GetTarget_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef TargetState& type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& , FSM&,SourceState& ,TargetState& tgt)const Chris@16: { Chris@16: return tgt; Chris@16: } Chris@16: }; Chris@16: struct GetTarget_Helper: proto::extends< proto::terminal::type, GetTarget_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetTarget_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetTarget_ type; Chris@16: }; Chris@16: }; Chris@16: GetTarget_Helper const target_ = GetTarget_Helper(); Chris@16: Chris@16: template Chris@16: struct GetState_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& ,STATE& state ) Chris@16: { Chris@16: return state.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template<> Chris@16: struct GetState_ : euml_action > Chris@16: { Chris@16: using euml_action::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef STATE& type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& ,STATE& state ) Chris@16: { Chris@16: return state; Chris@16: } Chris@16: }; Chris@16: struct GetState_Helper: proto::extends< proto::terminal::type, GetState_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetState_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetState_ type; Chris@16: }; Chris@16: }; Chris@16: GetState_Helper const state_ = GetState_Helper(); Chris@16: Chris@16: template Chris@16: struct GetEvent_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename ::boost::add_const< Chris@16: typename ::boost::fusion::result_of::at_key::type>::type type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename ::boost::add_const< Chris@16: typename ::boost::fusion::result_of::at_key::type>::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const& evt,FSM& ,STATE& ) Chris@16: { Chris@16: return evt.get_attribute(Index()); Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const Chris@16: { Chris@16: return evt.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template <> Chris@16: struct GetEvent_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef Event const& type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef EVT const& type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const& evt,FSM& ,STATE& ) Chris@16: { Chris@16: return evt; Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const Chris@16: { Chris@16: return evt; Chris@16: } Chris@16: }; Chris@16: struct GetEvent_Helper: proto::extends< proto::terminal::type, GetEvent_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetEvent_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetEvent_ type; Chris@16: }; Chris@16: }; Chris@16: GetEvent_Helper const event_ = GetEvent_Helper(); Chris@16: Chris@16: template Chris@16: struct GetFsm_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& fsm,STATE& ) Chris@16: { Chris@16: return fsm.get_attribute(Index()); Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const Chris@16: { Chris@16: return fsm.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template<> Chris@16: struct GetFsm_ : euml_action > Chris@16: { Chris@16: using euml_action::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef FSM& type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef FSM& type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& fsm,STATE& ) Chris@16: { Chris@16: return fsm; Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const Chris@16: { Chris@16: return fsm; Chris@16: } Chris@16: }; Chris@16: struct GetFsm_Helper: proto::extends< proto::terminal::type, GetFsm_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetFsm_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetFsm_ type; Chris@16: }; Chris@16: }; Chris@16: GetFsm_Helper const fsm_ = GetFsm_Helper(); Chris@16: Chris@16: template Chris@16: struct SubState_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef StateName& type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef StateName& type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: StateName& operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: return (Param1()(evt,fsm,src,tgt)).template get_state(); Chris@16: } Chris@16: template Chris@16: StateName& operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: return (Param1()(evt,fsm,state)).template get_state(); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct SubState_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef StateName& type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef StateName& type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: StateName& operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const Chris@16: { Chris@16: return fsm.template get_state(); Chris@16: } Chris@16: template Chris@16: StateName& operator()(Event const& ,FSM& fsm,STATE& )const Chris@16: { Chris@16: return fsm.template get_state(); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct SubState_Helper: proto::extends< proto::terminal::type, SubState_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: SubState_Helper(){} Chris@16: using proto::extends< proto::terminal::type, SubState_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef SubState_ type; Chris@16: }; Chris@16: }; Chris@16: SubState_Helper const substate_ = SubState_Helper(); Chris@16: Chris@16: template Chris@16: struct GetAttribute_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key< Chris@16: typename get_attributes_type< Chris@16: typename ::boost::remove_reference< Chris@16: typename get_result_type2::type>::type>::type, Chris@16: Index >::type type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key< Chris@16: typename get_attributes_type< Chris@16: typename ::boost::remove_reference< Chris@16: typename get_result_type::type>::type>::type, Chris@16: Index >::type type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename ::boost::enable_if< Chris@16: typename ::boost::mpl::has_key< Chris@16: typename Target::tag_type,action_tag>::type, Chris@16: typename transition_action_result::type >::type Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: return (Target()(evt,fsm,src,tgt)).get_attribute(Index()); Chris@16: } Chris@16: template Chris@16: typename ::boost::enable_if< Chris@16: typename ::boost::mpl::has_key< Chris@16: typename Target::tag_type,state_action_tag>::type, Chris@16: typename state_action_result::type >::type Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const Chris@16: { Chris@16: return (Target()(evt,fsm,state)).get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct GetAttribute_Helper: proto::extends< proto::terminal::type, GetAttribute_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: GetAttribute_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef GetAttribute_ type; Chris@16: }; Chris@16: }; Chris@16: GetAttribute_Helper const attribute_ = GetAttribute_Helper(); Chris@16: Chris@16: template Chris@16: struct Source_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& , FSM&,SourceState& src,TargetState& )const Chris@16: { Chris@16: return src.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct Target_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const Chris@16: { Chris@16: return tgt.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct State_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& ,STATE& state ) Chris@16: { Chris@16: return state.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct Event_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename ::boost::add_const< Chris@16: typename ::boost::fusion::result_of::at_key::type>::type type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename ::boost::add_const< Chris@16: typename ::boost::fusion::result_of::at_key::type>::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const& evt,FSM& ,STATE& ) Chris@16: { Chris@16: return evt.get_attribute(Index()); Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@16: operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const Chris@16: { Chris@16: return evt.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct State_Attribute_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& fsm,STATE& ) Chris@16: { Chris@16: return fsm.template get_state().get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Fsm_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef typename Chris@16: ::boost::fusion::result_of::at_key::type type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: typename state_action_result::type Chris@16: operator()(Event const&,FSM& fsm,STATE& ) Chris@16: { Chris@16: return fsm.get_attribute(Index()); Chris@16: } Chris@16: template Chris@16: typename transition_action_result::type Chris@101: operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const Chris@16: { Chris@16: return fsm.get_attribute(Index()); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct True_ : euml::euml_action Chris@16: { Chris@16: using euml_action::operator=; Chris@16: True_(){} Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: bool operator()(EVT const&,FSM&,SourceState& ,TargetState& ) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: template Chris@16: bool operator()(Event const&,FSM&,STATE& ) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: }; Chris@16: True_ const true_ = True_(); Chris@16: Chris@16: struct False_ : euml::euml_action Chris@16: { Chris@16: using euml_action::operator=; Chris@16: False_(){} Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: bool operator()(EVT const&,FSM&,SourceState& ,TargetState& ) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: template Chris@16: bool operator()(Event const&,FSM&,STATE& ) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: }; Chris@16: False_ const false_ = False_(); Chris@16: Chris@16: template Chris@16: struct Int_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: typedef ::boost::mpl::int_ value_type; Chris@16: enum {value = Val}; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef int type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef int type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: int operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: template Chris@16: int operator()(Event const& ,FSM& ,STATE& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Char_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef char type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef char type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: char operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: template Chris@16: char operator()(Event const& ,FSM& ,STATE& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Size_t_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef size_t type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef size_t type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: size_t operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: template Chris@16: size_t operator()(Event const& ,FSM& ,STATE& ) Chris@16: { Chris@16: return Val; Chris@16: } Chris@16: }; Chris@16: Chris@16: #if BOOST_VERSION >= 104000 Chris@16: Chris@16: template Chris@16: struct String_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef char const* type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef char const* type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: char const* operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) Chris@16: { Chris@16: return ::boost::mpl::c_str::value; Chris@16: } Chris@16: template Chris@16: char const* operator()(Event const& ,FSM& ,STATE& ) Chris@16: { Chris@16: return ::boost::mpl::c_str::value; Chris@16: } Chris@16: }; Chris@16: #endif Chris@16: Chris@16: Chris@16: template Chris@16: struct Predicate_ : euml_action > Chris@16: { Chris@16: using euml_action >::operator=; Chris@16: Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: T operator()(EVT const& , FSM& ,SourceState& ,TargetState& ) Chris@16: { Chris@16: return T(); Chris@16: } Chris@16: template Chris@16: T operator()(Event const& ,FSM& ,STATE& ) Chris@16: { Chris@16: return T(); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param4()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param3()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param4()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: } Chris@16: }; Chris@16: template Chris@16: struct Process_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const Chris@16: { Chris@16: fsm.process_event(ToProcessEvt()); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& ,FSM& fsm,STATE& )const Chris@16: { Chris@16: fsm.process_event(ToProcessEvt()); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt()); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param2()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: (Param3()(evt,fsm,state)).process_event(ToProcessEvt()); Chris@16: } Chris@16: }; Chris@16: Chris@16: //version for process_(event_) Chris@16: template <> Chris@16: struct Process_ ,void,void,void,void> Chris@16: : euml_action, void, void, void, void > > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& )const Chris@16: { Chris@16: fsm.process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& )const Chris@16: { Chris@16: fsm.process_event(evt); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct process_tag {}; Chris@16: struct Process_Helper: proto::extends< proto::terminal::type, Process_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Process_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Process_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef Process_ type; Chris@16: }; Chris@16: }; Chris@16: Process_Helper const process_ = Process_Helper(); Chris@16: Chris@16: template Chris@16: struct Reprocess_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param3()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param4()(evt,fsm,src,tgt)).process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(evt); Chris@16: (Param2()(evt,fsm,state)).process_event(evt); Chris@16: (Param3()(evt,fsm,state)).process_event(evt); Chris@16: (Param4()(evt,fsm,state)).process_event(evt); Chris@16: } Chris@16: }; Chris@16: template <> Chris@16: struct Reprocess_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& )const Chris@16: { Chris@16: fsm.process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& )const Chris@16: { Chris@16: fsm.process_event(evt); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Reprocess_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(evt); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Reprocess_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(evt); Chris@16: (Param2()(evt,fsm,state)).process_event(evt); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Reprocess_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(evt); Chris@16: (Param3()(evt,fsm,src,tgt)).process_event(evt); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(evt); Chris@16: (Param2()(evt,fsm,state)).process_event(evt); Chris@16: (Param3()(evt,fsm,state)).process_event(evt); Chris@16: } Chris@16: }; Chris@16: struct reprocess_tag {}; Chris@16: struct Reprocess_Helper: proto::extends< proto::terminal::type, Reprocess_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Reprocess_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Reprocess_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef Reprocess_ type; Chris@16: }; Chris@16: }; Chris@16: Reprocess_Helper const reprocess_ = Reprocess_Helper(); Chris@16: Chris@16: template Chris@16: struct Process2_ : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: (Param3()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process2_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: fsm.process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: fsm.process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process2_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Process2_ Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef void type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt))); Chris@16: } Chris@16: template Chris@16: void operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state))); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct process2_tag {}; Chris@16: struct Process2_Helper : proto::extends< proto::terminal::type, Process2_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Process2_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Process2_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef Process2_ type; Chris@16: }; Chris@16: }; Chris@16: Process2_Helper const process2_ = Process2_Helper(); Chris@16: Chris@16: template Chris@16: struct Get_Flag_ : euml_action > {}; Chris@16: Chris@16: template Chris@16: struct Get_Flag_ ::type >::type> Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: bool operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const Chris@16: { Chris@16: return fsm.template is_flag_active(); Chris@16: } Chris@16: template Chris@16: bool operator()(Event const& ,FSM& fsm,STATE& )const Chris@16: { Chris@16: return fsm.template is_flag_active(); Chris@16: } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct Get_Flag_ ::type Chris@16: >::type> Chris@16: : euml_action > Chris@16: { Chris@16: template Chris@16: struct state_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: template Chris@16: struct transition_action_result Chris@16: { Chris@16: typedef bool type; Chris@16: }; Chris@16: Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: Chris@16: template Chris@16: bool operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const Chris@16: { Chris@16: return (Param1()(evt,fsm,src,tgt)).template is_flag_active(); Chris@16: } Chris@16: template Chris@16: bool operator()(Event const& evt,FSM& fsm,STATE& state)const Chris@16: { Chris@16: return (Param1()(evt,fsm,state)).template is_flag_active(); Chris@16: } Chris@16: }; Chris@16: Chris@16: struct Get_Flag_Helper: proto::extends< proto::terminal::type, Get_Flag_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Get_Flag_Helper(){} Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef Get_Flag_ type; Chris@16: }; Chris@16: }; Chris@16: Get_Flag_Helper const is_flag_ = Get_Flag_Helper(); Chris@16: Chris@16: // deferring an event Chris@16: struct DeferEvent_ : euml_action< DeferEvent_ > Chris@16: { Chris@16: typedef ::boost::mpl::set tag_type; Chris@16: // mark as deferring to avoid stack overflows in certain conditions Chris@16: typedef int deferring_action; Chris@16: template Chris@16: void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& ) const Chris@16: { Chris@16: fsm.defer_event(evt); Chris@16: } Chris@16: }; Chris@16: struct Defer_Helper : proto::extends< proto::terminal::type, Defer_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Defer_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Defer_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef DeferEvent_ type; Chris@16: }; Chris@16: }; Chris@16: Defer_Helper const defer_ = Defer_Helper(); Chris@16: Chris@16: struct explicit_tag {}; Chris@16: struct Explicit_Helper : proto::extends< proto::terminal::type, Explicit_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Explicit_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Explicit_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef typename Arg1::template direct type; Chris@16: }; Chris@16: }; Chris@16: Explicit_Helper const explicit_ = Explicit_Helper(); Chris@16: Chris@16: struct entry_pt_tag {}; Chris@16: struct Entry_Pt_Helper : proto::extends< proto::terminal::type, Entry_Pt_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Entry_Pt_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Entry_Pt_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef typename Arg1::template entry_pt type; Chris@16: }; Chris@16: }; Chris@16: Entry_Pt_Helper const entry_pt_ = Entry_Pt_Helper(); Chris@16: Chris@16: struct exit_pt_tag {}; Chris@16: struct Exit_Pt_Helper : proto::extends< proto::terminal::type, Exit_Pt_Helper, boost::msm::sm_domain> Chris@16: { Chris@16: Exit_Pt_Helper(){} Chris@16: using proto::extends< proto::terminal::type, Exit_Pt_Helper, boost::msm::sm_domain>::operator=; Chris@16: template Chris@16: struct In Chris@16: { Chris@16: typedef typename Arg1::template exit_pt type; Chris@16: }; Chris@16: }; Chris@16: Exit_Pt_Helper const exit_pt_ = Exit_Pt_Helper(); Chris@16: Chris@16: #ifdef BOOST_MSVC Chris@16: #define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \ Chris@16: template \ Chris@16: struct functor : euml_action > {}; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename transition_action_result::type \ Chris@16: operator()(EVT const& , FSM& ,SourceState& ,TargetState& )const { \ Chris@16: return function ();} \ Chris@16: template \ Chris@16: typename state_action_result::type \ Chris@16: operator()(Event const& ,FSM& ,STATE& )const { \ Chris@16: return function ();} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \ Chris@16: struct function_name ## tag{}; \ Chris@16: struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ Chris@16: functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ Chris@16: template \ Chris@16: struct In {typedef functor type;}; }; \ Chris@16: functor ## Helper const function_name = functor ## Helper (); Chris@16: Chris@16: #define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \ Chris@16: template \ Chris@16: struct functor : euml_action > {}; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function();} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function();} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \ Chris@16: struct function_name ## tag{}; \ Chris@16: struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ Chris@16: functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ Chris@16: template \ Chris@16: struct In {typedef functor type;}; }; \ Chris@16: functor ## Helper const function_name = functor ## Helper (); Chris@16: Chris@16: #else Chris@16: Chris@16: #define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \ Chris@16: template \ Chris@16: struct functor : euml_action > {}; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ Chris@16: struct function_name ## tag{}; \ Chris@16: struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ Chris@16: functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ Chris@16: template \ Chris@16: struct In {typedef functor type;}; }; \ Chris@16: functor ## Helper const function_name = functor ## Helper (); Chris@16: Chris@16: #define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \ Chris@16: template \ Chris@16: struct functor : euml_action > {}; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function();} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function();} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type,typename ::boost::mpl::not_< \ Chris@16: typename ::boost::is_same::type>::type>::type >::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state));} }; \ Chris@16: template \ Chris@16: struct functor::type>::type> \ Chris@16: : euml_action > { \ Chris@16: template struct state_action_result { \ Chris@16: typedef result_state type;} ; \ Chris@16: template \ Chris@16: struct transition_action_result { typedef result_trans type;}; \ Chris@16: typedef ::boost::mpl::set tag_type; \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename transition_action_result::type >::type \ Chris@16: operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \ Chris@16: return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \ Chris@16: ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \ Chris@16: template \ Chris@16: typename ::boost::enable_if::type, \ Chris@16: typename state_action_result::type >::type \ Chris@16: operator()(Event const& evt,FSM& fsm,STATE& state )const { \ Chris@16: return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \ Chris@16: ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \ Chris@16: struct function_name ## tag{}; \ Chris@16: struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \ Chris@16: functor ## Helper , boost::msm::sm_domain> { functor ## Helper(){} \ Chris@16: template \ Chris@16: struct In {typedef functor type;}; }; \ Chris@16: functor ## Helper const function_name = functor ## Helper (); Chris@16: Chris@16: #endif Chris@16: Chris@16: #define RESULT_TYPE2_PARAM1 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM1 typename get_result_type::type Chris@16: #define RESULT_TYPE2_PARAM2 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM2 typename get_result_type::type Chris@16: #define RESULT_TYPE2_PARAM3 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM3 typename get_result_type::type Chris@16: #define RESULT_TYPE2_PARAM4 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM4 typename get_result_type::type Chris@16: #define RESULT_TYPE2_PARAM5 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM5 typename get_result_type::type Chris@16: #define RESULT_TYPE2_PARAM6 typename get_result_type2::type Chris@16: #define RESULT_TYPE_PARAM6 typename get_result_type::type Chris@16: Chris@16: Chris@16: #define RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits::type>::difference_type Chris@16: #define RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits::type>::difference_type Chris@16: Chris@16: #define RESULT_TYPE2_REMOVE_REF_PARAM1 typename ::boost::remove_reference::type>::type Chris@16: #define RESULT_TYPE_REMOVE_REF_PARAM1 typename ::boost::remove_reference::type>::type Chris@16: Chris@16: #define RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 std::pair Chris@16: #define RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 std::pair Chris@16: Chris@16: #define RESULT_TYPE2_GET_REF_REMOVE_REF_PARAM1 typename get_reference::type>::type>::type Chris@16: #define RESULT_TYPE_GET_REF_REMOVE_REF_PARAM1 typename get_reference::type>::type>::type Chris@16: Chris@16: #define RESULT_TYPE2_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator::type>::type>::type Chris@16: #define RESULT_TYPE_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator::type>::type>::type Chris@16: Chris@16: #define RESULT_TYPE2_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator::type>::type>::type Chris@16: #define RESULT_TYPE_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator::type>::type>::type Chris@16: Chris@16: #define RESULT_TYPE2_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type::type>::type>::type Chris@16: #define RESULT_TYPE_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type::type>::type>::type Chris@16: Chris@16: #define BOOST_MSM_EUML_ACTION(instance_name) \ Chris@16: struct instance_name ## _impl; \ Chris@101: struct instance_name ## _helper : boost::msm::front::euml::euml_action \ Chris@16: { \ Chris@16: instance_name ## _helper(){} \ Chris@16: typedef instance_name ## _impl action_name; \ Chris@16: }; \ Chris@16: static instance_name ## _helper instance_name; \ Chris@16: struct instance_name ## _impl : instance_name ## _helper Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_ACTION(instance_name) \ Chris@16: struct instance_name ; \ Chris@101: struct instance_name ## _helper : boost::msm::front::euml::euml_action \ Chris@16: { \ Chris@16: instance_name ## _helper(){} \ Chris@16: typedef instance_name action_name; \ Chris@16: }; \ Chris@16: struct instance_name : instance_name ## _helper Chris@16: Chris@16: Chris@16: #define BOOST_MSM_EUML_EVENT(instance_name) \ Chris@101: struct instance_name ## _helper : boost::msm::front::euml::euml_event{ \ Chris@16: instance_name ## _helper(){} \ Chris@16: instance_name ## _helper const& operator()() const {return *this;} }; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: // an event matching any event Chris@101: struct kleene_ : boost::msm::front::euml::euml_event, public boost::any Chris@16: { Chris@16: kleene_() : boost::any(){} Chris@16: template Chris@16: kleene_(const ValueType & v) : boost::any(v){} Chris@16: }; Chris@16: static kleene_ kleene; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_EVENT(instance_name) \ Chris@101: struct instance_name : boost::msm::front::euml::euml_event{ \ Chris@16: instance_name(){} \ Chris@16: instance_name const& operator()() const {return *this;} }; Chris@16: Chris@16: #define MSM_EUML_CONCAT(param1,param2) param1 Chris@16: #define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1(z, n, unused) ARG ## n arg ## n Chris@16: #define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2(z, n, unused) arg ## n Chris@16: #define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP_ENTRY(z, n, unused) \ Chris@16: typename boost::fusion::result_of::first< \ Chris@16: typename ::boost::remove_reference< \ Chris@16: typename boost::fusion::result_of::at_c::type>::type>::type \ Chris@16: Chris@16: #define MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE(z, n, unused) \ Chris@16: get_attribute( \ Chris@16: typename boost::fusion::result_of::first< \ Chris@16: typename ::boost::remove_reference< \ Chris@16: typename boost::fusion::result_of::at_c::type>::type>::type())=arg ## n; Chris@16: Chris@16: #define MSM_EUML_EVENT_HELPER_CONSTRUCTORS(z, n, mytuple) \ Chris@16: template \ Chris@16: BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, mytuple) , _helper)(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ )): \ Chris@16: BOOST_PP_TUPLE_ELEM(2, 1, mytuple)(){ \ Chris@16: init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ),attribute_vec());} Chris@16: Chris@16: #define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP(z, n, unused) \ Chris@16: template \ Chris@16: void init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ), \ Chris@16: T,typename ::boost::enable_if< typename boost::mpl::eval_if< typename ::boost::fusion::traits::is_sequence::type,size_helper,::boost::mpl::false_>::type,void >::type* =0) \ Chris@16: { \ Chris@16: BOOST_PP_REPEAT_FROM_TO(0,n , \ Chris@16: MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE, ~) \ Chris@16: } Chris@16: Chris@16: #define MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL(z, n, instance) \ Chris@16: template \ Chris@16: BOOST_PP_CAT(instance,_helper) operator() \ Chris@16: (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ))const{ \ Chris@16: return BOOST_PP_CAT(instance,_helper) (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ));} Chris@101: Chris@101: #if defined(FUSION_MAX_MAP_SIZE) Chris@16: Chris@101: #define BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(instance_name, attributes_name) \ Chris@16: struct instance_name ## _helper : \ Chris@101: boost::msm::front::euml::euml_event , public attributes_name \ Chris@16: { \ Chris@16: template struct size_helper \ Chris@16: { \ Chris@16: typedef typename ::boost::mpl::less_equal< \ Chris@16: typename ::boost::fusion::result_of::size::type, \ Chris@16: ::boost::mpl::int_ >::type type; \ Chris@16: }; \ Chris@16: BOOST_PP_CAT(instance_name,_helper()) : attributes_name(){} \ Chris@16: typedef attributes_name::attributes_type attribute_map; \ Chris@16: typedef ::boost::fusion::result_of::as_vector::type attribute_vec; \ Chris@16: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ Chris@16: MSM_EUML_EVENT_HELPER_CONSTRUCTORS, (instance_name,attributes_name)) \ Chris@16: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ Chris@16: MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP, ~) \ Chris@16: BOOST_PP_CAT(instance_name,_helper) operator()(){ \ Chris@16: return BOOST_PP_CAT(instance_name,_helper)();} \ Chris@16: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \ Chris@16: MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL, instance_name) \ Chris@16: }; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@101: #else Chris@101: Chris@101: #define BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(instance_name, attributes_name) \ Chris@101: struct instance_name ## _helper : \ Chris@101: boost::msm::front::euml::euml_event , public attributes_name \ Chris@101: { \ Chris@101: template struct size_helper \ Chris@101: { \ Chris@101: typedef typename ::boost::mpl::less_equal< \ Chris@101: typename ::boost::fusion::result_of::size::type, \ Chris@101: ::boost::mpl::int_ >::type type; \ Chris@101: }; \ Chris@101: BOOST_PP_CAT(instance_name,_helper()) : attributes_name(){} \ Chris@101: typedef attributes_name::attributes_type attribute_map; \ Chris@101: typedef ::boost::fusion::result_of::as_vector::type attribute_vec; \ Chris@101: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ Chris@101: MSM_EUML_EVENT_HELPER_CONSTRUCTORS, (instance_name,attributes_name)) \ Chris@101: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ Chris@101: MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP, ~) \ Chris@101: BOOST_PP_CAT(instance_name,_helper) operator()(){ \ Chris@101: return BOOST_PP_CAT(instance_name,_helper)();} \ Chris@101: BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(10 ,1), \ Chris@101: MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL, instance_name) \ Chris@101: }; \ Chris@101: static instance_name ## _helper instance_name; Chris@101: Chris@101: #endif Chris@101: Chris@16: #define BOOST_MSM_EUML_EVENT_NAME(instance_name) instance_name ## _helper Chris@16: Chris@16: #define BOOST_MSM_EUML_FLAG_NAME(instance_name) instance_name ## _helper Chris@16: Chris@16: #define BOOST_MSM_EUML_FLAG(instance_name) \ Chris@101: struct instance_name ## _helper : boost::msm::front::euml::euml_flag{}; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_FLAG(instance_name) \ Chris@101: struct instance_name : boost::msm::front::euml::euml_flag{}; Chris@16: Chris@16: #define BOOST_MSM_EUML_STATE_NAME(instance_name) instance_name ## _helper Chris@16: Chris@16: #define BOOST_MSM_EUML_BUILD_STT_HELPER build_stt( Chris@16: #define BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER build_internal_stt( Chris@16: #define BOOST_MSM_EUML_BUILD_STT_HELPER2(expr) expr) Chris@16: #define BOOST_MSM_EUML_ENTRY_STATE_HELPER(expr) ,expr Chris@16: Chris@16: Chris@16: #define BOOST_MSM_EUML_ATTRIBUTES(expr,instance_name) \ Chris@16: typedef BOOST_TYPEOF(build_attributes expr) instance_name; Chris@16: Chris@16: // following macros declare a state type but do not create an instance Chris@16: #define BOOST_MSM_EUML_DECLARE_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_interrupt_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_terminate_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_explicit_entry_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_ENTRY_STATE(region,expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_entry_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_EXIT_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_exit_state expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_STATE_MACHINE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_sm expr) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(expr,instance_name) \ Chris@16: typedef int using_declared_table; \ Chris@16: typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(expr) \ Chris@16: typedef BOOST_TYPEOF( \ Chris@16: BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) internal_transition_table; Chris@16: Chris@16: // following macros declare a state type and create an instance Chris@16: #define BOOST_MSM_EUML_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_INTERRUPT_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_interrupt_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_TERMINATE_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_terminate_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_explicit_entry_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_ENTRY_STATE(region,expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_entry_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_EXIT_STATE(expr,instance_name) \ Chris@16: struct instance_name ## tag{}; \ Chris@16: typedef BOOST_TYPEOF(build_exit_state expr) instance_name ## _helper; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: Chris@16: #ifndef BOOST_MSVC Chris@16: Chris@16: #define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \ Chris@16: typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \ Chris@16: struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \ Chris@16: typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \ Chris@16: struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #else Chris@16: Chris@16: #define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \ Chris@16: struct instance_name ## _helper : \ Chris@16: public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \ Chris@16: {instance_name ## _helper(){}} ; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \ Chris@16: struct instance_name ## _helper : \ Chris@16: public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \ Chris@16: {instance_name ## _helper(){}} ; \ Chris@16: static instance_name ## _helper instance_name; Chris@16: Chris@16: #endif Chris@16: Chris@16: }}}} // boost::msm::front::euml Chris@16: Chris@16: namespace boost { namespace msm{ Chris@16: template<> Chris@16: struct is_kleene_event< boost::msm::front::euml::kleene_ > Chris@16: { Chris@16: typedef ::boost::mpl::true_ type; Chris@16: }; Chris@16: }} Chris@16: Chris@16: #endif // BOOST_MSM_FRONT_EUML_COMMON_H