Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65868 - in branches/release/boost/msm: . back front front/euml
From: christophe.j.henry_at_[hidden]
Date: 2010-10-09 15:29:41


Author: chenry
Date: 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
New Revision: 65868
URL: http://svn.boost.org/trac/boost/changeset/65868

Log:
merged revisions 65817-65847
Added:
   branches/release/boost/msm/back/fold_to_list.hpp
      - copied unchanged from r65835, /trunk/boost/msm/back/fold_to_list.hpp
   branches/release/boost/msm/proto_config.hpp
      - copied, changed from r65835, /trunk/boost/msm/proto_config.hpp
Properties modified:
   branches/release/boost/msm/ (props changed)
Text files modified:
   branches/release/boost/msm/back/state_machine.hpp | 76 ++++++++++++++++++++++++++++++++++++++-
   branches/release/boost/msm/front/euml/common.hpp | 17 --------
   branches/release/boost/msm/front/functor_row.hpp | 2 +
   branches/release/boost/msm/front/state_machine_def.hpp | 3 +
   branches/release/boost/msm/proto_config.hpp | 2 +
   5 files changed, 81 insertions(+), 19 deletions(-)

Modified: branches/release/boost/msm/back/state_machine.hpp
==============================================================================
--- branches/release/boost/msm/back/state_machine.hpp (original)
+++ branches/release/boost/msm/back/state_machine.hpp 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
@@ -17,6 +17,9 @@
 #include <functional>
 #include <numeric>
 #include <utility>
+
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
 #include <boost/mpl/contains.hpp>
 #include <boost/mpl/deref.hpp>
 
@@ -31,7 +34,6 @@
 #include <boost/fusion/include/at_key.hpp>
 #include <boost/fusion/algorithm/iteration/for_each.hpp>
 #include <boost/fusion/include/for_each.hpp>
-#include <boost/fusion/include/for_each.hpp>
 
 #include <boost/assert.hpp>
 #include <boost/ref.hpp>
@@ -49,6 +51,7 @@
 #include <boost/serialization/base_object.hpp>
 
 #include <boost/msm/row_tags.hpp>
+#include <boost/msm/back/fold_to_list.hpp>
 #include <boost/msm/back/metafunctions.hpp>
 #include <boost/msm/back/history_policies.hpp>
 #include <boost/msm/back/bind_helpers.hpp>
@@ -86,6 +89,7 @@
 const boost::msm::back::dispatch_table<Fsm,Stt, Event,CompilePolicy>
 dispatch_table<Fsm,Stt, Event,CompilePolicy>::instance;
 
+
 // library-containing class for state machines. Pass the actual FSM class as
 // the Concrete parameter.
 template<class Derived,class HistoryPolicy=NoHistory,class CompilePolicy=favor_runtime_speed>
@@ -1190,7 +1194,24 @@
          int* const m_initial_states;
          int m_index;
      };
- public:
+ public:
+ struct update_state
+ {
+ update_state(substate_list& to_overwrite_):to_overwrite(&to_overwrite_){}
+ template<typename StateType>
+ void operator()(StateType const& astate) const
+ {
+ ::boost::fusion::at_key<StateType>(*to_overwrite)=astate;
+ }
+ substate_list* to_overwrite;
+ };
+ template <class Expr>
+ void set_states(Expr const& expr)
+ {
+ ::boost::fusion::for_each(
+ ::boost::fusion::as_vector(FoldToList()(expr, boost::fusion::nil())),update_state(this->m_substate_list));
+ }
+
      // Construct with the default initial states
      state_machine<Derived,HistoryPolicy,CompilePolicy >()
          :Derived()
@@ -1209,13 +1230,38 @@
          // create states
          fill_states(this);
      }
+ template <class Expr>
+ state_machine<Derived,HistoryPolicy,CompilePolicy >
+ (Expr const& expr,typename ::boost::enable_if<typename ::boost::proto::is_expr<Expr>::type >::type* dummy=0)
+ :Derived()
+ ,m_events_queue()
+ ,m_deferred_events_queue()
+ ,m_history()
+ ,m_event_processing(false)
+ ,m_is_included(false)
+ ,m_visitors()
+ ,m_substate_list()
+ {
+ BOOST_MPL_ASSERT_MSG(
+ ( ::boost::proto::matches<Expr, FoldToList>::value),
+ THE_STATES_EXPRESSION_PASSED_DOES_NOT_MATCH_GRAMMAR,
+ (FoldToList));
 
+ // initialize our list of states with the ones defined in Derived::initial_state
+ ::boost::mpl::for_each< seq_initial_states, ::boost::msm::wrap<mpl::placeholders::_1> >
+ (init_states(m_states));
+ m_history.set_initial_states(m_states);
+ // create states
+ fill_states(this);
+ set_states(expr);
+ }
      // Construct with the default initial states and some default argument(s)
 #define MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB(z, n, unused) ARG ## n t ## n
 #define MSM_CONSTRUCTOR_HELPER_EXECUTE(z, n, unused) \
         template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
         state_machine<Derived,HistoryPolicy,CompilePolicy \
- >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ) ) \
+ >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \
+ typename ::boost::disable_if<typename ::boost::proto::is_expr<ARG0>::type >::type* dummy=0 ) \
         :Derived(BOOST_PP_ENUM_PARAMS(n,t)) \
          ,m_events_queue() \
          ,m_deferred_events_queue() \
@@ -1229,7 +1275,31 @@
                         (init_states(m_states)); \
          m_history.set_initial_states(m_states); \
          fill_states(this); \
+ } \
+ template <class Expr,BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ state_machine<Derived,HistoryPolicy,CompilePolicy \
+ >(Expr const& expr,BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \
+ typename ::boost::enable_if<typename ::boost::proto::is_expr<Expr>::type >::type* dummy=0 ) \
+ :Derived(BOOST_PP_ENUM_PARAMS(n,t)) \
+ ,m_events_queue() \
+ ,m_deferred_events_queue() \
+ ,m_history() \
+ ,m_event_processing(false) \
+ ,m_is_included(false) \
+ ,m_visitors() \
+ ,m_substate_list() \
+ { \
+ BOOST_MPL_ASSERT_MSG( \
+ ( ::boost::proto::matches<Expr, FoldToList>::value), \
+ THE_STATES_EXPRESSION_PASSED_DOES_NOT_MATCH_GRAMMAR, \
+ (FoldToList)); \
+ ::boost::mpl::for_each< seq_initial_states, ::boost::msm::wrap<mpl::placeholders::_1> > \
+ (init_states(m_states)); \
+ m_history.set_initial_states(m_states); \
+ fill_states(this); \
+ set_states(expr); \
      }
+
      BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_CONSTRUCTOR_ARG_SIZE,1), MSM_CONSTRUCTOR_HELPER_EXECUTE, ~)
 #undef MSM_CONSTRUCTOR_HELPER_EXECUTE
 #undef MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB

Modified: branches/release/boost/msm/front/euml/common.hpp
==============================================================================
--- branches/release/boost/msm/front/euml/common.hpp (original)
+++ branches/release/boost/msm/front/euml/common.hpp 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
@@ -12,27 +12,12 @@
 #define BOOST_MSM_FRONT_EUML_COMMON_H
 
 #include <boost/config.hpp>
-
-#ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
-#undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
-#endif
-
-#ifdef BOOST_PROTO_MAX_ARITY
-#undef BOOST_PROTO_MAX_ARITY
-#endif
+#include <boost/msm/proto_config.hpp>
 
 #ifndef BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
 #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
 #endif
 
-#ifdef BOOST_MSVC
-#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 7
-#define BOOST_PROTO_MAX_ARITY 7
-#else
-#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6
-#define BOOST_PROTO_MAX_ARITY 6
-#endif
-
 #include <iterator>
 #include <utility>
 

Modified: branches/release/boost/msm/front/functor_row.hpp
==============================================================================
--- branches/release/boost/msm/front/functor_row.hpp (original)
+++ branches/release/boost/msm/front/functor_row.hpp 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
@@ -11,6 +11,8 @@
 #ifndef BOOST_MSM_FRONT_FUNCTOR_ROW_H
 #define BOOST_MSM_FRONT_FUNCTOR_ROW_H
 
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
 #include <boost/mpl/set.hpp>
 #include <boost/mpl/for_each.hpp>
 

Modified: branches/release/boost/msm/front/state_machine_def.hpp
==============================================================================
--- branches/release/boost/msm/front/state_machine_def.hpp (original)
+++ branches/release/boost/msm/front/state_machine_def.hpp 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
@@ -13,6 +13,9 @@
 
 #include <exception>
 #include <boost/assert.hpp>
+
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
 #include <boost/mpl/vector.hpp>
 
 #include <boost/msm/row_tags.hpp>

Copied: branches/release/boost/msm/proto_config.hpp (from r65835, /trunk/boost/msm/proto_config.hpp)
==============================================================================
--- /trunk/boost/msm/proto_config.hpp (original)
+++ branches/release/boost/msm/proto_config.hpp 2010-10-09 15:29:39 EDT (Sat, 09 Oct 2010)
@@ -11,6 +11,8 @@
 #ifndef BOOST_MSM_PROTO_CONFIG_H
 #define BOOST_MSM_PROTO_CONFIG_H
 
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
 #ifdef BOOST_MSVC
   #if BOOST_PROTO_MAX_ARITY <= 7
     #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY


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