Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59630 - sandbox/msm/boost/msm/back
From: christophe.j.henry_at_[hidden]
Date: 2010-02-11 05:49:00


Author: chenry
Date: 2010-02-11 05:48:59 EST (Thu, 11 Feb 2010)
New Revision: 59630
URL: http://svn.boost.org/trac/boost/changeset/59630

Log:
added support for "ignore" internal transitions
Text files modified:
   sandbox/msm/boost/msm/back/state_machine.hpp | 43 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 43 insertions(+), 0 deletions(-)

Modified: sandbox/msm/boost/msm/back/state_machine.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/state_machine.hpp (original)
+++ sandbox/msm/boost/msm/back/state_machine.hpp 2010-02-11 05:48:59 EST (Thu, 11 Feb 2010)
@@ -639,7 +639,26 @@
             return HANDLED_TRUE;
         }
     };
+ // row simply ignoring the event
+ template<
+ typename ROW
+ >
+ struct _irow_
+ {
+ typedef typename ROW::Source T1;
+ typedef typename ROW::Target T2;
+ typedef typename ROW::Evt transition_event;
+ typedef T1 current_state_type;
+ typedef T2 next_state_type;
 
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& , int , int state, transition_event const& )
+ {
+ BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
+ BOOST_ASSERT(state == (current_state));
+ return HANDLED_TRUE;
+ }
+ };
     // transitions internal to this state machine (no substate involved)
     template<
         typename ROW,
@@ -718,6 +737,20 @@
             return HANDLED_TRUE;
         }
     };
+ template<
+ typename ROW,
+ typename StateType
+ >
+ struct _internal_
+ {
+ typedef StateType current_state_type;
+ typedef StateType next_state_type;
+ typedef typename ROW::Evt transition_event;
+ static HandledEnum execute(library_sm& , int , int , transition_event const& )
+ {
+ return HANDLED_TRUE;
+ }
+ };
     // Template used to form forwarding rows in the transition table for every row of a composite SM
     template<
         typename T1
@@ -780,6 +813,11 @@
                 typedef irow_<Transition> type;
         };
     template <class Transition,class StateType>
+ struct create_backend_stt<_irow_tag,Transition,StateType>
+ {
+ typedef _irow_<Transition> type;
+ };
+ template <class Transition,class StateType>
     struct create_backend_stt<sm_a_i_row_tag,Transition,StateType>
     {
         typedef a_internal_<Transition,StateType> type;
@@ -794,6 +832,11 @@
     {
         typedef internal_<Transition,StateType> type;
     };
+ template <class Transition,class StateType>
+ struct create_backend_stt<sm__i_row_tag,Transition,StateType>
+ {
+ typedef _internal_<Transition,StateType> type;
+ };
     template <class Transition,class StateType=void>
     struct make_row_tag
     {


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