|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84642 - in trunk/boost/msm: back front
From: christophe.j.henry_at_[hidden]
Date: 2013-06-04 17:02:39
Author: chenry
Date: 2013-06-04 17:02:38 EDT (Tue, 04 Jun 2013)
New Revision: 84642
URL: http://svn.boost.org/trac/boost/changeset/84642
Log:
added support for sequence of end interrupt events
Text files modified:
trunk/boost/msm/back/metafunctions.hpp | 38 +++++++++++++++++++++++++++++++++++++-
trunk/boost/msm/front/states.hpp | 8 +++++---
2 files changed, 42 insertions(+), 4 deletions(-)
Modified: trunk/boost/msm/back/metafunctions.hpp
==============================================================================
--- trunk/boost/msm/back/metafunctions.hpp (original)
+++ trunk/boost/msm/back/metafunctions.hpp 2013-06-04 17:02:38 EDT (Tue, 04 Jun 2013)
@@ -46,6 +46,8 @@
#include <boost/type_traits/is_same.hpp>
#include <boost/utility/enable_if.hpp>
+#include <boost/msm/row_tags.hpp>
+
// mpl_graph graph implementation and depth first search
#include <boost/msm/mpl_graph/incidence_list_graph.hpp>
#include <boost/msm/mpl_graph/depth_first_search.hpp>
@@ -202,7 +204,6 @@
States,
typename ::boost::mpl::push_back< ::boost::mpl::vector0<>,States>::type >::type type;
};
-
// returns a mpl::int_ containing the size of a region. If the argument is not a sequence, returns 1
template <class region>
struct get_number_of_regions
@@ -935,6 +936,41 @@
return false;
}
+// transformation metafunction to end interrupt flags
+template <class Event>
+struct transform_to_end_interrupt
+{
+ typedef boost::msm::EndInterruptFlag<Event> type;
+};
+// transform a sequence of events into another one of EndInterruptFlag<Event>
+template <class Events>
+struct apply_end_interrupt_flag
+{
+ typedef typename
+ ::boost::mpl::transform<
+ Events,transform_to_end_interrupt< ::boost::mpl::placeholders::_1> >::type type;
+};
+// returns a mpl vector containing all end interrupt events if sequence, otherwise the same event
+template <class Event>
+struct get_interrupt_events
+{
+ typedef typename ::boost::mpl::eval_if<
+ ::boost::mpl::is_sequence<Event>,
+ boost::msm::back::apply_end_interrupt_flag<Event>,
+ boost::mpl::vector1<boost::msm::EndInterruptFlag<Event> > >::type type;
+};
+
+template <class Events>
+struct build_interrupt_state_flag_list
+{
+ typedef ::boost::mpl::vector<boost::msm::InterruptedFlag> first_part;
+ typedef typename ::boost::mpl::insert_range<
+ first_part,
+ typename ::boost::mpl::end< first_part >::type,
+ Events
+ >::type type;
+};
+
} } }//boost::msm::back
#endif // BOOST_MSM_BACK_METAFUNCTIONS_H
Modified: trunk/boost/msm/front/states.hpp
==============================================================================
--- trunk/boost/msm/front/states.hpp (original)
+++ trunk/boost/msm/front/states.hpp 2013-06-04 17:02:38 EDT (Tue, 04 Jun 2013)
@@ -15,6 +15,7 @@
#include <boost/mpl/vector.hpp>
#include <boost/msm/front/common_states.hpp>
#include <boost/msm/row_tags.hpp>
+#include <boost/msm/back/metafunctions.hpp>
namespace boost { namespace msm { namespace front
{
@@ -74,9 +75,10 @@
{
// tags
typedef ::boost::mpl::vector0<> flag_list;
- typedef ::boost::mpl::vector<boost::msm::InterruptedFlag,
- boost::msm::EndInterruptFlag<EndInterruptEvent> >
- internal_flag_list;
+ typedef typename boost::msm::back::build_interrupt_state_flag_list<
+ typename boost::msm::back::get_interrupt_events<EndInterruptEvent>::type
+ >::type 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