// Copyright 2008 Christophe Henry // henry UNDERSCORE christophe AT hotmail DOT com // This is an extended version of the state machine available in the boost::mpl library // Distributed under the same license as the original. // Copyright for the original version: // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed // under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MSM_ROW2_HPP #define BOOST_MSM_ROW2_HPP #include #include #include #include #include #include namespace boost { namespace msm { namespace front { template< typename T1 , class Event , typename T2 > struct _row2 { typedef _row_tag row_type_tag; typedef T1 Source; typedef T2 Target; typedef Event Evt; }; template< typename T1 , class Event , typename T2 , typename CalledForAction , void (CalledForAction::*action)(Event const&) > struct a_row2 { typedef a_row_tag row_type_tag; typedef T1 Source; typedef T2 Target; typedef Event Evt; template static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states ::boost::msm::front::detail::row2_action_helper::template call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); return ::boost::msm::back::HANDLED_TRUE; } }; template< typename T1 , class Event , typename T2 , typename CalledForAction , void (CalledForAction::*action)(Event const&) , typename CalledForGuard , bool (CalledForGuard::*guard)(Event const&) > struct row2 { typedef row_tag row_type_tag; typedef T1 Source; typedef T2 Target; typedef Event Evt; template static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states ::boost::msm::front::detail::row2_action_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); return ::boost::msm::back::HANDLED_TRUE; } template static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states return ::boost::msm::front::detail::row2_guard_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); } }; template< typename T1 , class Event , typename T2 , typename CalledForGuard , bool (CalledForGuard::*guard)(Event const&) > struct g_row2 { typedef g_row_tag row_type_tag; typedef T1 Source; typedef T2 Target; typedef Event Evt; template static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states return ::boost::msm::front::detail::row2_guard_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); } }; // internal transitions template< typename T1 , class Event , typename CalledForAction , void (CalledForAction::*action)(Event const&) > struct a_irow2 { typedef a_irow_tag row_type_tag; typedef T1 Source; typedef T1 Target; typedef Event Evt; template static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states ::boost::msm::front::detail::row2_action_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); return ::boost::msm::back::HANDLED_TRUE; } }; template< typename T1 , class Event , typename CalledForAction , void (CalledForAction::*action)(Event const&) , typename CalledForGuard , bool (CalledForGuard::*guard)(Event const&) > struct irow2 { typedef irow_tag row_type_tag; typedef T1 Source; typedef T1 Target; typedef Event Evt; template static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states ::boost::msm::front::detail::row2_action_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); return ::boost::msm::back::HANDLED_TRUE; } template static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states return ::boost::msm::front::detail::row2_guard_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); } }; template< typename T1 , class Event , typename CalledForGuard , bool (CalledForGuard::*guard)(Event const&) > struct g_irow2 { typedef g_irow_tag row_type_tag; typedef T1 Source; typedef T1 Target; typedef Event Evt; template static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, AllStates& all_states) { // in this front-end, we don't need to know source and target states return ::boost::msm::front::detail::row2_guard_helper::call_helper (fsm,evt,src,tgt,all_states, ::boost::mpl::bool_< ::boost::is_base_of::type::value>()); } }; }}} #endif //BOOST_MSM_ROW2_HPP