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_ROW2_HELPER_HPP Chris@16: #define BOOST_MSM_ROW2_HELPER_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace msm { namespace front Chris@16: { Chris@16: namespace detail Chris@16: { Chris@16: template< Chris@16: typename CalledForAction Chris@16: , typename Event Chris@16: , void (CalledForAction::*action)(Event const&) Chris@16: > Chris@16: struct row2_action_helper Chris@16: { Chris@16: template Chris@16: static void call_helper(FSM&,Evt const& evt,SourceState&,TargetState&, Chris@16: AllStates& all_states,::boost::mpl::false_ const &) Chris@16: { Chris@16: // in this front-end, we don't need to know source and target states Chris@16: ( ::boost::fusion::at_key(all_states).*action)(evt); Chris@16: } Chris@16: template Chris@16: static void call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&,AllStates&, Chris@16: ::boost::mpl::true_ const &) Chris@16: { Chris@16: // in this front-end, we don't need to know source and target states Chris@16: (fsm.*action)(evt); Chris@16: } Chris@16: }; Chris@16: Chris@16: template< Chris@16: typename CalledForGuard Chris@16: , typename Event Chris@16: , bool (CalledForGuard::*guard)(Event const&) Chris@16: > Chris@16: struct row2_guard_helper Chris@16: { Chris@16: template Chris@16: static bool call_helper(FSM&,Evt const& evt,SourceState&,TargetState&, Chris@16: AllStates& all_states, ::boost::mpl::false_ const &) Chris@16: { Chris@16: // in this front-end, we don't need to know source and target states Chris@16: return ( ::boost::fusion::at_key(all_states).*guard)(evt); Chris@16: } Chris@16: template Chris@16: static bool call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&, Chris@16: AllStates&,::boost::mpl::true_ const &) Chris@16: { Chris@16: // in this front-end, we don't need to know source and target states Chris@16: return (fsm.*guard)(evt); Chris@16: } Chris@16: }; Chris@16: } Chris@16: Chris@16: }}} Chris@16: Chris@16: #endif //BOOST_MSM_ROW2_HELPER_HPP Chris@16: