1 // Copyright 2008 Christophe Henry
2 // henry UNDERSCORE christophe AT hotmail DOT com
3 // This is an extended version of the state machine available in the boost::mpl library
4 // Distributed under the same license as the original.
5 // Copyright for the original version:
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
7 // under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_MSM_INTERNAL_ROW_HPP
12 #define BOOST_MSM_INTERNAL_ROW_HPP
14 #include <boost/type_traits/is_base_of.hpp>
15 #include <boost/mpl/bool.hpp>
16 #include <boost/fusion/include/at_key.hpp>
17 #include <boost/msm/back/common_types.hpp>
18 #include <boost/msm/row_tags.hpp>
19 #include <boost/msm/front/detail/row2_helper.hpp>
21 namespace boost { namespace msm { namespace front
25 , typename CalledForAction
26 , void (CalledForAction::*action)(Event const&)
30 typedef sm_a_i_row_tag row_type_tag;
32 template <class FSM,class SourceState,class TargetState,class AllStates>
33 static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
34 AllStates& all_states)
36 // in this front-end, we don't need to know source and target states
37 ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
38 (fsm,evt,src,tgt,all_states,
39 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
40 return ::boost::msm::back::HANDLED_TRUE;
46 , typename CalledForAction
47 , void (CalledForAction::*action)(Event const&)
48 , typename CalledForGuard
49 , bool (CalledForGuard::*guard)(Event const&)
53 typedef sm_i_row_tag row_type_tag;
55 template <class FSM,class SourceState,class TargetState,class AllStates>
56 static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
57 AllStates& all_states)
59 // in this front-end, we don't need to know source and target states
60 ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
61 (fsm,evt,src,tgt,all_states,
62 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
63 return ::boost::msm::back::HANDLED_TRUE;
65 template <class FSM,class SourceState,class TargetState,class AllStates>
66 static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
67 AllStates& all_states)
69 // in this front-end, we don't need to know source and target states
70 return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
71 (fsm,evt,src,tgt,all_states,
72 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
77 , typename CalledForGuard
78 , bool (CalledForGuard::*guard)(Event const&)
82 typedef sm_g_i_row_tag row_type_tag;
84 template <class FSM,class SourceState,class TargetState,class AllStates>
85 static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
86 AllStates& all_states)
88 // in this front-end, we don't need to know source and target states
89 return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
90 (fsm,evt,src,tgt,all_states,
91 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
99 typedef sm__i_row_tag row_type_tag;
104 #endif //BOOST_MSM_INTERNAL_ROW_HPP