Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77418 - in trunk/boost/msm: back front front/euml
From: christophe.j.henry_at_[hidden]
Date: 2012-03-19 17:06:51


Author: chenry
Date: 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
New Revision: 77418
URL: http://svn.boost.org/trac/boost/changeset/77418

Log:
bugfix (terminate/interrupt states not working if flags are provided in the state definition)
Text files modified:
   trunk/boost/msm/back/metafunctions.hpp | 13 ++++++++++++-
   trunk/boost/msm/back/state_machine.hpp | 2 +-
   trunk/boost/msm/front/euml/state_grammar.hpp | 5 +++++
   trunk/boost/msm/front/state_machine_def.hpp | 1 +
   trunk/boost/msm/front/states.hpp | 11 ++++++++---
   5 files changed, 27 insertions(+), 5 deletions(-)

Modified: trunk/boost/msm/back/metafunctions.hpp
==============================================================================
--- trunk/boost/msm/back/metafunctions.hpp (original)
+++ trunk/boost/msm/back/metafunctions.hpp 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
@@ -632,11 +632,22 @@
         ::boost::mpl::bool_<false> >::type type;
 };
 
+// builds flags (add internal_flag_list and flag_list). internal_flag_list is used for terminate/interrupt states
+template <class StateType>
+struct get_flag_list
+{
+ typedef typename ::boost::mpl::insert_range<
+ typename StateType::flag_list,
+ typename ::boost::mpl::end< typename StateType::flag_list >::type,
+ typename StateType::internal_flag_list
+ >::type type;
+};
+
 template <class StateType>
 struct is_state_blocking
 {
     typedef typename ::boost::mpl::fold<
- typename StateType::flag_list, ::boost::mpl::set<>,
+ typename get_flag_list<StateType>::type, ::boost::mpl::set<>,
         ::boost::mpl::if_<
                  has_event_blocking_flag< ::boost::mpl::placeholders::_2>,
                  ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2 >,

Modified: trunk/boost/msm/back/state_machine.hpp
==============================================================================
--- trunk/boost/msm/back/state_machine.hpp (original)
+++ trunk/boost/msm/back/state_machine.hpp 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
@@ -2096,7 +2096,7 @@
         template <class StateType>
         void operator()( ::boost::msm::wrap<StateType> const& )
         {
- typedef typename StateType::flag_list flags;
+ typedef typename get_flag_list<StateType>::type flags;
             typedef typename ::boost::mpl::contains<flags,Flag >::type found;
             typedef typename is_composite_state<StateType>::type composite;
 

Modified: trunk/boost/msm/front/euml/state_grammar.hpp
==============================================================================
--- trunk/boost/msm/front/euml/state_grammar.hpp (original)
+++ trunk/boost/msm/front/euml/state_grammar.hpp 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
@@ -59,6 +59,7 @@
     typedef StateNameTag state_name_tag;
     // flags
     typedef Flags flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     // deferred events
     typedef Defer deferred_events;
 
@@ -99,6 +100,7 @@
 
     // flags
     typedef Flags flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     // deferred events
     typedef Defer deferred_events;
 
@@ -135,6 +137,7 @@
     typedef StateNameTag state_name_tag;
     // flags
     typedef Flags flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     // deferred events
     typedef Defer deferred_events;
 
@@ -175,6 +178,7 @@
 
     // flags
     typedef Flags flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     // deferred events
     typedef Defer deferred_events;
 
@@ -867,6 +871,7 @@
     // flags
     typedef StateNameTag state_name_tag;
     typedef Flags flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     // deferred events
     typedef Defer deferred_events;
     // customization (message queue, exceptions)

Modified: trunk/boost/msm/front/state_machine_def.hpp
==============================================================================
--- trunk/boost/msm/front/state_machine_def.hpp (original)
+++ trunk/boost/msm/front/state_machine_def.hpp 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
@@ -31,6 +31,7 @@
     // tags
     // default: no flag
     typedef ::boost::mpl::vector0<> flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
     // customization (message queue, exceptions)

Modified: trunk/boost/msm/front/states.hpp
==============================================================================
--- trunk/boost/msm/front/states.hpp (original)
+++ trunk/boost/msm/front/states.hpp 2012-03-19 17:06:50 EDT (Mon, 19 Mar 2012)
@@ -49,6 +49,7 @@
     // tags
     // default: no flag
     typedef ::boost::mpl::vector0<> flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
 };
@@ -59,7 +60,8 @@
 struct terminate_state : public boost::msm::front::detail::state_base<BASE>, SMPtrPolicy
 {
     // tags
- typedef ::boost::mpl::vector<boost::msm::TerminateFlag> flag_list;
+ typedef ::boost::mpl::vector0<> flag_list;
+ typedef ::boost::mpl::vector< boost::msm::TerminateFlag> internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
 };
@@ -71,9 +73,10 @@
 struct interrupt_state : public boost::msm::front::detail::state_base<BASE>, SMPtrPolicy
 {
     // tags
+ typedef ::boost::mpl::vector0<> flag_list;
     typedef ::boost::mpl::vector<boost::msm::InterruptedFlag,
         boost::msm::EndInterruptFlag<EndInterruptEvent> >
- flag_list;
+ internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
 };
@@ -101,6 +104,7 @@
     typedef int explicit_entry_state;
     // default: no flag
     typedef ::boost::mpl::vector0<> flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
 };
@@ -117,7 +121,8 @@
     typedef int pseudo_exit;
 
     // default: no flag
- typedef ::boost::mpl::vector< > flag_list;
+ typedef ::boost::mpl::vector0<> flag_list;
+ typedef ::boost::mpl::vector0<> internal_flag_list;
     //default: no deferred events
     typedef ::boost::mpl::vector0<> deferred_events;
 };


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