Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86799 - trunk/boost/msm/back
From: christophe.j.henry_at_[hidden]
Date: 2013-11-23 15:49:36


Author: chenry
Date: 2013-11-23 15:49:36 EST (Sat, 23 Nov 2013)
New Revision: 86799
URL: http://svn.boost.org/trac/boost/changeset/86799

Log:
trac 9280: moved handling of deferred events to history policy

Text files modified:
   trunk/boost/msm/back/history_policies.hpp | 19 +++++++++++++++++++
   trunk/boost/msm/back/state_machine.hpp | 5 +++++
   2 files changed, 24 insertions(+), 0 deletions(-)

Modified: trunk/boost/msm/back/history_policies.hpp
==============================================================================
--- trunk/boost/msm/back/history_policies.hpp Sat Nov 23 09:50:58 2013 (r86798)
+++ trunk/boost/msm/back/history_policies.hpp 2013-11-23 15:49:36 EST (Sat, 23 Nov 2013) (r86799)
@@ -49,6 +49,12 @@
          }
          return *this;
     }
+ // this policy deletes all waiting deferred events
+ template <class Event>
+ bool process_deferred_events(Event const&)const
+ {
+ return false;
+ }
     template<class Archive>
     void serialize(Archive & ar, const unsigned int)
     {
@@ -90,6 +96,13 @@
          }
          return *this;
     }
+ // the history policy keeps all deferred events until next reentry
+ template <class Event>
+ bool process_deferred_events(Event const&)const
+ {
+ return true;
+ }
+
     template<class Archive>
     void serialize(Archive & ar, const unsigned int)
     {
@@ -139,6 +152,12 @@
          }
          return *this;
     }
+ // the history policy keeps deferred events until next reentry if coming from our history event
+ template <class Event>
+ bool process_deferred_events(Event const&)const
+ {
+ return ::boost::mpl::contains<Events,Event>::value;
+ }
     template<class Archive>
     void serialize(Archive & ar, const unsigned int)
     {

Modified: trunk/boost/msm/back/state_machine.hpp
==============================================================================
--- trunk/boost/msm/back/state_machine.hpp Sat Nov 23 09:50:58 2013 (r86798)
+++ trunk/boost/msm/back/state_machine.hpp 2013-11-23 15:49:36 EST (Sat, 23 Nov 2013) (r86799)
@@ -2614,6 +2614,11 @@
         (static_cast<Derived*>(this))->on_exit(incomingEvent,fsm);
         // give the history a chance to handle this (or not).
         m_history.history_exit(this->m_states);
+ // history decides what happens with deferred events
+ if (!m_history.process_deferred_events(incomingEvent))
+ {
+ get_deferred_queue().clear();
+ }
      }
 
     // the IBM and VC<8 compilers seem to have problems with the friend declaration of dispatch_table


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