Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:48:14

0001 // Copyright 2008 Christophe Henry
0002 // henry UNDERSCORE christophe AT hotmail DOT com
0003 // This is an extended version of the state machine available in the boost::mpl library
0004 // Distributed under the same license as the original.
0005 // Copyright for the original version:
0006 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
0007 // under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_MSM_ROW2_HPP
0012 #define BOOST_MSM_ROW2_HPP
0013 
0014 #include <boost/type_traits/is_base_of.hpp>
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/fusion/include/at_key.hpp>
0017 #include <boost/msm/back/common_types.hpp>
0018 #include <boost/msm/row_tags.hpp>
0019 #include <boost/msm/front/detail/row2_helper.hpp>
0020 
0021 namespace boost { namespace msm { namespace front
0022 {
0023     template<
0024         typename T1
0025         , class Event
0026         , typename T2
0027     >
0028     struct _row2
0029     {
0030         typedef _row_tag row_type_tag;
0031         typedef T1 Source;
0032         typedef T2 Target;
0033         typedef Event Evt;
0034     };
0035 
0036     template<
0037         typename T1
0038         , class Event
0039         , typename T2
0040         , typename CalledForAction
0041         , void (CalledForAction::*action)(Event const&)
0042     >
0043     struct a_row2
0044     {
0045         typedef a_row_tag row_type_tag;
0046         typedef T1 Source;
0047         typedef T2 Target;
0048         typedef Event Evt;
0049         template <class FSM,class SourceState,class TargetState,class AllStates>
0050         static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, 
0051                                 AllStates& all_states)
0052         {
0053             // in this front-end, we don't need to know source and target states
0054             ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::template call_helper
0055                 (fsm,evt,src,tgt,all_states,
0056                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
0057             return ::boost::msm::back::HANDLED_TRUE;
0058         }
0059     };
0060 
0061     template<
0062         typename T1
0063         , class Event
0064         , typename T2
0065         , typename CalledForAction
0066         , void (CalledForAction::*action)(Event const&)
0067         , typename CalledForGuard
0068         , bool (CalledForGuard::*guard)(Event const&)
0069     >
0070     struct row2
0071     {
0072         typedef row_tag row_type_tag;
0073         typedef T1 Source;
0074         typedef T2 Target;
0075         typedef Event Evt;
0076         template <class FSM,class SourceState,class TargetState, class AllStates>
0077         static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, 
0078                                 AllStates& all_states)
0079         {
0080             // in this front-end, we don't need to know source and target states
0081             ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
0082                 (fsm,evt,src,tgt,all_states,
0083                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
0084             return ::boost::msm::back::HANDLED_TRUE;
0085         }
0086         template <class FSM,class SourceState,class TargetState,class AllStates>
0087         static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
0088                                AllStates& all_states)
0089         {
0090             // in this front-end, we don't need to know source and target states
0091             return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
0092                 (fsm,evt,src,tgt,all_states,
0093                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
0094         }
0095     };
0096     template<
0097         typename T1
0098         , class Event
0099         , typename T2
0100         , typename CalledForGuard
0101         , bool (CalledForGuard::*guard)(Event const&)
0102     >
0103     struct g_row2
0104     {
0105         typedef g_row_tag row_type_tag;
0106         typedef T1 Source;
0107         typedef T2 Target;
0108         typedef Event Evt;
0109         template <class FSM,class SourceState,class TargetState,class AllStates>
0110         static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
0111                                AllStates& all_states)
0112         {
0113             // in this front-end, we don't need to know source and target states
0114             return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
0115                 (fsm,evt,src,tgt,all_states,
0116                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
0117         }
0118     };
0119     // internal transitions
0120     template<
0121         typename T1
0122         , class Event
0123         , typename CalledForAction
0124         , void (CalledForAction::*action)(Event const&)
0125     >
0126     struct a_irow2
0127     {
0128         typedef a_irow_tag row_type_tag;
0129         typedef T1 Source;
0130         typedef T1 Target;
0131         typedef Event Evt;
0132         template <class FSM,class SourceState,class TargetState,class AllStates>
0133         static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, 
0134                                 AllStates& all_states)
0135         {
0136             // in this front-end, we don't need to know source and target states
0137             ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
0138                 (fsm,evt,src,tgt,all_states,
0139                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
0140             return ::boost::msm::back::HANDLED_TRUE;
0141         }
0142     };
0143 
0144     template<
0145         typename T1
0146         , class Event
0147         , typename CalledForAction
0148         , void (CalledForAction::*action)(Event const&)
0149         , typename CalledForGuard
0150         , bool (CalledForGuard::*guard)(Event const&)
0151     >
0152     struct irow2
0153     {
0154         typedef irow_tag row_type_tag;
0155         typedef T1 Source;
0156         typedef T1 Target;
0157         typedef Event Evt;
0158         template <class FSM,class SourceState,class TargetState,class AllStates>
0159         static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt, 
0160                                 AllStates& all_states)
0161         {
0162             // in this front-end, we don't need to know source and target states
0163             ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
0164                 (fsm,evt,src,tgt,all_states,
0165                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
0166             return ::boost::msm::back::HANDLED_TRUE;
0167         }
0168         template <class FSM,class SourceState,class TargetState,class AllStates>
0169         static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
0170                                AllStates& all_states)
0171         {
0172             // in this front-end, we don't need to know source and target states
0173             return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
0174                 (fsm,evt,src,tgt,all_states,
0175                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
0176         }
0177     };
0178     template<
0179         typename T1
0180         , class Event
0181         , typename CalledForGuard
0182         , bool (CalledForGuard::*guard)(Event const&)
0183     >
0184     struct g_irow2
0185     {
0186         typedef g_irow_tag row_type_tag;
0187         typedef T1 Source;
0188         typedef T1 Target;
0189         typedef Event Evt;
0190         template <class FSM,class SourceState,class TargetState,class AllStates>
0191         static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
0192                                AllStates& all_states)
0193         {
0194             // in this front-end, we don't need to know source and target states
0195             return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
0196                 (fsm,evt,src,tgt,all_states,
0197                 ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
0198         }
0199     };
0200 
0201 }}}
0202 
0203 #endif //BOOST_MSM_ROW2_HPP
0204