Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58685 - sandbox/msm/boost/msm/front
From: christophe.j.henry_at_[hidden]
Date: 2010-01-04 14:57:11


Author: chenry
Date: 2010-01-04 14:57:10 EST (Mon, 04 Jan 2010)
New Revision: 58685
URL: http://svn.boost.org/trac/boost/changeset/58685

Log:
added internal rows
Text files modified:
   sandbox/msm/boost/msm/front/functor_row.hpp | 58 ++++++++++++++++++++++++++++++++++++
   sandbox/msm/boost/msm/front/state_machine_def.hpp | 63 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 121 insertions(+), 0 deletions(-)

Modified: sandbox/msm/boost/msm/front/functor_row.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/functor_row.hpp (original)
+++ sandbox/msm/boost/msm/front/functor_row.hpp 2010-01-04 14:57:10 EST (Mon, 04 Jan 2010)
@@ -93,6 +93,64 @@
             return Guard()(evt,fsm,src,tgt);
         }
     };
+ // internal transitions
+ template<class SOURCE,class EVENT,class ACTION>
+ struct Row<SOURCE,EVENT,none,ACTION,none>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef ACTION Action;
+ typedef none Guard;
+ // no guard
+ typedef a_irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ static void action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ }
+ };
+ template<class SOURCE,class EVENT,class GUARD>
+ struct Row<SOURCE,EVENT,none,none,GUARD>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef none Action;
+ typedef GUARD Guard;
+ // no action
+ typedef g_irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+ template<class SOURCE,class EVENT,class ACTION,class GUARD>
+ struct Row<SOURCE,EVENT,none,ACTION,GUARD>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef ACTION Action;
+ typedef GUARD Guard;
+ // action + guard
+ typedef irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ static void action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
     template<class TGT>
     struct get_row_target
     {

Modified: sandbox/msm/boost/msm/front/state_machine_def.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/state_machine_def.hpp (original)
+++ sandbox/msm/boost/msm/front/state_machine_def.hpp 2010-01-04 14:57:10 EST (Mon, 04 Jan 2010)
@@ -111,6 +111,69 @@
             return (fsm.*guard)(evt);
         }
     };
+ // internal transitions
+ template<
+ typename T1
+ , class Event
+ , void (Derived::*action)(Event const&)
+ >
+ struct a_irow
+ {
+ typedef a_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState>
+ static void action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ }
+ };
+
+ template<
+ typename T1
+ , class Event
+ , void (Derived::*action)(Event const&)
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct irow
+ {
+ typedef irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState>
+ static void action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ }
+ template <class FSM,class SourceState,class TargetState>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ template<
+ typename T1
+ , class Event
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct g_irow
+ {
+ typedef g_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
 protected:
     // Default no-transition handler. Can be replaced in the Derived SM class.
     template <class FSM,class Event>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk