$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r58461 - in sandbox/msm/boost/msm: . back front front/euml
From: christophe.j.henry_at_[hidden]
Date: 2009-12-18 17:28:00
Author: chenry
Date: 2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
New Revision: 58461
URL: http://svn.boost.org/trac/boost/changeset/58461
Log:
after review: started implementation of review issues:
- some SFINAE replaced by tag dispatching
- dispatch speed gain
- copy speed gain
- minor eUML cleanup
Added:
   sandbox/msm/boost/msm/common.hpp   (contents, props changed)
Text files modified: 
   sandbox/msm/boost/msm/back/common_types.hpp        |     5                                         
   sandbox/msm/boost/msm/back/dispatch_table.hpp      |    46 ++--                                    
   sandbox/msm/boost/msm/back/state_machine.hpp       |   406 ++++++++++++++++++++++++++------------- 
   sandbox/msm/boost/msm/back/tools.hpp               |     6                                         
   sandbox/msm/boost/msm/front/euml/common.hpp        |     2                                         
   sandbox/msm/boost/msm/front/euml/operator.hpp      |     1                                         
   sandbox/msm/boost/msm/front/euml/state_grammar.hpp |    45 ++++                                    
   sandbox/msm/boost/msm/front/functor_row.hpp        |    10                                         
   8 files changed, 349 insertions(+), 172 deletions(-)
Modified: sandbox/msm/boost/msm/back/common_types.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/common_types.hpp	(original)
+++ sandbox/msm/boost/msm/back/common_types.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -12,6 +12,7 @@
 #define BOOST_MSM_COMMON_TYPES_H
 
 #include <boost/tuple/tuple.hpp>
+#include <boost/msm/common.hpp>
 
 namespace boost { namespace msm { namespace back
 {
@@ -28,10 +29,6 @@
 
 typedef HandledEnum execute_return;
 
-// wrapper for mpl::for_each as showed in the C++ Template Metaprogramming ch. 9
-template <class T>
-struct wrap{};
-
 }}}
 
 #endif //BOOST_MSM_COMMON_TYPES_H
Modified: sandbox/msm/boost/msm/back/dispatch_table.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/dispatch_table.hpp	(original)
+++ sandbox/msm/boost/msm/back/dispatch_table.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -33,7 +33,7 @@
 {
  private:
     // This is a table of these function pointers.
-    typedef std::pair<int,HandledEnum> (*cell)(Fsm&, int,Event const&);
+    typedef HandledEnum (*cell)(Fsm&, int,int,Event const&);
     typedef bool (*guard)(Fsm&, Event const&);
 
     // class used to build a chain (or sequence) of transitions for a given event and start state
@@ -49,42 +49,44 @@
         {
             template <class Sequence>
             static
-            typename ::boost::enable_if<typename ::boost::mpl::empty<Sequence>::type,std::pair<int,HandledEnum> >::type
-            execute(Fsm& , int state, Event const& ,
-                    ::boost::msm::back::dummy<0> = 0)
+            HandledEnum
+            execute(Fsm& , int, int, Event const& , ::boost::mpl::true_ const & )
             {
                 // if at least one guard rejected, this will be ignored, otherwise will generate an error
-                return std::make_pair(state,HANDLED_FALSE);
+                return HANDLED_FALSE;
             }
 
             template <class Sequence>
             static
-            typename ::boost::disable_if<typename ::boost::mpl::empty<Sequence>::type,std::pair<int,HandledEnum> >::type
-            execute(Fsm& fsm, int state, Event const& evt,
-                    ::boost::msm::back::dummy<1> = 0)
+            HandledEnum
+            execute(Fsm& fsm, int region_index , int state, Event const& evt,
+                    ::boost::mpl::false_ const & )
             {
                  // try the first guard
                  typedef typename ::boost::mpl::front<Sequence>::type first_row;
-                 std::pair<int,HandledEnum> res = first_row::execute(fsm,state,evt);
-                 if (HANDLED_TRUE!=res.second)
+                 HandledEnum res = first_row::execute(fsm,region_index,state,evt);
+                 if (HANDLED_TRUE!=res)
                  {
                      // if the first rejected, move on to the next one
-                     std::pair<int,HandledEnum> sub_res = 
-                         execute<typename ::boost::mpl::pop_front<Sequence>::type>(fsm,state,evt);
+                    HandledEnum sub_res = 
+                         execute<typename ::boost::mpl::pop_front<Sequence>::type>(fsm,region_index,state,evt,
+                            ::boost::mpl::bool_<
+                                ::boost::mpl::empty<typename ::boost::mpl::pop_front<Sequence>::type>::type::value>());
                      // if at least one guards rejects, the event will not generate a call to no_transition
-                     HandledEnum handled = ((HANDLED_GUARD_REJECT==sub_res.second) || 
-                                            (HANDLED_GUARD_REJECT==res.second))?
-                                                HANDLED_GUARD_REJECT:sub_res.second;
-                     return std::make_pair(sub_res.first,handled);
+                     HandledEnum handled = ((HANDLED_GUARD_REJECT==sub_res) || 
+                                            (HANDLED_GUARD_REJECT==res))?
+                                                HANDLED_GUARD_REJECT:sub_res;
+                     return handled;
                  }
                  return res;
             }
         };
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(Fsm& fsm, int state, Event const& evt)
+        static HandledEnum execute(Fsm& fsm, int region_index, int state, Event const& evt)
         {
             // forward to helper
-            return execute_helper::template execute<Seq>(fsm,state,evt);
+            return execute_helper::template execute<Seq>(fsm,region_index,state,evt,
+                ::boost::mpl::bool_< ::boost::mpl::empty<Seq>::type::value>());
         }
     };
     // nullary metafunction whose only job is to prevent early evaluation of _1
@@ -138,7 +140,7 @@
             {}
         template <class State>
         typename ::boost::enable_if<typename has_state_delayed_event<State,Event>::type,void>::type
-        operator()(boost::msm::back::wrap<State> const&,boost::msm::back::dummy<0> = 0)
+        operator()(boost::msm::wrap<State> const&,boost::msm::back::dummy<0> = 0)
             {
             typedef typename create_stt<Fsm>::type stt; 
             BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
@@ -147,7 +149,7 @@
             }
         template <class State>
         typename ::boost::disable_if<typename has_state_delayed_event<State,Event>::type,void >::type
-        operator()(boost::msm::back::wrap<State> const&,boost::msm::back::dummy<0> = 0)
+        operator()(boost::msm::wrap<State> const&,boost::msm::back::dummy<0> = 0)
         {
             typedef typename create_stt<Fsm>::type stt; 
             BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
@@ -172,7 +174,7 @@
         // this event is an automatic one (not a real one, just one for use in event-less transitions)
         // Note this event cannot be used as deferred!
             template <class State>
-        void operator()(boost::msm::back::wrap<State> const&)
+        void operator()(boost::msm::wrap<State> const&)
             {
             typedef typename create_stt<Fsm>::type stt; 
             BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
@@ -190,7 +192,7 @@
     {
         // Initialize cells for no transition
             ::boost::mpl::for_each<typename generate_state_set<Stt>::type, 
-                               boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+                               boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                         (default_init_cell<Event>(this,entries));
 
         // build chaining rows for rows coming from the same state and the current event
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	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -166,6 +166,20 @@
         visitors                                                      m_state_visitors;
     };
 
+    template <class StateType,class Enable=void>
+    struct deferred_msg_queue_helper 
+    {
+    };
+    template <class StateType>
+    struct deferred_msg_queue_helper<StateType,
+        typename ::boost::enable_if< 
+            typename ::boost::msm::back::has_fsm_delayed_events<StateType>::type >::type> 
+    {
+    public:
+        deferred_msg_queue_helper():m_deferred_events_queue(){}
+        deferred_events_queue_t     m_deferred_events_queue;
+    };
+
  public: 
     // tags
     typedef int composite_tag;
@@ -302,7 +316,7 @@
             return false;
         }
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(library_sm& fsm, int state, Event const& evt)
+        static HandledEnum execute(library_sm& fsm, int region_index, int state, Event const& evt)
         {
 
             BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
@@ -312,12 +326,12 @@
             if (!::boost::is_same<T1,current_state_type>::value && 
                 !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
             {
-                return std::make_pair(current_state,HANDLED_FALSE);
+                return HANDLED_FALSE;
             }
             if (!check_guard(fsm,evt))
             {
                 // guard rejected the event, we stay in the current one
-                return std::make_pair(current_state,HANDLED_GUARD_REJECT);
+                return HANDLED_GUARD_REJECT;
             }
 
             // the guard condition has already been checked
@@ -332,7 +346,8 @@
             // and finally the entry method of the new current state
             convert_event_and_execute_entry<next_state_type,T2>
                 (::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),evt,fsm);
-            return std::make_pair(next_state,HANDLED_TRUE);
+            fsm.m_states[region_index]=next_state;
+            return HANDLED_TRUE;
         }
     };
 
@@ -376,7 +391,7 @@
             return false;
         }
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(library_sm& fsm, int state, Event const& evt)
+        static HandledEnum execute(library_sm& fsm, int region_index, int state, Event const& evt)
         {
             BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
             BOOST_STATIC_CONSTANT(int, next_state = (get_state_id<stt,next_state_type>::type::value));
@@ -385,12 +400,12 @@
             if (!::boost::is_same<T1,current_state_type>::value && 
                 !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
             {
-                return std::make_pair(current_state,HANDLED_FALSE);
+                return HANDLED_FALSE;
             }
             if (!check_guard(fsm,evt))
             {
                 // guard rejected the event, we stay in the current one
-                return std::make_pair(current_state,HANDLED_GUARD_REJECT);
+                return HANDLED_GUARD_REJECT;
             }
             // the guard condition has already been checked
             execute_exit<current_state_type>
@@ -400,7 +415,8 @@
             convert_event_and_execute_entry<next_state_type,T2>
                 (::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),evt,fsm);
 
-            return std::make_pair(next_state,HANDLED_TRUE);
+            fsm.m_states[region_index]=next_state;
+            return HANDLED_TRUE;
         }
     };
 
@@ -435,7 +451,7 @@
         >::type next_state_type;
 
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(library_sm& fsm, int state, Event const& evt)
+        static HandledEnum execute(library_sm& fsm, int region_index, int state, Event const& evt)
         {
             BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
             BOOST_STATIC_CONSTANT(int, next_state = (get_state_id<stt,next_state_type>::type::value));
@@ -445,7 +461,7 @@
             if (!::boost::is_same<T1,current_state_type>::value && 
                 !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
             {
-                return std::make_pair(current_state,HANDLED_FALSE);
+                return HANDLED_FALSE;
             }
             // no need to check the guard condition
             // first call the exit method of the current state
@@ -461,7 +477,8 @@
             convert_event_and_execute_entry<next_state_type,T2>
                 (::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),evt,fsm);
 
-            return std::make_pair(next_state,HANDLED_TRUE);
+            fsm.m_states[region_index]=next_state;
+            return HANDLED_TRUE;
         }
     };
 
@@ -496,7 +513,7 @@
         >::type next_state_type;
 
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(library_sm& fsm, int state, Event const& evt)
+        static HandledEnum execute(library_sm& fsm, int region_index, int state, Event const& evt)
         {
             BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
             BOOST_STATIC_CONSTANT(int, next_state = (get_state_id<stt,next_state_type>::type::value));
@@ -506,7 +523,7 @@
             if (!::boost::is_same<T1,current_state_type>::value && 
                 !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
             {
-                return std::make_pair(current_state,HANDLED_FALSE);
+                return HANDLED_FALSE;
             }
             // first call the exit method of the current state
             execute_exit<current_state_type>
@@ -516,7 +533,8 @@
             convert_event_and_execute_entry<next_state_type,T2>
                 (::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),evt,fsm);
 
-            return std::make_pair(next_state,HANDLED_TRUE);
+            fsm.m_states[region_index]=next_state;
+            return HANDLED_TRUE;
         }
     };
 
@@ -532,11 +550,12 @@
         typedef Evt                 Event;
 
         // Take the transition action and return the next state.
-        static std::pair<int,HandledEnum> execute(library_sm& fsm, int state, Event const& evt)
+        static HandledEnum execute(library_sm& fsm, int region_index, int , Event const& evt)
         {
              execute_return res = 
-                (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list)).process_event(evt);            
-             return std::make_pair(get_state_id<stt,T1>::type::value,res);
+                (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list)).process_event(evt); 
+             fsm.m_states[region_index]=get_state_id<stt,T1>::type::value;
+             return res;
         }
     };
     template <class Composite,class Event>
@@ -634,7 +653,7 @@
     {
         // call on_entry on this SM
         (static_cast<Derived*>(this))->on_entry(InitEvent(),*this);
-        ::boost::mpl::for_each<initial_states, boost::msm::back::wrap<mpl::placeholders::_1> >
+        ::boost::mpl::for_each<initial_states, boost::msm::wrap<mpl::placeholders::_1> >
             (call_init<InitEvent>(InitEvent(),this));
         // give a chance to handle an anonymous (eventless) transition
         handle_eventless_transitions_helper<library_sm> eventless_helper(this,true);
@@ -652,10 +671,12 @@
 
         HandledEnum ret_handled=HANDLED_FALSE;
         // if the state machine has terminate or interrupt flags, check them, otherwise skip
-        if (is_event_handling_blocked_helper<library_sm,Event>())
+        if (is_event_handling_blocked_helper<Event>
+                ( ::boost::mpl::bool_<has_fsm_blocking_states<library_sm>::type::value>() ) )
             return HANDLED_TRUE;
         // if a message queue is needed and processing is on the way
-        if (!do_pre_msg_queue_helper<library_sm,Event>(evt))
+        if (!do_pre_msg_queue_helper<Event>
+                (evt,::boost::mpl::bool_<is_no_message_queue<library_sm>::type::value>()) )
         {
             // wait for the end of current processing
             return HANDLED_TRUE;
@@ -668,7 +689,8 @@
             handle_defer_helper<library_sm> defer_helper(m_deferred_events_queue);
             defer_helper.do_pre_handle_deferred();
             // process event
-            HandledEnum handled = this->do_process_helper<library_sm,Event>(evt);
+            HandledEnum handled = this->do_process_helper<Event>
+                (evt,::boost::mpl::bool_<is_no_exception_thrown<library_sm>::type::value>());
             if (handled)
             {
                 ret_handled = HANDLED_TRUE;
@@ -678,7 +700,7 @@
 
             // now check if some events were generated in a transition and was not handled
             // because of another processing, and if yes, start handling them
-            do_post_msg_queue_helper<library_sm>();
+            do_post_msg_queue_helper(::boost::mpl::bool_<is_no_message_queue<library_sm>::type::value>());
 
             // event can be handled, processing
             // handle with lowest priority event-less transitions
@@ -702,7 +724,7 @@
         result_state(res),searched_id(id),self(self_) {}
 
         template <class StateType>
-        void operator()(boost::msm::back::wrap<StateType> const&)
+        void operator()(boost::msm::wrap<StateType> const&)
         {
             // look for the state id until found
             BOOST_STATIC_CONSTANT(int, id = (get_state_id<stt,StateType>::value));
@@ -722,7 +744,7 @@
     {
         const BaseState*  result_state=0;
         ::boost::mpl::for_each<state_list, 
-            ::boost::msm::back::wrap< ::boost::mpl::placeholders::_1> > (get_state_id_helper(id,&result_state,this));
+            ::boost::msm::wrap< ::boost::mpl::placeholders::_1> > (get_state_id_helper(id,&result_state,this));
         return result_state;
     }
     // true if the sm is used in another sm
@@ -800,7 +822,7 @@
 
          // History initializer function object, used with mpl::for_each
          template <class State>
-         void operator()(::boost::msm::back::wrap<State> const&)
+         void operator()(::boost::msm::wrap<State> const&)
          {
              m_initial_states[++m_index]=get_state_id<stt,State>::type::value;
          }
@@ -824,7 +846,7 @@
          ,m_substate_list()
      {
          // initialize our list of states with the ones defined in Derived::initial_state
-         ::boost::mpl::for_each< seq_initial_states, ::boost::msm::back::wrap<mpl::placeholders::_1> >
+         ::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
@@ -849,7 +871,7 @@
          ,m_visitors()                                                              \
          ,m_substate_list()                                                         \
      {                                                                              \
-         ::boost::mpl::for_each< seq_initial_states, ::boost::msm::back::wrap<mpl::placeholders::_1> > \
+         ::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);                                                         \
@@ -873,7 +895,7 @@
          ,m_visitors()                                                              \
          ,m_substate_list()                                                         \
      {                                                                              \
-         ::boost::mpl::for_each< seq_initial_states, ::boost::msm::back::wrap<mpl::placeholders::_1> > \
+         ::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);                                                         \
@@ -915,9 +937,8 @@
 
     // the following 2 functions handle the terminate/interrupt states handling
     // if one of these states is found, the first one is used
-    template <class StateType,class Event>
-    typename ::boost::enable_if<typename has_fsm_blocking_states<StateType>::type,bool >::type
-        is_event_handling_blocked_helper( ::boost::msm::back::dummy<0> = 0)
+    template <class Event>
+    bool is_event_handling_blocked_helper( ::boost::mpl::true_ const &)
     {
         // if the state machine is terminated, do not handle any event
         if (is_flag_active< ::boost::msm::TerminateFlag>())
@@ -930,24 +951,21 @@
         return false;
     }
     // otherwise simple handling, no flag => continue
-    template <class StateType,class Event>
-    typename ::boost::disable_if<typename has_fsm_blocking_states<StateType>::type,bool >::type
-        is_event_handling_blocked_helper( ::boost::msm::back::dummy<1> = 0)
+    template <class Event>
+    bool is_event_handling_blocked_helper( ::boost::mpl::false_ const &)
     {
         // no terminate/interrupt states detected
         return false;
     }
     // the following functions handle pre/post-process handling  of a message queue
     template <class StateType,class EventType>
-    typename ::boost::enable_if<typename is_no_message_queue<StateType>::type,bool >::type
-        do_pre_msg_queue_helper(EventType const& evt, ::boost::msm::back::dummy<0> = 0)
+    bool do_pre_msg_queue_helper(EventType const& evt, ::boost::mpl::true_ const &)
     {
         // no message queue needed
         return true;
     }
     template <class StateType,class EventType>
-    typename ::boost::disable_if<typename is_no_message_queue<StateType>::type,bool >::type
-        do_pre_msg_queue_helper(EventType const& evt, ::boost::msm::back::dummy<1> = 0)
+    bool do_pre_msg_queue_helper(EventType const& evt, ::boost::mpl::false_ const &)
     {
         execute_return (library_sm::*pf) (EventType const& evt) = 
             &library_sm::process_event; 
@@ -956,36 +974,30 @@
         {
             // event has to be put into the queue
             transition_fct f = ::boost::bind(pf,this,evt);
-            m_events_queue.push(f);
+            m_events_queue.m_events_queue.push(f);
             return false;
         }
         // event can be handled, processing
         m_event_processing = true;
         return true;
     }
-    template <class StateType>
-    typename ::boost::enable_if<typename is_no_message_queue<StateType>::type,void >::type
-        do_post_msg_queue_helper( ::boost::msm::back::dummy<0> = 0)
+    void do_post_msg_queue_helper( ::boost::mpl::true_ const &)
     {
         // no message queue needed
     }
-    template <class StateType>
-    typename ::boost::disable_if<typename is_no_message_queue<StateType>::type,void >::type
-        do_post_msg_queue_helper( ::boost::msm::back::dummy<1> = 0)
+    void do_post_msg_queue_helper( ::boost::mpl::false_ const &)
     {
         m_event_processing = false;
-        process_message_queue();
+        process_message_queue(this);
     }
     // the following 2 functions handle the processing either with a try/catch protection or without
     template <class StateType,class EventType>
-    typename ::boost::enable_if<typename is_no_exception_thrown<StateType>::type,HandledEnum >::type
-        do_process_helper(EventType const& evt, ::boost::msm::back::dummy<0> = 0)
+    HandledEnum do_process_helper(EventType const& evt, ::boost::mpl::true_ const &)
     {
         return this->do_process_event(evt);
     }
     template <class StateType,class EventType>
-    typename ::boost::disable_if<typename is_no_exception_thrown<StateType>::type,HandledEnum >::type
-        do_process_helper(EventType const& evt, ::boost::msm::back::dummy<1> = 0)
+    HandledEnum do_process_helper(EventType const& evt, ::boost::mpl::false_ const &)
     {
         try
         {
@@ -1003,7 +1015,7 @@
     template <class StateType, class Enable = void> 
     struct handle_defer_helper
     {
-        handle_defer_helper(deferred_events_queue_t& ){}
+        handle_defer_helper(deferred_msg_queue_helper<library_sm>& ){}
         void do_pre_handle_deferred()
         {
         }
@@ -1017,13 +1029,14 @@
     struct handle_defer_helper
         <StateType, typename enable_if< typename ::boost::msm::back::has_fsm_delayed_events<StateType>::type >::type>
     {
-        handle_defer_helper(deferred_events_queue_t& a_queue):events_queue(a_queue),next_deferred_event(){}
+        handle_defer_helper(deferred_msg_queue_helper<library_sm>& a_queue):
+            events_queue(a_queue),next_deferred_event(){}
         void do_pre_handle_deferred()
         {
-            if (!events_queue.empty())
+            if (!events_queue.m_deferred_events_queue.empty())
             {
-                next_deferred_event = events_queue.back();
-                events_queue.pop_back();
+                next_deferred_event = events_queue.m_deferred_events_queue.back();
+                events_queue.m_deferred_events_queue.pop_back();
             }
         }
 
@@ -1032,7 +1045,7 @@
             if (((handled & HANDLED_DEFERRED) == HANDLED_DEFERRED) && next_deferred_event )
             {
                 // the event was already deferred, no reason to process another deferred event
-                events_queue.push_back(next_deferred_event);
+                events_queue.m_deferred_events_queue.push_back(next_deferred_event);
                 return;
             }
             else if (next_deferred_event)
@@ -1042,8 +1055,8 @@
         }
 
     private:
-        deferred_events_queue_t&    events_queue;
-        deferred_fct                next_deferred_event;
+        deferred_msg_queue_helper<library_sm>&  events_queue;
+        deferred_fct                            next_deferred_event;
     };
 
     // handling of eventless transitions
@@ -1078,6 +1091,69 @@
         bool        handled;
     };
 
+    template <class StateType,class Enable=void>
+    struct region_processing_helper 
+    {
+    public:
+        region_processing_helper(library_sm* self_,HandledEnum& result_)
+            :self(self_),result(result_){}
+        template<class Event>
+        void process(Event const& evt)
+        {
+            // use this table as if it came directly from the user
+            typedef dispatch_table<library_sm,complete_table,Event> table;
+            HandledEnum res =
+                table::instance.entries[self->m_states[0]](
+                *self, 0, self->m_states[0], evt);
+            result = (HandledEnum)((int)result | (int)res);
+        }
+        library_sm*     self;
+        HandledEnum&    result;
+    };
+    // version with visitors
+    template <class StateType>
+    struct region_processing_helper<StateType,typename ::boost::enable_if< 
+                        ::boost::mpl::is_sequence<typename StateType::initial_state> >::type> 
+    {
+        private:
+        // process event in one region
+        template <class region_id,int Dummy=0>
+        struct In
+        {
+            template<class Event>
+            static void process(Event const& evt,library_sm* self_,HandledEnum& result_)
+            {
+                // use this table as if it came directly from the user
+                typedef dispatch_table<library_sm,complete_table,Event> table;
+                HandledEnum res =
+                    table::instance.entries[self_->m_states[region_id::value]](
+                    *self_, region_id::value , self_->m_states[region_id::value], evt);
+                result_ = (HandledEnum)((int)result_ | (int)res);
+                In< ::boost::mpl::int_<region_id::value+1> >::template process(evt,self_,result_);
+            }
+        };
+        template <int Dummy>
+        struct In< ::boost::mpl::int_<nr_regions::value>,Dummy>
+        {
+            // end of processing
+            template<class Event>
+            static void process(Event const& evt,library_sm*,HandledEnum&){}
+        };
+        public:
+        region_processing_helper(library_sm* self_,HandledEnum& result_)
+            :self(self_),result(result_){}
+        template<class Event>
+        void process(Event const& evt)
+        {
+            // use this table as if it came directly from the user
+            typedef dispatch_table<library_sm,complete_table,Event> table;
+            In< ::boost::mpl::int_<0> >::template process(evt,self,result);
+        }
+
+        library_sm*     self;
+        HandledEnum&    result;
+    };
+
     // minimum event processing without exceptions, queues, etc.
     template<class Event>
     HandledEnum do_process_event(Event const& evt)
@@ -1087,14 +1163,9 @@
 
         HandledEnum handled = HANDLED_FALSE;
         // dispatch the event to every region
-        for (int i=0; i<nr_regions::value;++i)
-        {	
-            std::pair<int,HandledEnum> res =
-                table::instance.entries[this->m_states[i]](
-                *this, this->m_states[i], evt);
-            this->m_states[i] = res.first;
-            handled = (HandledEnum)((int)handled | (int)res.second);
-        }
+        region_processing_helper<Derived> helper(this,handled);
+        helper.process(evt);
+
         // if the event has not been handled and we have orthogonal zones, then
         // generate an error on every active state 
         // for state machine states contained in other state machines, do not handle
@@ -1144,7 +1215,7 @@
                 call_init(Event const& an_event,library_sm* self_):
                 evt(an_event),self(self_){}
                 template <class State>
-		void operator()(boost::msm::back::wrap<State> const&)
+		void operator()(boost::msm::wrap<State> const&)
                 {
             execute_entry(::boost::fusion::at_key<State>(self->m_substate_list),evt,*self);
                 }
@@ -1195,25 +1266,13 @@
     private:
         // helper function, helps hiding the forward function for non-state machines states.
         template <class T>
-        typename ::boost::enable_if<
-            typename ::boost::mpl::and_<
-                    typename is_composite_state<T>::type,
-                    typename ::boost::mpl::not_<
-                            typename has_non_forwarding_flag<Flag>::type>::type >::type
-            ,void >::type
-            helper (flag_handler* an_entry,int offset,boost::msm::back::dummy<0> = 0 )
+        void helper (flag_handler* an_entry,int offset, ::boost::mpl::true_ const &  )
         {
             // composite => forward
             an_entry[offset] = &FlagHandler<T,Flag>::forward;
         }
         template <class T>
-        typename ::boost::disable_if<
-            typename ::boost::mpl::and_<
-                    typename is_composite_state<T>::type,
-                    typename ::boost::mpl::not_<
-                            typename has_non_forwarding_flag<Flag>::type>::type >::type
-            ,void >::type
-            helper (flag_handler* an_entry,int offset,boost::msm::back::dummy<1> = 0 )
+        void helper (flag_handler* an_entry,int offset, ::boost::mpl::false_ const &  )
         {
             // default no flag
             an_entry[offset] = &FlagHandler<T,Flag>::flag_false;
@@ -1228,7 +1287,7 @@
 
         // Flags initializer function object, used with mpl::for_each
         template <class StateType>
-        void operator()( ::boost::msm::back::wrap<StateType> const& )
+        void operator()( ::boost::msm::wrap<StateType> const& )
         {
             typedef typename StateType::flag_list flags;
             typedef typename ::boost::mpl::contains<flags,Flag >::type found;
@@ -1243,7 +1302,12 @@
             else
             {
                 // false or forward
-                helper<StateType>(entries,state_id);
+                typedef typename ::boost::mpl::and_<
+                            typename is_composite_state<StateType>::type,
+                            typename ::boost::mpl::not_<
+                                    typename has_non_forwarding_flag<Flag>::type>::type >::type composite_no_forward;
+
+                helper<StateType>(entries,state_id,::boost::mpl::bool_<composite_no_forward::type::value>());
             }
         }
     };
@@ -1255,7 +1319,7 @@
 
         static flag_handler flags_entries[max_state];
         // build a state list
-        ::boost::mpl::for_each<state_list, boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+        ::boost::mpl::for_each<state_list, boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                         (init_flags<Flag>(flags_entries));
         return flags_entries;	
     }
@@ -1369,20 +1433,19 @@
             this->new_state_helper<State>(),
             create_state_helper<State>::set_sm(self);
             // create a visitor callback
-            visitor_helper<State>(state_id,::boost::fusion::at_key<State>(self->m_substate_list));
+            visitor_helper(state_id,::boost::fusion::at_key<State>(self->m_substate_list),
+                           ::boost::mpl::bool_<has_accept_sig<State>::type::value>());
         }
     private:
         // support possible use of a visitor if accept_sig is defined
         template <class StateType>
-        typename ::boost::enable_if<typename has_accept_sig<StateType>::type,void >::type
-        visitor_helper(int id,StateType& astate,::boost::msm::back::dummy<0> = 0) const
+        void visitor_helper(int id,StateType& astate, ::boost::mpl::true_ const & ) const
         {
             visitor_args<StateType,StateType::accept_sig::args_number>::
                 template helper<StateType>(self,id,astate);
         }
         template <class StateType>
-        typename ::boost::disable_if<typename has_accept_sig<StateType>::type,void >::type
-            visitor_helper(int ,StateType& ,::boost::msm::back::dummy<1> = 0) const
+        void visitor_helper(int ,StateType& , ::boost::mpl::false_ const &) const
         {
             // nothing to do
         }
@@ -1397,7 +1460,7 @@
          copy_helper(library_sm* sm):
            m_sm(sm){}
          template <class StateType>
-         void operator()( ::boost::msm::back::wrap<StateType> const& )
+         void operator()( ::boost::msm::wrap<StateType> const& )
          {
             BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,StateType>::type::value));
             // possibly also set the visitor
@@ -1422,16 +1485,28 @@
 
          library_sm*	 m_sm;
      };
-
+     // helper to copy the active states attribute
+     template <class region_id,int Dummy=0>
+     struct region_copy_helper
+     {
+         static void do_copy(library_sm* self_,library_sm const& rhs)
+         {
+             self_->m_states[region_id::value] = rhs.m_states[region_id::value];
+             region_copy_helper< ::boost::mpl::int_<region_id::value+1> >::do_copy(self_,rhs);
+         }
+     };
+     template <int Dummy>
+     struct region_copy_helper< ::boost::mpl::int_<nr_regions::value>,Dummy>
+     {
+         // end of processing
+         static void do_copy(library_sm*,library_sm const& ){}
+     };
      // copy functions for deep copy (no need of a 2nd version for NoCopy as noncopyable handles it)
      void do_copy (library_sm const& rhs,
               ::boost::msm::back::dummy<0> = 0)
      {
          // deep copy simply assigns the data
-         for (int i=0; i<nr_regions::value;++i)
-         {
-             m_states[i] = rhs.m_states[i];
-         }
+         region_copy_helper< ::boost::mpl::int_<0> >::do_copy(this,rhs);
          m_events_queue = rhs.m_events_queue;
          m_deferred_events_queue = rhs.m_deferred_events_queue;
          m_history = rhs.m_history;
@@ -1440,7 +1515,7 @@
          m_substate_list = rhs.m_substate_list;
          // except for the states themselves, which get duplicated
 
-         ::boost::mpl::for_each<state_list, ::boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+         ::boost::mpl::for_each<state_list, ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                         (copy_helper(this));
      }
 
@@ -1475,7 +1550,7 @@
          }
          // iterates through all states to find the one to be activated
          template <class State>
-         void operator()( ::boost::msm::back::wrap<State> const&)
+         void operator()( ::boost::msm::wrap<State> const&)
          {
              entry_exit_helper<Event,is_entry>::template helper< ::boost::mpl::bool_<is_entry>,State >();
          }
@@ -1484,16 +1559,31 @@
          Event const&   evt;
          library_sm*    self;
      };
-     // start for states machines which are themselves embedded in other state machines (composites)
-	 template <class Event>
-     void start(Event const& incomingEvent)
+
+     // helper to start the fsm
+     template <class region_id,int Dummy=0>
+     struct region_start_helper
      {
-         for (int i=0; i<nr_regions::value;++i)
+         template<class Event>
+         static void do_start(library_sm* self_,Event const& incomingEvent)
          {
              //forward the event for handling by sub state machines
-             ::boost::mpl::for_each<state_list, ::boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
-                 (entry_exit_helper<Event,true>(m_states[i],incomingEvent,this));
+             ::boost::mpl::for_each<state_list, ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+                 (entry_exit_helper<Event,true>(self_->m_states[region_id::value],incomingEvent,self_));
          }
+     };
+     template <int Dummy>
+     struct region_start_helper< ::boost::mpl::int_<nr_regions::value>,Dummy>
+     {
+         // end of processing
+         template<class Event>
+         static void do_start(library_sm*,Event const& ){}
+     };
+     // start for states machines which are themselves embedded in other state machines (composites)
+	 template <class Event>
+     void start(Event const& incomingEvent)
+     {
+         region_start_helper< ::boost::mpl::int_<0> >::template do_start(this,incomingEvent);
      }
 
      // helper used to set the correct state as active state upon entry into a fsm
@@ -1546,7 +1636,7 @@
          {
              (static_cast<Derived*>(self))->on_entry(evt,*self);
              ::boost::mpl::for_each<typename EventType::active_state, 
-                                    ::boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+                                    ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                                                         (fork_helper<EventType>(self,evt));
              // set the correct zones, the others (if any) will be default/history initialized
              self->start(evt.m_event);
@@ -1578,7 +1668,7 @@
              fork_helper(library_sm* self_,EventType const& evt_):
                 helper_self(self_),helper_evt(evt_){}
              template <class StateType>
-             void operator()( ::boost::msm::back::wrap<StateType> const& )
+             void operator()( ::boost::msm::wrap<StateType> const& )
              {
                  int state_id = get_state_id<stt,StateType>::value;
                  BOOST_STATIC_ASSERT(StateType::zone_index >= 0);
@@ -1591,33 +1681,52 @@
          };
      };
 
+     // helper for entry
+     template <class region_id,int Dummy=0>
+     struct region_entry_exit_helper
+     {
+         template<class Event>
+         static void do_entry(library_sm* self_,Event const& incomingEvent)
+         {
+             self_->m_states[region_id::value] = 
+                 self_->m_history.history_entry(incomingEvent)[region_id::value];
+         }
+         template<class Event>
+         static void do_exit(library_sm* self_,Event const& incomingEvent)
+         {
+             ::boost::mpl::for_each<state_list, ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+                 (entry_exit_helper<Event,false>(self_->m_states[region_id::value],incomingEvent,self_));
+         }
+     };
+     template <int Dummy>
+     struct region_entry_exit_helper< ::boost::mpl::int_<nr_regions::value>,Dummy>
+     {
+         // end of processing
+         template<class Event>
+         static void do_entry(library_sm*,Event const& ){}
+         template<class Event>
+         static void do_exit(library_sm*,Event const& ){}
+     };
      // entry/exit for states machines which are themselves embedded in other state machines (composites)
          template <class Event>
      void do_entry(Event const& incomingEvent)
      {
         // by default we activate the history/init states, can be overwritten by direct_event_start_helper
-        for (int i=0; i<nr_regions::value;++i)
-        {
-            this->m_states[i] = m_history.history_entry(incomingEvent)[i];
-        }
+        region_entry_exit_helper< ::boost::mpl::int_<0> >::template do_entry(this,incomingEvent);
         // block immediate handling of events
         m_event_processing = true;
         // if the event is generating a direct entry/fork, set the current state(s) to the direct state(s)
         direct_event_start_helper(this)(incomingEvent);
         // handle messages which were generated and blocked in the init calls
         m_event_processing = false;
-        process_message_queue();
+        process_message_queue(this);
      }
          template <class Event>
      void do_exit(Event const& incomingEvent)
      {
-        for (int i=0; i<nr_regions::value;++i)
-        {
-            // first recursively exit the sub machines
-            // forward the event for handling by sub state machines
-            ::boost::mpl::for_each<state_list, ::boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
-                (entry_exit_helper<Event,false>(m_states[i],incomingEvent,this));
-        }
+        // first recursively exit the sub machines
+        // forward the event for handling by sub state machines
+        region_entry_exit_helper< ::boost::mpl::int_<0> >::template do_exit(this,incomingEvent);
         // then call our own exit
         (static_cast<Derived*>(this))->on_exit(incomingEvent,*this);
         // give the history a chance to handle this (or not).
@@ -1626,45 +1735,52 @@
 
     // no transition for event.
     template <class Event>
-    static std::pair<int,HandledEnum> call_no_transition(library_sm& , int state, Event const& )
+    static HandledEnum call_no_transition(library_sm& , int , int , Event const& )
     {
-        return std::make_pair(state,HANDLED_FALSE);
+        return HANDLED_FALSE;
     }
     // called for deferred events. Address set in the dispatch_table at init
     template <class Event>
-    static std::pair<int,HandledEnum> defer_transition(library_sm& fsm, int state, Event const& e)
+    static HandledEnum defer_transition(library_sm& fsm, int , int , Event const& e)
     {
         execute_return (library_sm::*pf) (Event const& evt)= &library_sm::process_event;
         Event temp (e);
         ::boost::function<execute_return () > f= ::boost::bind(pf, ::boost::ref(fsm),temp);
         fsm.post_deferred_event(f);
-        return std::make_pair(state,HANDLED_DEFERRED);
+        return HANDLED_DEFERRED;
     }
 
     // called for automatic events. Default address set in the dispatch_table at init
     // prevents no-transition detection for automatic events
     template <class Event>
-    static std::pair<int,HandledEnum> default_eventless_transition(library_sm& fsm, int state, Event const& e)
+    static HandledEnum default_eventless_transition(library_sm& fsm, int, int , Event const& e)
     {
-        return std::make_pair(state,HANDLED_FALSE);
+        return HANDLED_FALSE;
     }
 
     // puts a deferred event in the queue
     void post_deferred_event(deferred_fct& deferred)
     {
-        m_deferred_events_queue.push_front(deferred);
+        m_deferred_events_queue.m_deferred_events_queue.push_front(deferred);
     }
     // removes one event from the message queue and processes it
-    void process_message_queue()
+    template <class StateType>
+    typename ::boost::disable_if<typename is_no_message_queue<StateType>::type,void >::type
+    process_message_queue(StateType*)
     {
-        if (!m_events_queue.empty())
+        if (!m_events_queue.m_events_queue.empty())
         {
-            transition_fct to_call = m_events_queue.front();
-            m_events_queue.pop();
+            transition_fct to_call = m_events_queue.m_events_queue.front();
+            m_events_queue.m_events_queue.pop();
             to_call();
         }
     }
-
+    template <class StateType>
+    typename ::boost::enable_if<typename is_no_message_queue<StateType>::type,void >::type
+        process_message_queue(StateType*)
+    {
+        // nothing to process
+    }
     // calls the entry/exit or on_entry/on_exit depending on the state type
     // (avoids calling virtually)
     // variant for FSMs
@@ -1753,20 +1869,32 @@
 
 
 private:
+    template <class StateType,class Enable=void>
+    struct msg_queue_helper 
+    {
+    public:
+        msg_queue_helper():m_events_queue(){}
+        events_queue_t              m_events_queue;
+    };
+    template <class StateType>
+    struct msg_queue_helper<StateType,
+        typename ::boost::enable_if<typename is_no_message_queue<StateType>::type >::type> 
+    {
+    };
+
     template <class Fsm,class Stt, class Event>
     friend struct dispatch_table;
 
     // data members
-    int                         m_states[nr_regions::value];
-    events_queue_t              m_events_queue;
-    deferred_events_queue_t     m_deferred_events_queue;
-    concrete_history            m_history;
-    bool                        m_event_processing;
-    bool                        m_is_included;
-    visitor_fct_helper<BaseState>
-                                m_visitors;
-
-    substate_list               m_substate_list;
+    int                             m_states[nr_regions::value];
+    msg_queue_helper<library_sm>    m_events_queue;
+    deferred_msg_queue_helper
+        <library_sm>                m_deferred_events_queue;
+    concrete_history                m_history;
+    bool                            m_event_processing;
+    bool                            m_is_included;
+    visitor_fct_helper<BaseState>   m_visitors;
+    substate_list                   m_substate_list;
 
 
 };
Modified: sandbox/msm/boost/msm/back/tools.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/tools.hpp	(original)
+++ sandbox/msm/boost/msm/back/tools.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -28,7 +28,7 @@
 {
     fill_state_names(char const** names):m_names(names){}
     template <class StateType>
-    void operator()(boost::msm::back::wrap<StateType> const&)
+    void operator()(boost::msm::wrap<StateType> const&)
     {
         m_names[get_state_id<stt,StateType>::value]= typeid(StateType).name();
     }
@@ -42,7 +42,7 @@
 {
     get_state_name(std::string& name_to_fill, int state_id):m_name(name_to_fill),m_state_id(state_id){}
     template <class StateType>
-    void operator()(boost::msm::back::wrap<StateType> const&)
+    void operator()(boost::msm::wrap<StateType> const&)
     {
         if (get_state_id<stt,StateType>::value == m_state_id)
         {
@@ -58,7 +58,7 @@
 struct display_type 
 {
     template <class Type>
-    void operator()(boost::msm::back::wrap<Type> const&)
+    void operator()(boost::msm::wrap<Type> const&)
     {
         std::cout << typeid(Type).name() << std::endl;
     }
Added: sandbox/msm/boost/msm/common.hpp
==============================================================================
--- (empty file)
+++ sandbox/msm/boost/msm/common.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -0,0 +1,25 @@
+// Copyright 2008 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MSM_COMMON_H
+#define BOOST_MSM_COMMON_H
+
+
+
+namespace boost { namespace msm
+{
+// wrapper for mpl::for_each as showed in the C++ Template Metaprogramming ch. 9
+template <class T>
+struct wrap{};
+
+
+} } // boost::msm
+#endif //BOOST_MSM_COMMON_H
+
Modified: sandbox/msm/boost/msm/front/euml/common.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/euml/common.hpp	(original)
+++ sandbox/msm/boost/msm/front/euml/common.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -11,6 +11,8 @@
 #ifndef BOOST_MSM_FRONT_EUML_COMMON_H
 #define BOOST_MSM_FRONT_EUML_COMMON_H
 
+#include <boost/config.hpp>
+
 #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
 #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
 #endif
Modified: sandbox/msm/boost/msm/front/euml/operator.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/euml/operator.hpp	(original)
+++ sandbox/msm/boost/msm/front/euml/operator.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -18,6 +18,7 @@
 #include <boost/mpl/has_key.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/set.hpp>
+#include <boost/type_traits.hpp>
 
 BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
 BOOST_MPL_HAS_XXX_TRAIT_DEF(key_type)
Modified: sandbox/msm/boost/msm/front/euml/state_grammar.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/euml/state_grammar.hpp	(original)
+++ sandbox/msm/boost/msm/front/euml/state_grammar.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -615,6 +615,7 @@
  {};
 
 template <class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -640,6 +641,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class Configure>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -664,6 +666,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -684,6 +687,7 @@
 }
 
 template <class Expr1,class Expr2>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -702,6 +706,7 @@
 }
 
 template <class Expr1>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -714,6 +719,7 @@
         typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
         return func_state<entry_action,NoAction>();
 }
+inline
 func_state<
 NoAction,
 NoAction
@@ -785,6 +791,7 @@
 };
 
 template <class STT,class Init>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type
@@ -796,6 +803,7 @@
 }
 
 template <class STT,class Init,class Expr1>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -812,6 +820,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -833,6 +842,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2,class Attr>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -856,6 +866,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2,class Attr,class Configure>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -887,6 +898,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -922,6 +934,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -962,6 +975,7 @@
 }
 
 template <class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4,class BASE>
+inline
 func_state_machine<
 STT,
 typename boost::result_of<BuildInit(Init)>::type,
@@ -1003,6 +1017,7 @@
 }
 
 template <class Expr>
+inline
 inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type>
 build_attributes (Expr const&)
 {
@@ -1010,6 +1025,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1038,6 +1054,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class Configure>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1066,6 +1083,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1087,6 +1105,7 @@
 }
 
 template <class Expr1,class Expr2>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1108,6 +1127,7 @@
 }
 
 template <class Expr1>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1122,6 +1142,7 @@
         typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
         return func_state<entry_action,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
 }
+inline
 func_state<
 NoAction,
 NoAction,
@@ -1134,6 +1155,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class Configure,class BASE,class EndInterruptEvent>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1168,6 +1190,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class Configure,class EndInterruptEvent>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1203,6 +1226,7 @@
 }
 
 template <class Expr1,class Expr2,class Attr,class EndInterruptEvent>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1225,6 +1249,7 @@
 }
 
 template <class Expr1,class Expr2,class EndInterruptEvent>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1247,6 +1272,7 @@
 }
 
 template <class Expr1,class EndInterruptEvent>
+inline
 func_state<
 typename ::boost::mpl::eval_if<
     typename proto::matches<Expr1,BuildActionSequence>::type,
@@ -1264,6 +1290,7 @@
 }
 
 template <class EndInterruptEvent>
+inline
 func_state<
 NoAction,
 NoAction,
@@ -1277,6 +1304,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
 entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1303,6 +1331,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
+inline
 entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1328,6 +1357,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr>
+inline
 entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1349,6 +1379,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2>
+inline
 entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1368,6 +1399,7 @@
 }
 
 template <int ZoneIndex,class Expr1>
+inline
 entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1383,6 +1415,7 @@
 }
 
 template <int ZoneIndex>
+inline
 entry_func_state<
 ZoneIndex,
 NoAction,
@@ -1394,6 +1427,7 @@
 }
 
 template <class Event,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
 exit_func_state<
 Event,
 typename ::boost::mpl::eval_if<
@@ -1420,6 +1454,7 @@
 }
 
 template <class Event,class Expr1,class Expr2,class Attr,class Configure>
+inline
 exit_func_state<
 Event,
 typename ::boost::mpl::eval_if<
@@ -1445,6 +1480,7 @@
 }
 
 template <class Event,class Expr1,class Expr2,class Attr>
+inline
 exit_func_state<
 Event,
 typename ::boost::mpl::eval_if<
@@ -1466,6 +1502,7 @@
 }
 
 template <class Event,class Expr1,class Expr2>
+inline
 exit_func_state<
 Event,
 typename ::boost::mpl::eval_if<
@@ -1485,6 +1522,7 @@
 }
 
 template <class Event,class Expr1>
+inline
 exit_func_state<
 Event,
 typename ::boost::mpl::eval_if<
@@ -1500,6 +1538,7 @@
 }
 
 template <class Event>
+inline
 exit_func_state<
 Event,
 NoAction,
@@ -1511,6 +1550,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1537,6 +1577,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1562,6 +1603,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2,class Attr>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1583,6 +1625,7 @@
 }
 
 template <int ZoneIndex,class Expr1,class Expr2>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1602,6 +1645,7 @@
 }
 
 template <int ZoneIndex,class Expr1>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 typename ::boost::mpl::eval_if<
@@ -1617,6 +1661,7 @@
 }
 
 template <int ZoneIndex>
+inline
 explicit_entry_func_state<
 ZoneIndex,
 NoAction,
Modified: sandbox/msm/boost/msm/front/functor_row.hpp
==============================================================================
--- sandbox/msm/boost/msm/front/functor_row.hpp	(original)
+++ sandbox/msm/boost/msm/front/functor_row.hpp	2009-12-18 17:27:59 EST (Fri, 18 Dec 2009)
@@ -16,6 +16,8 @@
 
 #include <boost/typeof/typeof.hpp>
 
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/common.hpp>
 #include <boost/msm/front/automatic_event.hpp>
 
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
@@ -120,7 +122,7 @@
             Call(EVT const& evt,FSM& fsm,STATE& state):
         evt_(evt),fsm_(fsm),state_(state){}
         template <class FCT>
-        void operator()(::boost::msm::back::wrap<FCT> const& )
+        void operator()(::boost::msm::wrap<FCT> const& )
         {
             FCT()(evt_,fsm_,state_);
         }
@@ -140,7 +142,7 @@
             Call2(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt):
         evt_(evt),fsm_(fsm),src_(src),tgt_(tgt){}
         template <class FCT>
-        void operator()(::boost::msm::back::wrap<FCT> const& )
+        void operator()(::boost::msm::wrap<FCT> const& )
         {
             FCT()(evt_,fsm_,src_,tgt_);
         }
@@ -156,13 +158,13 @@
         template <class EVT,class FSM,class STATE>
         void operator()(EVT const& evt,FSM& fsm,STATE& state)
         {
-            mpl::for_each<Sequence,boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+            mpl::for_each<Sequence,boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                 (Call<EVT,FSM,STATE>(evt,fsm,state));
         }
         template <class EVT,class FSM,class SourceState,class TargetState>
         void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)
         {
-            mpl::for_each<Sequence,boost::msm::back::wrap< ::boost::mpl::placeholders::_1> >
+            mpl::for_each<Sequence,boost::msm::wrap< ::boost::mpl::placeholders::_1> >
                 (Call2<EVT,FSM,SourceState,TargetState>(evt,fsm,src,tgt));
         }
     };