Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71680 - in branches/msm/msm_phoenix: . boost boost/msm boost/msm/back boost/msm/front boost/msm/front/detail boost/msm/front/euml boost/msm/mpl_graph boost/msm/mpl_graph/detail libs libs/example
From: christophe.j.henry_at_[hidden]
Date: 2011-05-02 17:48:42


Author: chenry
Date: 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
New Revision: 71680
URL: http://svn.boost.org/trac/boost/changeset/71680

Log:
first test using phoenix to write eUML actions/guards
Added:
   branches/msm/msm_phoenix/
   branches/msm/msm_phoenix/boost/
   branches/msm/msm_phoenix/boost/msm/
   branches/msm/msm_phoenix/boost/msm/back/
   branches/msm/msm_phoenix/boost/msm/back/any_event.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/args.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/bind_helpers.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/common_types.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/copy_policies.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/default_compile_policy.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/dispatch_table.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/favor_compile_time.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/fold_to_list.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/history_policies.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/metafunctions.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/mpl_graph_fsm_check.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/no_fsm_check.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/queue_container_circular.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/queue_container_deque.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/state_machine.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/back/tools.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/common.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/
   branches/msm/msm_phoenix/boost/msm/front/common_states.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/completion_event.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/detail/
   branches/msm/msm_phoenix/boost/msm/front/detail/common_states.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/detail/row2_helper.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/
   branches/msm/msm_phoenix/boost/msm/front/euml/algorithm.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/common.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/container.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/euml.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/euml_typeof.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/guard_grammar.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/iteration.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/operator.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/querying.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/state_grammar.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/stl.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/stt_grammar.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/euml/transformation.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/functor_row.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/internal_row.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/row2.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/state_machine_def.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/front/states.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/
   branches/msm/msm_phoenix/boost/msm/mpl_graph/adjacency_list_graph.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/breadth_first_search.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/depth_first_search.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/
   branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/as_mpl_map.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/incidence_list_graph.ipp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/incidence_list_graph.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_graph.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_utils.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/mpl_graph/search_colors.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/proto_config.hpp (contents, props changed)
   branches/msm/msm_phoenix/boost/msm/row_tags.hpp (contents, props changed)
   branches/msm/msm_phoenix/libs/
   branches/msm/msm_phoenix/libs/example/
   branches/msm/msm_phoenix/libs/example/SimplePhoenix.cpp (contents, props changed)

Added: branches/msm/msm_phoenix/boost/msm/back/any_event.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/any_event.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,54 @@
+// 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_BACK_ANY_EVENT_H
+#define BOOST_MSM_BACK_ANY_EVENT_H
+
+#include <boost/smart_ptr/scoped_ptr.hpp>
+#include <boost/msm/back/common_types.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+class placeholder
+{
+public:
+ virtual ::boost::msm::back::HandledEnum process_event() const =0;
+};
+template<class EventType,class FsmType>
+class holder : public placeholder
+{
+public:
+ holder(EventType const& evt, FsmType& fsm){}
+ virtual ::boost::msm::back::HandledEnum process_event() const
+ {
+ //default. Will not be called
+ return HANDLED_TRUE;
+ }
+private:
+};
+
+class any_event
+{
+public:
+ template <class EventType,class FsmType>
+ any_event(EventType const& evt,FsmType& fsm):content_(new holder<EventType,FsmType>(evt,fsm)){}
+ ::boost::msm::back::HandledEnum process_event() const
+ {
+ return content_->process_event();
+ }
+private:
+
+ ::boost::scoped_ptr<placeholder> content_;
+};
+
+}}}
+
+#endif //BOOST_MSM_BACK_ANY_EVENT_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/args.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/args.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,68 @@
+// 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_BACK_ARGS_H
+#define BOOST_MSM_BACK_ARGS_H
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/punctuation/comma.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/function.hpp>
+
+#ifndef BOOST_MSM_VISITOR_ARG_SIZE
+#define BOOST_MSM_VISITOR_ARG_SIZE 2 // default max number of arguments
+#endif
+
+namespace boost { namespace msm { namespace back
+{
+struct none {};
+#define MSM_ARGS_TYPEDEF_SUB(z, n, unused) typedef ARG ## n argument ## n ;
+#define MSM_ARGS_PRINT(z, n, data) data
+#define MSM_ARGS_NONE_PRINT(z, n, data) class data ## n = none \
+ BOOST_PP_COMMA_IF( BOOST_PP_LESS(n, BOOST_PP_DEC(BOOST_MSM_VISITOR_ARG_SIZE) ) )
+
+#define MSM_VISITOR_MAIN_ARGS(n) \
+ template <class RES, \
+ BOOST_PP_REPEAT(BOOST_MSM_VISITOR_ARG_SIZE, MSM_ARGS_NONE_PRINT, ARG)> \
+ struct args \
+ { \
+ typedef ::boost::function<RES(BOOST_PP_ENUM_PARAMS(n, ARG))> type; \
+ enum {args_number=n}; \
+ BOOST_PP_REPEAT(n, MSM_ARGS_TYPEDEF_SUB, ~ ) \
+ };
+
+#define MSM_VISITOR_ARGS(z, n, unused) \
+ template <class RES BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ struct args<RES, \
+ BOOST_PP_ENUM_PARAMS(n,ARG) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM(BOOST_PP_SUB(BOOST_MSM_VISITOR_ARG_SIZE,n), MSM_ARGS_PRINT, none) \
+ > \
+ { \
+ typedef ::boost::function<RES(BOOST_PP_ENUM_PARAMS(n, ARG))> type; \
+ enum {args_number=n}; \
+ BOOST_PP_REPEAT(n, MSM_ARGS_TYPEDEF_SUB, ~ ) \
+ };
+MSM_VISITOR_MAIN_ARGS(BOOST_MSM_VISITOR_ARG_SIZE)
+BOOST_PP_REPEAT(BOOST_MSM_VISITOR_ARG_SIZE, MSM_VISITOR_ARGS, ~)
+
+#undef MSM_VISITOR_ARGS
+#undef MSM_ARGS_PRINT
+
+}}}
+
+#endif //BOOST_MSM_BACK_ARGS_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/bind_helpers.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/bind_helpers.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,41 @@
+// 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_BACK_BIND_HELPERS_H
+#define BOOST_MSM_BACK_BIND_HELPERS_H
+
+#include <functional>
+
+namespace boost { namespace msm { namespace back
+{
+ // helper to replace std::plus as the lack of implicit conversion makes it not usable in one of our bind
+ template<class _Ty,class _Tz>
+ struct plus2
+ : public std::binary_function<_Ty, _Tz, _Ty>
+ {
+ // functor for operator+
+ _Ty operator()( _Ty _Left, _Tz _Right) const
+ {
+ // apply operator+ to operands
+ return (_Left + _Right);
+ }
+ };
+ // helper to dereference a pointer to a function pointer
+ template <class T>
+ struct deref
+ {
+ typedef T& result_type;
+ T& operator()(T* f) const
+ {
+ return *f;
+ }
+ };
+} } }//boost::msm::back
+#endif //BOOST_MSM_BACK_BIND_HELPERS_H

Added: branches/msm/msm_phoenix/boost/msm/back/common_types.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/common_types.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,35 @@
+// 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_TYPES_H
+#define BOOST_MSM_COMMON_TYPES_H
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/msm/common.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+// used for disable_if
+template <int> struct dummy { dummy(int) {} };
+// return value for transition handling
+typedef enum
+{
+ HANDLED_FALSE=0,
+ HANDLED_TRUE =1,
+ HANDLED_GUARD_REJECT=2,
+ HANDLED_DEFERRED=4
+} HandledEnum;
+
+typedef HandledEnum execute_return;
+
+}}}
+
+#endif //BOOST_MSM_COMMON_TYPES_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/copy_policies.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/copy_policies.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,30 @@
+// 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_BACK_COPY_POLICIES_H
+#define BOOST_MSM_BACK_COPY_POLICIES_H
+
+#include <boost/noncopyable.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+ // deactivates copy
+ struct NoCopy : ::boost::noncopyable
+ {
+ };
+
+ // allows deep copy
+ struct DeepCopy
+ {
+ };
+} } }//boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_COPY_POLICIES_H

Added: branches/msm/msm_phoenix/boost/msm/back/default_compile_policy.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/default_compile_policy.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -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_BACK_DEFAULT_COMPILE_POLICY_HPP
+#define BOOST_MSM_BACK_DEFAULT_COMPILE_POLICY_HPP
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+struct favor_runtime_speed
+{
+ typedef int compile_policy;
+ typedef ::boost::mpl::true_ add_forwarding_rows;
+};
+
+}}}// boost::msm::back
+#endif // BOOST_MSM_BACK_DEFAULT_COMPILE_POLICY_HPP

Added: branches/msm/msm_phoenix/boost/msm/back/dispatch_table.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/dispatch_table.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,274 @@
+// 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_BACK_DISPATCH_TABLE_H
+#define BOOST_MSM_BACK_DISPATCH_TABLE_H
+
+#include <utility>
+
+#include <boost/mpl/reverse_fold.hpp>
+#include <boost/mpl/greater.hpp>
+#include <boost/mpl/filter_view.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+
+#include <boost/msm/back/metafunctions.hpp>
+#include <boost/msm/back/common_types.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+
+// Generates a singleton runtime lookup table that maps current state
+// to a function that makes the SM take its transition on the given
+// Event type.
+template <class Fsm,class Stt, class Event,class CompilePolicy>
+struct dispatch_table
+{
+ private:
+ // This is a table of these function pointers.
+ 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
+ // (like an UML diamond). Allows transition conflicts.
+ template< typename Seq,typename AnEvent,typename State >
+ struct chain_row
+ {
+ typedef State current_state_type;
+ typedef AnEvent transition_event;
+
+ // helper for building a disable/enable_if-controlled execute function
+ struct execute_helper
+ {
+ template <class Sequence>
+ static
+ 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 HANDLED_FALSE;
+ }
+
+ template <class Sequence>
+ static
+ 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;
+ HandledEnum res = first_row::execute(fsm,region_index,state,evt);
+ if (HANDLED_TRUE!=res)
+ {
+ // if the first rejected, move on to the next one
+ 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
+ if ((HANDLED_FALSE==sub_res) && (HANDLED_GUARD_REJECT==res) )
+ return HANDLED_GUARD_REJECT;
+ else
+ return sub_res;
+ }
+ return res;
+ }
+ };
+ // Take the transition action and return the next state.
+ static HandledEnum execute(Fsm& fsm, int region_index, int state, Event const& evt)
+ {
+ // forward to helper
+ 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
+ template< typename Entry >
+ struct make_chain_row_from_map_entry
+ {
+ typedef chain_row<typename Entry::second,Event,
+ typename Entry::first > type;
+ };
+ // Compute the maximum state value in the sm so we know how big
+ // to make the table
+ typedef typename generate_state_set<Stt>::type state_list;
+ BOOST_STATIC_CONSTANT(int, max_state = ( ::boost::mpl::size<state_list>::value));
+
+ // A function object for use with mpl::for_each that stuffs
+ // transitions into cells.
+ struct init_cell
+ {
+ init_cell(dispatch_table* self_)
+ : self(self_)
+ {}
+ // version for transition event not base of our event
+ template <class Transition>
+ void init_event_base_case(Transition const&, ::boost::mpl::true_ const &) const
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id =
+ (get_state_id<stt,typename Transition::current_state_type>::value));
+ self->entries[state_id] = reinterpret_cast<cell>(&Transition::execute);
+ }
+ // version for transition event base of our event
+ template <class Transition>
+ void init_event_base_case(Transition const&, ::boost::mpl::false_ const &) const
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id =
+ (get_state_id<stt,typename Transition::current_state_type>::value));
+ self->entries[state_id] = &Transition::execute;
+ }
+ // Cell initializer function object, used with mpl::for_each
+ template <class Transition>
+ typename ::boost::enable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+ operator()(Transition const&,boost::msm::back::dummy<0> = 0) const
+ {
+ // version for not real rows. No problem because irrelevant for process_event
+ }
+ template <class Transition>
+ typename ::boost::disable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+ operator()(Transition const& tr,boost::msm::back::dummy<1> = 0) const
+ {
+ //only if the transition event is a base of our event is the reinterpret_case safe
+ init_event_base_case(tr,
+ ::boost::mpl::bool_<
+ ::boost::is_base_of<typename Transition::transition_event,Event>::type::value>() );
+ }
+
+ dispatch_table* self;
+ };
+
+ // Cell default-initializer function object, used with mpl::for_each
+ // initializes with call_no_transition, defer_transition or default_eventless_transition
+ // variant for non-anonymous transitions
+ template <class EventType,class Enable=void>
+ struct default_init_cell
+ {
+ default_init_cell(dispatch_table* self_,cell* tofill_entries_)
+ : self(self_),tofill_entries(tofill_entries_)
+ {}
+ template <class State>
+ typename ::boost::enable_if<typename has_state_delayed_event<State,Event>::type,void>::type
+ 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));
+ cell call_no_transition = &Fsm::defer_transition;
+ tofill_entries[state_id] = call_no_transition;
+ }
+ template <class State>
+ typename ::boost::disable_if<typename has_state_delayed_event<State,Event>::type,void >::type
+ operator()(boost::msm::wrap<State> const&,boost::msm::back::dummy<1> = 0)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::call_no_transition;
+ tofill_entries[state_id] = call_no_transition;
+ }
+
+ dispatch_table* self;
+ cell* tofill_entries;
+ };
+
+ // variant for anonymous transitions
+ template <class EventType>
+ struct default_init_cell<EventType,
+ typename ::boost::enable_if<
+ typename is_completion_event<EventType>::type>::type>
+ {
+ default_init_cell(dispatch_table* self_,cell* tofill_entries_)
+ : self(self_),tofill_entries(tofill_entries_)
+ {}
+
+ // this event is a compound 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::wrap<State> const&)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::default_eventless_transition;
+ tofill_entries[state_id] = call_no_transition;
+ }
+
+ dispatch_table* self;
+ cell* tofill_entries;
+ };
+
+ public:
+ // initialize the dispatch table for a given Event and Fsm
+ dispatch_table()
+ {
+ // Initialize cells for no transition
+ ::boost::mpl::for_each<typename generate_state_set<Stt>::type,
+ 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
+ // first we build a map of sequence for every source
+ // in reverse order so that the frow's are handled first (UML priority)
+ typedef typename ::boost::mpl::reverse_fold<
+ // filter on event
+ ::boost::mpl::filter_view
+ <Stt, ::boost::is_base_of<transition_event< ::boost::mpl::placeholders::_>, Event> >,
+ // build a map
+ ::boost::mpl::map<>,
+ ::boost::mpl::if_<
+ // if we already have a row on this source state
+ ::boost::mpl::has_key< ::boost::mpl::placeholders::_1,
+ transition_source_type< ::boost::mpl::placeholders::_2> >,
+ // insert a new element in the value type
+ ::boost::mpl::insert<
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::pair<transition_source_type< ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::push_back<
+ ::boost::mpl::at< ::boost::mpl::placeholders::_1,
+ transition_source_type< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::placeholders::_2 >
+ > >,
+ // first row on this source state, make a vector with 1 element
+ ::boost::mpl::insert<
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::pair<transition_source_type< ::boost::mpl::placeholders::_2>,
+ make_vector< ::boost::mpl::placeholders::_2> > >
+ >
+ >::type map_of_row_seq;
+ // and then build chaining rows for all source states having more than 1 row
+ typedef typename ::boost::mpl::fold<
+ map_of_row_seq,::boost::mpl::vector0<>,
+ ::boost::mpl::if_<
+ ::boost::mpl::greater< ::boost::mpl::size<
+ ::boost::mpl::second< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::int_<1> >,
+ // we need row chaining
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ make_chain_row_from_map_entry< ::boost::mpl::placeholders::_2> >,
+ // just one row, no chaining, we rebuild the row like it was before
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ get_first_element_pair_second< ::boost::mpl::placeholders::_2> >
+ > >::type chained_rows;
+ // Go back and fill in cells for matching transitions.
+ ::boost::mpl::for_each<chained_rows>(init_cell(this));
+ }
+
+ // The singleton instance.
+ static const dispatch_table instance;
+
+ public: // data members
+ cell entries[max_state];
+};
+
+}}} // boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_DISPATCH_TABLE_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/favor_compile_time.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/favor_compile_time.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,264 @@
+// 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_BACK_FAVOR_COMPILE_TIME_H
+#define BOOST_MSM_BACK_FAVOR_COMPILE_TIME_H
+
+#include <utility>
+#include <deque>
+
+#include <boost/mpl/filter_view.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/msm/common.hpp>
+#include <boost/msm/back/metafunctions.hpp>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/back/dispatch_table.hpp>
+#include <boost/msm/back/any_event.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+
+#define BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(fsmname) \
+ namespace boost { namespace msm { namespace back{ \
+ template<class EventType> \
+ class holder<EventType,fsmname> : public placeholder \
+ { \
+ public: \
+ holder(EventType const& evt, fsmname& fsm): event_(evt),fsm_(fsm){} \
+ virtual ::boost::msm::back::HandledEnum process_event() const \
+ {return fsm_.process_event(event_);} \
+ private: \
+ EventType const& event_; \
+ fsmname& fsm_; \
+ }; \
+ template<> \
+ ::boost::msm::back::HandledEnum fsmname::process_any_event( any_event const& evt)const \
+ { \
+ return evt.process_event(); \
+ } \
+ }}}
+
+struct favor_compile_time
+{
+ typedef int compile_policy;
+ typedef ::boost::mpl::false_ add_forwarding_rows;
+};
+
+// Generates a singleton runtime lookup table that maps current state
+// to a function that makes the SM take its transition on the given
+// Event type.
+template <class Fsm,class Stt, class Event>
+struct dispatch_table < Fsm, Stt, Event, ::boost::msm::back::favor_compile_time>
+{
+ private:
+ // This is a table of these function pointers.
+ typedef HandledEnum (*cell)(Fsm&, int,int,Event const&);
+ typedef bool (*guard)(Fsm&, Event const&);
+
+ // Compute the maximum state value in the sm so we know how big
+ // to make the table
+ typedef typename generate_state_set<Stt>::type state_list;
+ BOOST_STATIC_CONSTANT(int, max_state = ( ::boost::mpl::size<state_list>::value));
+
+ struct chain_row
+ {
+ HandledEnum operator()(Fsm& fsm, int region,int state,Event const& evt) const
+ {
+ HandledEnum res = HANDLED_FALSE;
+ typename std::deque<cell>::const_iterator it = one_state.begin();
+ while (it != one_state.end() && res != HANDLED_TRUE)
+ {
+ HandledEnum handled = (*it)(fsm,region,state,evt);
+ // reject is considered as erasing an error (HANDLED_FALSE)
+ if ((HANDLED_FALSE==handled) && (HANDLED_GUARD_REJECT==res) )
+ res = HANDLED_GUARD_REJECT;
+ else
+ res = handled;
+ ++it;
+ }
+ return res;
+ }
+ std::deque<cell> one_state;
+ };
+ template <class TransitionState>
+ static HandledEnum call_submachine(Fsm& fsm, int region, int state, Event const& evt)
+ {
+ return (fsm.template get_state<TransitionState&>()).process_any_event
+ ( any_event(evt,fsm.template get_state<TransitionState&>()) );
+ }
+ // A function object for use with mpl::for_each that stuffs
+ // transitions into cells.
+ struct init_cell
+ {
+ init_cell(dispatch_table* self_)
+ : self(self_)
+ {}
+ // version for transition event not base of our event
+ template <class Transition>
+ void init_event_base_case(Transition const&, ::boost::mpl::true_ const &) const
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id =
+ (get_state_id<stt,typename Transition::current_state_type>::value));
+ self->entries[state_id].one_state.push_front(reinterpret_cast<cell>(&Transition::execute));
+ }
+ // version for transition event base of our event
+ template <class Transition>
+ void init_event_base_case(Transition const&, ::boost::mpl::false_ const &) const
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id =
+ (get_state_id<stt,typename Transition::current_state_type>::value));
+ self->entries[state_id].one_state.push_front(&Transition::execute);
+ }
+ // Cell initializer function object, used with mpl::for_each
+ template <class Transition>
+ typename ::boost::enable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+ operator()(Transition const&,boost::msm::back::dummy<0> = 0) const
+ {
+ // version for not real rows. No problem because irrelevant for process_event
+ }
+ template <class Transition>
+ typename ::boost::disable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+ operator()(Transition const& tr,boost::msm::back::dummy<1> = 0) const
+ {
+ //only if the transition event is a base of our event is the reinterpret_case safe
+ init_event_base_case(tr,
+ ::boost::mpl::bool_<
+ ::boost::is_base_of<typename Transition::transition_event,Event>::type::value>() );
+ }
+
+ dispatch_table* self;
+ };
+
+ // Cell default-initializer function object, used with mpl::for_each
+ // initializes with call_no_transition, defer_transition or default_eventless_transition
+ // variant for non-anonymous transitions
+ template <class EventType,class Enable=void>
+ struct default_init_cell
+ {
+ default_init_cell(dispatch_table* self_,chain_row* tofill_entries_)
+ : self(self_),tofill_entries(tofill_entries_)
+ {}
+ template <bool deferred,bool composite, int some_dummy=0>
+ struct helper
+ {};
+ template <int some_dummy> struct helper<true,false,some_dummy>
+ {
+ template <class State>
+ static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::defer_transition;
+ tofill[state_id].one_state.push_back(call_no_transition);
+ }
+ };
+ template <int some_dummy> struct helper<true,true,some_dummy>
+ {
+ template <class State>
+ static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::defer_transition;
+ tofill[state_id].one_state.push_back(call_no_transition);
+ }
+ };
+ template <int some_dummy> struct helper<false,true,some_dummy>
+ {
+ template <class State>
+ static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &call_submachine< State >;
+ tofill[state_id].one_state.push_front(call_no_transition);
+ }
+ };
+ template <int some_dummy> struct helper<false,false,some_dummy>
+ {
+ template <class State>
+ static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::call_no_transition;
+ tofill[state_id].one_state.push_back(call_no_transition);
+ }
+ };
+ template <class State>
+ void operator()(boost::msm::wrap<State> const& s)
+ {
+ helper<has_state_delayed_event<State,Event>::type::value,
+ is_composite_state<State>::type::value>::execute(s,tofill_entries);
+ }
+ dispatch_table* self;
+ chain_row* tofill_entries;
+ };
+
+ // variant for anonymous transitions
+ template <class EventType>
+ struct default_init_cell<EventType,
+ typename ::boost::enable_if<
+ typename is_completion_event<EventType>::type>::type>
+ {
+ default_init_cell(dispatch_table* self_,chain_row* tofill_entries_)
+ : self(self_),tofill_entries(tofill_entries_)
+ {}
+
+ // this event is a compound 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::wrap<State> const&)
+ {
+ typedef typename create_stt<Fsm>::type stt;
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+ cell call_no_transition = &Fsm::default_eventless_transition;
+ tofill_entries[state_id].one_state.push_back(call_no_transition);
+ }
+
+ dispatch_table* self;
+ chain_row* tofill_entries;
+ };
+
+ public:
+ // initialize the dispatch table for a given Event and Fsm
+ dispatch_table()
+ {
+ // Initialize cells for no transition
+ ::boost::mpl::for_each<
+ ::boost::mpl::filter_view<
+ Stt, ::boost::is_base_of<transition_event< ::boost::mpl::placeholders::_>, Event> > >
+ (init_cell(this));
+
+ ::boost::mpl::for_each<
+ typename generate_state_set<Stt>::type,
+ boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+ (default_init_cell<Event>(this,entries));
+
+ }
+
+ // The singleton instance.
+ static const dispatch_table instance;
+
+ public: // data members
+ chain_row entries[max_state];
+};
+
+template <class Fsm,class Stt, class Event>
+const boost::msm::back::dispatch_table<Fsm,Stt, Event,favor_compile_time>
+dispatch_table<Fsm,Stt, Event,favor_compile_time>::instance;
+
+}}} // boost::msm::back
+
+#endif //BOOST_MSM_BACK_FAVOR_COMPILE_TIME_H

Added: branches/msm/msm_phoenix/boost/msm/back/fold_to_list.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/fold_to_list.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,56 @@
+// Copyright 2008 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is taken from Boost.Proto's documentation
+// Copyright for the original version:
+// Copyright 2008 Eric Niebler. 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_BACK_FOLD_TO_LIST_H
+#define BOOST_MSM_BACK_FOLD_TO_LIST_H
+
+#include <boost/msm/proto_config.hpp>
+#include <boost/proto/core.hpp>
+#include <boost/proto/transform.hpp>
+#include <boost/fusion/container/list/cons.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+ struct state_copy_tag
+ {
+ };
+ ::boost::proto::terminal<state_copy_tag>::type const states_={{}};
+ struct FoldToList
+ : ::boost::proto::or_<
+ // Don't add the states_ terminal to the list
+ ::boost::proto::when<
+ ::boost::proto::terminal< state_copy_tag >
+ , ::boost::proto::_state
+ >
+ // Put all other terminals at the head of the
+ // list that we're building in the "state" parameter
+ , ::boost::proto::when<
+ ::boost::proto::terminal< ::boost::proto::_>
+ , boost::fusion::cons< ::boost::proto::_value, ::boost::proto::_state>(
+ ::boost::proto::_value, ::boost::proto::_state
+ )
+ >
+ // For left-shift operations, first fold the right
+ // child to a list using the current state. Use
+ // the result as the state parameter when folding
+ // the left child to a list.
+ , ::boost::proto::when<
+ ::boost::proto::shift_left<FoldToList, FoldToList>
+ , FoldToList(
+ ::boost::proto::_left
+ , ::boost::proto::call<FoldToList( ::boost::proto::_right, ::boost::proto::_state )>
+ )
+ >
+ >
+ {};
+
+}}}
+
+#endif //BOOST_MSM_BACK_FOLD_TO_LIST_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/history_policies.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/history_policies.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,182 @@
+// 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_BACK_HISTORY_POLICIES_H
+#define BOOST_MSM_BACK_HISTORY_POLICIES_H
+
+#include <boost/mpl/contains.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+
+// policy classes
+
+// Default: no history used
+template <int NumberOfRegions>
+class NoHistoryImpl
+{
+public:
+ NoHistoryImpl(){}
+ ~NoHistoryImpl(){}
+ void set_initial_states(int* const initial_states)
+ {
+ for (int i=0;i<NumberOfRegions;++i)
+ m_initialStates[i] = initial_states[i];
+ }
+ void history_exit(int* const )
+ {
+ // ignore
+ }
+ // returns the state where the state machine should be at start
+ template <class Event>
+ const int* history_entry(Event const& )
+ {
+ // always come back to the original state
+ return m_initialStates;
+ }
+ NoHistoryImpl<NumberOfRegions>& operator=(NoHistoryImpl<NumberOfRegions> const& rhs)
+ {
+ for (int i=0; i<NumberOfRegions;++i)
+ {
+ m_initialStates[i] = rhs.m_initialStates[i];
+ }
+ return *this;
+ }
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int)
+ {
+ ar & m_initialStates;
+ }
+private:
+ int m_initialStates[NumberOfRegions];
+};
+
+// not UML standard. Always activates history, no matter which event generated the transition
+template <int NumberOfRegions>
+class AlwaysHistoryImpl
+{
+public:
+ AlwaysHistoryImpl(){}
+ ~AlwaysHistoryImpl(){}
+ void set_initial_states(int* const initial_states)
+ {
+ for (int i=0;i<NumberOfRegions;++i)
+ m_initialStates[i] = initial_states[i];
+ }
+ void history_exit(int* const current_states)
+ {
+ for (int i=0;i<NumberOfRegions;++i)
+ m_initialStates[i] = current_states[i];
+ }
+ // returns the state where the state machine should be at start
+ template <class Event>
+ const int* history_entry(Event const& )
+ {
+ // always load back the last active state
+ return m_initialStates;
+ }
+ AlwaysHistoryImpl<NumberOfRegions>& operator=(AlwaysHistoryImpl<NumberOfRegions> const& rhs)
+ {
+ for (int i=0; i<NumberOfRegions;++i)
+ {
+ m_initialStates[i] = rhs.m_initialStates[i];
+ }
+ return *this;
+ }
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int)
+ {
+ ar & m_initialStates;
+ }
+private:
+ int m_initialStates[NumberOfRegions];
+};
+
+// UML Shallow history. For deep history, just use this policy for all the contained state machines
+template <class Events,int NumberOfRegions>
+class ShallowHistoryImpl
+{
+public:
+ ShallowHistoryImpl(){}
+ ~ShallowHistoryImpl(){}
+ void set_initial_states(int* const initial_states)
+ {
+ for (int i=0;i<NumberOfRegions;++i)
+ {
+ m_currentStates[i] = initial_states[i];
+ m_initialStates[i] = initial_states[i];
+ }
+ }
+ void history_exit(int* const current_states)
+ {
+ for (int i=0;i<NumberOfRegions;++i)
+ m_currentStates[i] = current_states[i];
+ }
+ // returns the state where the state machine should be at start
+ template <class Event>
+ const int* history_entry(Event const&)
+ {
+ if ( ::boost::mpl::contains<Events,Event>::value)
+ {
+ return m_currentStates;
+ }
+ // not one of our events, no history
+ return m_initialStates;
+ }
+ ShallowHistoryImpl<Events,NumberOfRegions>& operator=(ShallowHistoryImpl<Events,NumberOfRegions> const& rhs)
+ {
+ for (int i=0; i<NumberOfRegions;++i)
+ {
+ m_initialStates[i] = rhs.m_initialStates[i];
+ m_currentStates[i] = rhs.m_currentStates[i];
+ }
+ return *this;
+ }
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int)
+ {
+ ar & m_initialStates;
+ ar & m_currentStates;
+ }
+private:
+ int m_initialStates[NumberOfRegions];
+ int m_currentStates[NumberOfRegions];
+};
+
+struct NoHistory
+{
+ typedef int history_policy;
+ template <int NumberOfRegions>
+ struct apply
+ {
+ typedef NoHistoryImpl<NumberOfRegions> type;
+ };
+};
+struct AlwaysHistory
+{
+ typedef int history_policy;
+ template <int NumberOfRegions>
+ struct apply
+ {
+ typedef AlwaysHistoryImpl<NumberOfRegions> type;
+ };
+};
+template <class Events>
+struct ShallowHistory
+{
+ typedef int history_policy;
+ template <int NumberOfRegions>
+ struct apply
+ {
+ typedef ShallowHistoryImpl<Events,NumberOfRegions> type;
+ };
+};
+} } }//boost::msm::back
+#endif //BOOST_MSM_BACK_HISTORY_POLICIES_H

Added: branches/msm/msm_phoenix/boost/msm/back/metafunctions.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/metafunctions.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,863 @@
+// 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_BACK_METAFUNCTIONS_H
+#define BOOST_MSM_BACK_METAFUNCTIONS_H
+
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/find.hpp>
+#include <boost/mpl/count_if.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/next_prior.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/empty.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/logical.hpp>
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/copy_if.hpp>
+#include <boost/mpl/back_inserter.hpp>
+#include <boost/mpl/transform.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/enable_if.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>
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(explicit_creation)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(pseudo_entry)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(pseudo_exit)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(concrete_exit_state)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(composite_tag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(not_real_row_tag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(event_blocking_flag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(explicit_entry_state)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(completion_event)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(no_exception_thrown)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(no_message_queue)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(activate_deferred_events)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(wrapped_entry)
+
+namespace boost { namespace msm { namespace back
+{
+template <typename Sequence, typename Range>
+struct set_insert_range
+{
+ typedef typename ::boost::mpl::fold<
+ Range,Sequence,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2 >
+ >::type type;
+};
+
+// returns the current state type of a transition
+template <class Transition>
+struct transition_source_type
+{
+ typedef typename Transition::current_state_type type;
+};
+
+// returns the target state type of a transition
+template <class Transition>
+struct transition_target_type
+{
+ typedef typename Transition::next_state_type type;
+};
+
+// helper functions for generate_state_ids
+// create a pair of a state and a passed id for source and target states
+template <class Id,class Transition>
+struct make_pair_source_state_id
+{
+ typedef typename ::boost::mpl::pair<typename Transition::current_state_type,Id> type;
+};
+template <class Id,class Transition>
+struct make_pair_target_state_id
+{
+ typedef typename ::boost::mpl::pair<typename Transition::next_state_type,Id> type;
+};
+
+// iterates through a transition table and automatically generates ids starting at 0
+// first the source states, transition up to down
+// then the target states, up to down
+template <class stt>
+struct generate_state_ids
+{
+ typedef typename
+ ::boost::mpl::fold<
+ stt,::boost::mpl::pair< ::boost::mpl::map< >, ::boost::mpl::int_<0> >,
+ ::boost::mpl::pair<
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ transition_source_type< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ ::boost::mpl::insert< ::boost::mpl::first<mpl::placeholders::_1>,
+ make_pair_source_state_id< ::boost::mpl::second< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::placeholders::_2> >
+ >,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ transition_source_type< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::second< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::next< ::boost::mpl::second<mpl::placeholders::_1 > >
+ >
+ > //pair
+ >::type source_state_ids;
+ typedef typename ::boost::mpl::first<source_state_ids>::type source_state_map;
+ typedef typename ::boost::mpl::second<source_state_ids>::type highest_state_id;
+
+
+ typedef typename
+ ::boost::mpl::fold<
+ stt,::boost::mpl::pair<source_state_map,highest_state_id >,
+ ::boost::mpl::pair<
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ transition_target_type< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ ::boost::mpl::insert< ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ make_pair_target_state_id< ::boost::mpl::second< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::placeholders::_2> >
+ >,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::first< ::boost::mpl::placeholders::_1>,
+ transition_target_type< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::second< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::next< ::boost::mpl::second< ::boost::mpl::placeholders::_1 > >
+ >
+ > //pair
+ >::type all_state_ids;
+ typedef typename ::boost::mpl::first<all_state_ids>::type type;
+};
+
+// returns the id of a given state
+template <class stt,class State>
+struct get_state_id
+{
+ typedef typename ::boost::mpl::at<typename generate_state_ids<stt>::type,State>::type type;
+ enum {value = type::value};
+};
+
+// returns a mpl::vector containing the init states of a state machine
+template <class States>
+struct get_initial_states
+{
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::is_sequence<States>,
+ 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
+{
+ typedef typename mpl::if_<
+ ::boost::mpl::is_sequence<region>,
+ ::boost::mpl::size<region>,
+ ::boost::mpl::int_<1> >::type type;
+};
+
+// builds a mpl::vector of initial states
+//TODO remove duplicate from get_initial_states
+template <class region>
+struct get_regions_as_sequence
+{
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::is_sequence<region>,
+ region,
+ typename ::boost::mpl::push_back< ::boost::mpl::vector0<>,region>::type >::type type;
+};
+
+template <class ToCreateSeq>
+struct get_explicit_creation_as_sequence
+{
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::is_sequence<ToCreateSeq>,
+ ToCreateSeq,
+ typename ::boost::mpl::push_back< ::boost::mpl::vector0<>,ToCreateSeq>::type >::type type;
+};
+
+// returns true if 2 transitions have the same source (used to remove duplicates in search of composite states)
+template <class stt,class Transition1,class Transition2>
+struct have_same_source
+{
+ enum {current_state1 = get_state_id<stt,typename Transition1::current_state_type >::type::value};
+ enum {current_state2 = get_state_id<stt,typename Transition2::current_state_type >::type::value};
+ enum {value = ((int)current_state1 == (int)current_state2) };
+};
+
+
+// A metafunction that returns the Event associated with a transition.
+template <class Transition>
+struct transition_event
+{
+ typedef typename Transition::transition_event type;
+};
+
+// returns true for composite states
+template <class State>
+struct is_composite_state
+{
+ enum {value = has_composite_tag<State>::type::value};
+ typedef typename has_composite_tag<State>::type type;
+};
+
+// transform a transition table in a container of source states
+template <class stt>
+struct keep_source_names
+{
+ // instead of the rows we want only the names of the states (from source)
+ typedef typename
+ ::boost::mpl::transform<
+ stt,transition_source_type< ::boost::mpl::placeholders::_1> >::type type;
+};
+
+// transform a transition table in a container of target states
+template <class stt>
+struct keep_target_names
+{
+ // instead of the rows we want only the names of the states (from source)
+ typedef typename
+ ::boost::mpl::transform<
+ stt,transition_target_type< ::boost::mpl::placeholders::_1> >::type type;
+};
+
+template <class stt>
+struct generate_state_set
+{
+ // keep in the original transition table only the source/target state types
+ typedef typename keep_source_names<stt>::type sources;
+ typedef typename keep_target_names<stt>::type targets;
+ typedef typename
+ ::boost::mpl::fold<
+ sources, ::boost::mpl::set<>,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2>
+ >::type source_set;
+ typedef typename
+ ::boost::mpl::fold<
+ targets,source_set,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2>
+ >::type type;
+};
+
+// iterates through the transition table and generate a mpl::set<> containing all the events
+template <class stt>
+struct generate_event_set
+{
+ typedef typename
+ ::boost::mpl::fold<
+ stt, ::boost::mpl::set<>,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::placeholders::_1,
+ transition_event< ::boost::mpl::placeholders::_2> >,
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1,
+ transition_event< ::boost::mpl::placeholders::_2> > >
+ >::type type;
+};
+
+// returns a mpl::bool_<true> if State has Event as deferred event
+template <class State, class Event>
+struct has_state_delayed_event
+{
+ typedef typename ::boost::mpl::find<typename State::deferred_events,Event>::type found;
+ typedef typename ::boost::mpl::if_<
+ ::boost::is_same<found,typename ::boost::mpl::end<typename State::deferred_events>::type >,
+ ::boost::mpl::bool_<false>,
+ ::boost::mpl::bool_<true> >::type type;
+};
+// returns a mpl::bool_<true> if State has any deferred event
+template <class State>
+struct has_state_delayed_events
+{
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::empty<typename State::deferred_events>,
+ ::boost::mpl::bool_<false>,
+ ::boost::mpl::bool_<true> >::type type;
+};
+
+// Template used to create dummy entries for initial states not found in the stt.
+template< typename T1 >
+struct not_a_row
+{
+ typedef int not_real_row_tag;
+ struct dummy_event
+ {
+ };
+ typedef T1 current_state_type;
+ typedef T1 next_state_type;
+ typedef dummy_event transition_event;
+};
+
+// metafunctions used to find out if a state is entry, exit or something else
+template <class State>
+struct is_pseudo_entry
+{
+ typedef typename ::boost::mpl::if_< typename has_pseudo_entry<State>::type,
+ ::boost::mpl::bool_<true>,::boost::mpl::bool_<false>
+ >::type type;
+};
+// says if a state is an exit pseudo state
+template <class State>
+struct is_pseudo_exit
+{
+ typedef typename ::boost::mpl::if_< typename has_pseudo_exit<State>::type,
+ ::boost::mpl::bool_<true>, ::boost::mpl::bool_<false>
+ >::type type;
+};
+// says if a state is an entry pseudo state or an explicit entry
+template <class State>
+struct is_direct_entry
+{
+ typedef typename ::boost::mpl::if_< typename has_explicit_entry_state<State>::type,
+ ::boost::mpl::bool_<true>, ::boost::mpl::bool_<false>
+ >::type type;
+};
+
+//converts a "fake" (simulated in a state_machine_ description )state into one which will really get created
+template <class StateType,class CompositeType>
+struct convert_fake_state
+{
+ // converts a state (explicit entry) into the state we really are going to create (explicit<>)
+ typedef typename ::boost::mpl::if_<
+ typename is_direct_entry<StateType>::type,
+ typename CompositeType::template direct<StateType>,
+ typename ::boost::mpl::identity<StateType>::type
+ >::type type;
+};
+
+template <class StateType>
+struct get_explicit_creation
+{
+ typedef typename StateType::explicit_creation type;
+};
+
+template <class StateType>
+struct get_wrapped_entry
+{
+ typedef typename StateType::wrapped_entry type;
+};
+// used for states created with explicit_creation
+// if the state is an explicit entry, we reach for the wrapped state
+// otherwise, this returns the state itself
+template <class StateType>
+struct get_wrapped_state
+{
+ typedef typename ::boost::mpl::eval_if<
+ typename has_wrapped_entry<StateType>::type,
+ get_wrapped_entry<StateType>,
+ ::boost::mpl::identity<StateType> >::type type;
+};
+
+template <class Derived>
+struct create_stt
+{
+ //typedef typename Derived::transition_table stt;
+ typedef typename Derived::real_transition_table Stt;
+ // get the state set
+ typedef typename generate_state_set<Stt>::type states;
+ // transform the initial region(s) in a sequence
+ typedef typename get_regions_as_sequence<typename Derived::initial_state>::type init_states;
+ // iterate through the initial states and add them in the stt if not already there
+ typedef typename
+ ::boost::mpl::fold<
+ init_states,Stt,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key<states, ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::end< ::boost::mpl::placeholders::_1>,
+ not_a_row< get_wrapped_state< ::boost::mpl::placeholders::_2> > >
+ >
+ >::type with_init;
+ // do the same for states marked as explicitly created
+ typedef typename get_explicit_creation_as_sequence<
+ typename ::boost::mpl::eval_if<
+ typename has_explicit_creation<Derived>::type,
+ get_explicit_creation<Derived>,
+ ::boost::mpl::vector0<> >::type
+ >::type fake_explicit_created;
+
+ typedef typename
+ ::boost::mpl::transform<
+ fake_explicit_created,convert_fake_state< ::boost::mpl::placeholders::_1,Derived> >::type explicit_created;
+
+ typedef typename
+ ::boost::mpl::fold<
+ explicit_created,with_init,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key<states, ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::end<mpl::placeholders::_1>,
+ not_a_row< get_wrapped_state< ::boost::mpl::placeholders::_2> > >
+ >
+ >::type type;
+};
+
+// returns the transition table of a Composite state
+template <class Composite>
+struct get_transition_table
+{
+ typedef typename create_stt<Composite>::type type;
+};
+// recursively get a transition table for a given composite state.
+// returns the transition table for this state + the tables of all composite sub states recursively
+template <class Composite>
+struct recursive_get_transition_table
+{
+ // get the transition table of the state if it's a state machine
+ typedef typename ::boost::mpl::eval_if<typename is_composite_state<Composite>::type,
+ get_transition_table<Composite>,
+ ::boost::mpl::vector0<> >::type org_table;
+
+ typedef typename generate_state_set<org_table>::type states;
+
+ // and for every substate, recursively get the transition table if it's a state machine
+ typedef typename ::boost::mpl::fold<
+ states,org_table,
+ ::boost::mpl::insert_range< ::boost::mpl::placeholders::_1, ::boost::mpl::end<mpl::placeholders::_1>,
+ recursive_get_transition_table< ::boost::mpl::placeholders::_2 > >
+ >::type type;
+
+};
+
+// metafunction used to say if a SM has pseudo exit states
+template <class Derived>
+struct has_fsm_deferred_events
+{
+ typedef typename create_stt<Derived>::type Stt;
+ typedef typename generate_state_set<Stt>::type state_list;
+
+ typedef typename ::boost::mpl::or_<
+ typename has_activate_deferred_events<Derived>::type,
+ ::boost::mpl::bool_< ::boost::mpl::count_if<
+ typename Derived::configuration,
+ has_activate_deferred_events< ::boost::mpl::placeholders::_1 > >::value != 0>
+ >::type found_in_fsm;
+
+ typedef typename ::boost::mpl::or_<
+ found_in_fsm,
+ ::boost::mpl::bool_< ::boost::mpl::count_if<
+ state_list,has_state_delayed_events<
+ ::boost::mpl::placeholders::_1 > >::value != 0>
+ >::type type;
+};
+
+// returns a mpl::bool_<true> if State has any delayed event
+template <class Event>
+struct is_completion_event
+{
+ typedef typename ::boost::mpl::if_<
+ has_completion_event<Event>,
+ ::boost::mpl::bool_<true>,
+ ::boost::mpl::bool_<false> >::type type;
+};
+// metafunction used to say if a SM has eventless transitions
+template <class Derived>
+struct has_fsm_eventless_transition
+{
+ typedef typename create_stt<Derived>::type Stt;
+ typedef typename generate_event_set<Stt>::type event_list;
+
+ typedef ::boost::mpl::bool_< ::boost::mpl::count_if<
+ event_list,is_completion_event< ::boost::mpl::placeholders::_1 > >::value != 0> type;
+};
+template <class Derived>
+struct find_completion_events
+{
+ typedef typename create_stt<Derived>::type Stt;
+ typedef typename generate_event_set<Stt>::type event_list;
+
+ typedef typename ::boost::mpl::fold<
+ event_list, ::boost::mpl::set<>,
+ ::boost::mpl::if_<
+ is_completion_event< ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2 >,
+ ::boost::mpl::placeholders::_1 >
+ >::type type;
+};
+
+template <class Transition>
+struct make_vector
+{
+ typedef ::boost::mpl::vector<Transition> type;
+};
+template< typename Entry >
+struct get_first_element_pair_second
+{
+ typedef typename ::boost::mpl::front<typename Entry::second>::type type;
+};
+
+ //returns the owner of an explicit_entry state
+ //which is the containing SM if the transition originates from outside the containing SM
+ //or else the explicit_entry state itself
+template <class State,class ContainingSM>
+struct get_owner
+{
+ typedef typename ::boost::mpl::if_<
+ typename ::boost::mpl::not_<typename ::boost::is_same<typename State::owner,
+ ContainingSM >::type>::type,
+ typename State::owner,
+ State >::type type;
+};
+
+template <class Sequence,class ContainingSM>
+struct get_fork_owner
+{
+ typedef typename ::boost::mpl::front<Sequence>::type seq_front;
+ typedef typename ::boost::mpl::if_<
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<typename seq_front::owner,ContainingSM>::type>::type,
+ typename seq_front::owner,
+ seq_front >::type type;
+};
+
+template <class StateType,class ContainingSM>
+struct make_exit
+{
+ typedef typename ::boost::mpl::if_<
+ typename is_pseudo_exit<StateType>::type ,
+ typename ContainingSM::template exit_pt<StateType>,
+ typename ::boost::mpl::identity<StateType>::type
+ >::type type;
+};
+
+template <class StateType,class ContainingSM>
+struct make_entry
+{
+ typedef typename ::boost::mpl::if_<
+ typename is_pseudo_entry<StateType>::type ,
+ typename ContainingSM::template entry_pt<StateType>,
+ typename ::boost::mpl::if_<
+ typename is_direct_entry<StateType>::type,
+ typename ContainingSM::template direct<StateType>,
+ typename ::boost::mpl::identity<StateType>::type
+ >::type
+ >::type type;
+};
+// metafunction used to say if a SM has pseudo exit states
+template <class StateType>
+struct has_exit_pseudo_states_helper
+{
+ typedef typename StateType::stt Stt;
+ typedef typename generate_state_set<Stt>::type state_list;
+
+ typedef ::boost::mpl::bool_< ::boost::mpl::count_if<
+ state_list,is_pseudo_exit< ::boost::mpl::placeholders::_1> >::value != 0> type;
+};
+template <class StateType>
+struct has_exit_pseudo_states
+{
+ typedef typename ::boost::mpl::eval_if<typename is_composite_state<StateType>::type,
+ has_exit_pseudo_states_helper<StateType>,
+ ::boost::mpl::bool_<false> >::type type;
+};
+
+template <class StateType>
+struct is_state_blocking
+{
+ typedef typename ::boost::mpl::fold<
+ typename StateType::flag_list, ::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 >,
+ ::boost::mpl::placeholders::_1 >
+ >::type blocking_flags;
+
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::empty<blocking_flags>,
+ ::boost::mpl::bool_<false>,
+ ::boost::mpl::bool_<true> >::type type;
+};
+// returns a mpl::bool_<true> if fsm has an event blocking flag in one of its substates
+template <class StateType>
+struct has_fsm_blocking_states
+{
+ typedef typename create_stt<StateType>::type Stt;
+ typedef typename generate_state_set<Stt>::type state_list;
+
+ typedef typename ::boost::mpl::fold<
+ state_list, ::boost::mpl::set<>,
+ ::boost::mpl::if_<
+ is_state_blocking< ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2 >,
+ ::boost::mpl::placeholders::_1 >
+ >::type blocking_states;
+
+ typedef typename ::boost::mpl::if_<
+ ::boost::mpl::empty<blocking_states>,
+ ::boost::mpl::bool_<false>,
+ ::boost::mpl::bool_<true> >::type type;
+};
+
+template <class StateType>
+struct is_no_exception_thrown
+{
+ typedef ::boost::mpl::bool_< ::boost::mpl::count_if<
+ typename StateType::configuration,
+ has_no_exception_thrown< ::boost::mpl::placeholders::_1 > >::value != 0> found;
+
+ typedef typename ::boost::mpl::or_<
+ typename has_no_exception_thrown<StateType>::type,
+ found
+ >::type type;
+};
+
+template <class StateType>
+struct is_no_message_queue
+{
+ typedef ::boost::mpl::bool_< ::boost::mpl::count_if<
+ typename StateType::configuration,
+ has_no_message_queue< ::boost::mpl::placeholders::_1 > >::value != 0> found;
+
+ typedef typename ::boost::mpl::or_<
+ typename has_no_message_queue<StateType>::type,
+ found
+ >::type type;
+};
+
+template <class StateType>
+struct get_initial_event
+{
+ typedef typename StateType::initial_event type;
+};
+
+template <class StateType>
+struct get_final_event
+{
+ typedef typename StateType::final_event type;
+};
+
+template <class TransitionTable, class InitState>
+struct build_one_orthogonal_region
+{
+ template<typename Row>
+ struct row_to_incidence :
+ ::boost::mpl::vector<
+ ::boost::mpl::pair<
+ typename Row::next_state_type,
+ typename Row::transition_event>,
+ typename Row::current_state_type,
+ typename Row::next_state_type
+ > {};
+
+ template <class Seq, class Elt>
+ struct transition_incidence_list_helper
+ {
+ typedef typename ::boost::mpl::push_back< Seq, row_to_incidence< Elt > >::type type;
+ };
+
+ typedef typename ::boost::mpl::fold<
+ TransitionTable,
+ ::boost::mpl::vector<>,
+ transition_incidence_list_helper< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2>
+ >::type transition_incidence_list;
+
+ typedef ::boost::msm::mpl_graph::incidence_list_graph<transition_incidence_list>
+ transition_graph;
+
+ struct preordering_dfs_visitor :
+ ::boost::msm::mpl_graph::dfs_default_visitor_operations
+ {
+ template<typename Node, typename Graph, typename State>
+ struct discover_vertex :
+ ::boost::mpl::insert<State, Node>
+ {};
+ };
+
+ typedef typename mpl::first<
+ typename ::boost::msm::mpl_graph::depth_first_search<
+ transition_graph,
+ preordering_dfs_visitor,
+ ::boost::mpl::set<>,
+ InitState
+ >::type
+ >::type type;
+};
+
+template <class Fsm>
+struct find_entry_states
+{
+ typedef typename ::boost::mpl::copy<
+ typename Fsm::substate_list,
+ ::boost::mpl::inserter<
+ ::boost::mpl::set0<>,
+ ::boost::mpl::if_<
+ has_explicit_entry_state< ::boost::mpl::placeholders::_2 >,
+ ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::placeholders::_2>,
+ ::boost::mpl::placeholders::_1
+ >
+ >
+ >::type type;
+};
+
+template <class Set1, class Set2>
+struct is_common_element
+{
+ typedef typename ::boost::mpl::fold<
+ Set1, ::boost::mpl::false_,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key<
+ Set2,
+ ::boost::mpl::placeholders::_2
+ >,
+ ::boost::mpl::true_,
+ ::boost::mpl::placeholders::_1
+ >
+ >::type type;
+};
+
+template <class EntryRegion, class AllRegions>
+struct add_entry_region
+{
+ typedef typename ::boost::mpl::transform<
+ AllRegions,
+ ::boost::mpl::if_<
+ is_common_element<EntryRegion, ::boost::mpl::placeholders::_1>,
+ set_insert_range< ::boost::mpl::placeholders::_1, EntryRegion>,
+ ::boost::mpl::placeholders::_1
+ >
+ >::type type;
+};
+
+// build a vector of regions states (as a set)
+// one set of states for every region
+template <class Fsm, class InitStates>
+struct build_orthogonal_regions
+{
+ typedef typename
+ ::boost::mpl::fold<
+ InitStates, ::boost::mpl::vector0<>,
+ ::boost::mpl::push_back<
+ ::boost::mpl::placeholders::_1,
+ build_one_orthogonal_region< typename Fsm::stt, ::boost::mpl::placeholders::_2 > >
+ >::type without_entries;
+
+ typedef typename
+ ::boost::mpl::fold<
+ typename find_entry_states<Fsm>::type, ::boost::mpl::vector0<>,
+ ::boost::mpl::push_back<
+ ::boost::mpl::placeholders::_1,
+ build_one_orthogonal_region< typename Fsm::stt, ::boost::mpl::placeholders::_2 > >
+ >::type only_entries;
+
+ typedef typename ::boost::mpl::fold<
+ only_entries , without_entries,
+ add_entry_region< ::boost::mpl::placeholders::_2, ::boost::mpl::placeholders::_1>
+ >::type type;
+};
+
+template <class GraphAsSeqOfSets, class StateType>
+struct find_region_index
+{
+ typedef typename
+ ::boost::mpl::fold<
+ GraphAsSeqOfSets, ::boost::mpl::pair< ::boost::mpl::int_< -1 > /*res*/, ::boost::mpl::int_<0> /*counter*/ >,
+ ::boost::mpl::if_<
+ ::boost::mpl::has_key< ::boost::mpl::placeholders::_2, StateType >,
+ ::boost::mpl::pair<
+ ::boost::mpl::second< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::next< ::boost::mpl::second< ::boost::mpl::placeholders::_1 > >
+ >,
+ ::boost::mpl::pair<
+ ::boost::mpl::first< ::boost::mpl::placeholders::_1 >,
+ ::boost::mpl::next< ::boost::mpl::second< ::boost::mpl::placeholders::_1 > >
+ >
+ >
+ >::type result_pair;
+ typedef typename ::boost::mpl::first<result_pair>::type type;
+ enum {value = type::value};
+};
+
+template <class Fsm>
+struct check_regions_orthogonality
+{
+ typedef typename build_orthogonal_regions< Fsm,typename Fsm::initial_states>::type regions;
+
+ typedef typename ::boost::mpl::fold<
+ regions, ::boost::mpl::int_<0>,
+ ::boost::mpl::plus< ::boost::mpl::placeholders::_1 , ::boost::mpl::size< ::boost::mpl::placeholders::_2> >
+ >::type number_of_states_in_regions;
+
+ typedef typename ::boost::mpl::fold<
+ regions,mpl::set0<>,
+ set_insert_range<
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::placeholders::_2 >
+ >::type one_big_states_set;
+
+ enum {states_in_regions_raw = number_of_states_in_regions::value};
+ enum {cumulated_states_in_regions_raw = ::boost::mpl::size<one_big_states_set>::value};
+};
+
+template <class Fsm>
+struct check_no_unreachable_state
+{
+ typedef typename check_regions_orthogonality<Fsm>::one_big_states_set states_in_regions;
+
+ typedef typename set_insert_range<
+ states_in_regions,
+ typename ::boost::mpl::eval_if<
+ typename has_explicit_creation<Fsm>::type,
+ get_explicit_creation<Fsm>,
+ ::boost::mpl::vector0<>
+ >::type
+ >::type with_explicit_creation;
+
+ enum {states_in_fsm = ::boost::mpl::size< typename Fsm::substate_list >::value};
+ enum {cumulated_states_in_regions = ::boost::mpl::size< with_explicit_creation >::value};
+};
+
+// helper to find out if a SM has an active exit state and is therefore waiting for exiting
+template <class StateType,class OwnerFct,class FSM>
+inline
+typename ::boost::enable_if<typename ::boost::mpl::and_<typename is_composite_state<FSM>::type,
+ typename is_pseudo_exit<StateType>::type>,bool >::type
+is_exit_state_active(FSM& fsm)
+{
+ typedef typename OwnerFct::type Composite;
+ //typedef typename create_stt<Composite>::type stt;
+ typedef typename Composite::stt stt;
+ int state_id = get_state_id<stt,StateType>::type::value;
+ Composite& comp = fsm.template get_state<Composite&>();
+ return (std::find(comp.current_state(),comp.current_state()+Composite::nr_regions::value,state_id)
+ !=comp.current_state()+Composite::nr_regions::value);
+}
+template <class StateType,class OwnerFct,class FSM>
+inline
+typename ::boost::disable_if<typename ::boost::mpl::and_<typename is_composite_state<FSM>::type,
+ typename is_pseudo_exit<StateType>::type>,bool >::type
+is_exit_state_active(FSM&)
+{
+ return false;
+}
+
+} } }//boost::msm::back
+
+#endif // BOOST_MSM_BACK_METAFUNCTIONS_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/mpl_graph_fsm_check.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/mpl_graph_fsm_check.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,48 @@
+// 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_BACK_MPL_GRAPH_FSM_CHECK_H
+#define BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
+
+#include <boost/mpl/assert.hpp>
+
+#include <boost/msm/back/metafunctions.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+ struct mpl_graph_fsm_check
+ {
+ typedef int fsm_check;
+ // checks that regions are truly orthogonal (one state belongs to 1 region)
+ // using the mpl_graph library (part of metagraph)
+ template <class Fsm>
+ static void check_orthogonality()
+ {
+ BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_regions_orthogonality<Fsm>::states_in_regions_raw,
+ ==,
+ ::boost::msm::back::check_regions_orthogonality<Fsm>::cumulated_states_in_regions_raw );
+
+ }
+ // checks that all states are reachable or created using the explicit_creation typedef
+ // using the mpl_graph library (part of metagraph)
+ template <class Fsm>
+ static void check_unreachable_states()
+ {
+ BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_no_unreachable_state<Fsm>::states_in_fsm,
+ ==,
+ ::boost::msm::back::check_no_unreachable_state<Fsm>::cumulated_states_in_regions );
+
+ }
+ };
+
+} } }//boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H

Added: branches/msm/msm_phoenix/boost/msm/back/no_fsm_check.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/no_fsm_check.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,37 @@
+// 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_BACK_NO_FSM_CHECK_H
+#define BOOST_MSM_BACK_NO_FSM_CHECK_H
+
+#include <boost/mpl/assert.hpp>
+
+#include <boost/msm/back/metafunctions.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+ struct no_fsm_check
+ {
+ typedef int fsm_check;
+ // no fsm structure checking
+ template <class Fsm>
+ static void check_orthogonality()
+ {
+ }
+ template <class Fsm>
+ static void check_unreachable_states()
+ {
+ }
+ };
+
+} } }//boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_NO_FSM_CHECK_H

Added: branches/msm/msm_phoenix/boost/msm/back/queue_container_circular.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/queue_container_circular.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,32 @@
+// 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_BACK_QUEUE_CONTAINER_CIRCULAR_H
+#define BOOST_MSM_BACK_QUEUE_CONTAINER_CIRCULAR_H
+
+#include <boost/circular_buffer.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+ struct queue_container_circular
+ {
+ typedef int queue_container_policy;
+
+ template <class Element>
+ struct In
+ {
+ typedef typename boost::circular_buffer<Element> type;
+ };
+ };
+
+} } }//boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_QUEUE_CONTAINER_CIRCULAR_H

Added: branches/msm/msm_phoenix/boost/msm/back/queue_container_deque.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/queue_container_deque.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,32 @@
+// 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_BACK_QUEUE_CONTAINER_DEQUE_H
+#define BOOST_MSM_BACK_QUEUE_CONTAINER_DEQUE_H
+
+#include <deque>
+
+namespace boost { namespace msm { namespace back
+{
+ struct queue_container_deque
+ {
+ typedef int queue_container_policy;
+
+ template <class Element>
+ struct In
+ {
+ typedef typename std::deque<Element> type;
+ };
+ };
+
+} } }//boost::msm::back
+
+
+#endif //BOOST_MSM_BACK_QUEUE_CONTAINER_DEQUE_H

Added: branches/msm/msm_phoenix/boost/msm/back/state_machine.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/state_machine.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,2539 @@
+// 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_BACK_STATEMACHINE_H
+#define BOOST_MSM_BACK_STATEMACHINE_H
+
+#include <exception>
+#include <vector>
+#include <functional>
+#include <numeric>
+#include <utility>
+
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
+#include <boost/mpl/contains.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/assert.hpp>
+
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/as_set.hpp>
+#include <boost/fusion/container/set.hpp>
+#include <boost/fusion/include/set.hpp>
+#include <boost/fusion/include/set_fwd.hpp>
+#include <boost/fusion/include/mpl.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+#include <boost/assert.hpp>
+#include <boost/ref.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+
+#include <boost/bind.hpp>
+#include <boost/bind/apply.hpp>
+#include <boost/function.hpp>
+
+#include <boost/serialization/base_object.hpp>
+
+#include <boost/parameter.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>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/back/args.hpp>
+#include <boost/msm/back/default_compile_policy.hpp>
+#include <boost/msm/back/dispatch_table.hpp>
+#include <boost/msm/back/no_fsm_check.hpp>
+#include <boost/msm/back/queue_container_deque.hpp>
+#include <boost/msm/back/any_event.hpp>
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(accept_sig)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(no_automatic_create)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(non_forwarding_flag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(direct_entry)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(initial_event)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(final_event)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(do_serialize)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(history_policy)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(fsm_check)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(compile_policy)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(queue_container_policy)
+
+#ifndef BOOST_MSM_CONSTRUCTOR_ARG_SIZE
+#define BOOST_MSM_CONSTRUCTOR_ARG_SIZE 5 // default max number of arguments for constructors
+#endif
+
+namespace boost { namespace msm { namespace back
+{
+// event used internally for wrapping a direct entry
+template <class StateType,class Event>
+struct direct_entry_event
+{
+ typedef int direct_entry;
+ typedef StateType active_state;
+
+ direct_entry_event(Event const& evt):m_event(evt){}
+ Event const& m_event;
+};
+
+// This declares the statically-initialized dispatch_table instance.
+template <class Fsm,class Stt, class Event,class CompilePolicy>
+const boost::msm::back::dispatch_table<Fsm,Stt, Event,CompilePolicy>
+dispatch_table<Fsm,Stt, Event,CompilePolicy>::instance;
+
+BOOST_PARAMETER_TEMPLATE_KEYWORD(front_end)
+BOOST_PARAMETER_TEMPLATE_KEYWORD(history_policy)
+BOOST_PARAMETER_TEMPLATE_KEYWORD(compile_policy)
+BOOST_PARAMETER_TEMPLATE_KEYWORD(fsm_check_policy)
+BOOST_PARAMETER_TEMPLATE_KEYWORD(queue_container_policy)
+
+typedef ::boost::parameter::parameters<
+ ::boost::parameter::required< ::boost::msm::back::tag::front_end >
+ , ::boost::parameter::optional<
+ ::boost::parameter::deduced< ::boost::msm::back::tag::history_policy>, has_history_policy< ::boost::mpl::_ >
+ >
+ , ::boost::parameter::optional<
+ ::boost::parameter::deduced< ::boost::msm::back::tag::compile_policy>, has_compile_policy< ::boost::mpl::_ >
+ >
+ , ::boost::parameter::optional<
+ ::boost::parameter::deduced< ::boost::msm::back::tag::fsm_check_policy>, has_fsm_check< ::boost::mpl::_ >
+ >
+ , ::boost::parameter::optional<
+ ::boost::parameter::deduced< ::boost::msm::back::tag::queue_container_policy>,
+ has_queue_container_policy< ::boost::mpl::_ >
+ >
+> state_machine_signature;
+
+
+
+// library-containing class for state machines. Pass the actual FSM class as
+// the Concrete parameter.
+// A0=Derived,A1=NoHistory,A2=CompilePolicy,A3=FsmCheckPolicy >
+template <
+ class A0
+ , class A1 = parameter::void_
+ , class A2 = parameter::void_
+ , class A3 = parameter::void_
+ , class A4 = parameter::void_
+>
+class state_machine : //public Derived
+ public ::boost::parameter::binding<
+ typename state_machine_signature::bind<A0,A1,A2,A3,A4>::type, ::boost::msm::back::tag::front_end
+ >::type
+{
+public:
+ // Create ArgumentPack
+ typedef typename
+ state_machine_signature::bind<A0,A1,A2,A3,A4>::type
+ state_machine_args;
+
+ // Extract first logical parameter.
+ typedef typename ::boost::parameter::binding<
+ state_machine_args, ::boost::msm::back::tag::front_end>::type Derived;
+
+ typedef typename ::boost::parameter::binding<
+ state_machine_args, ::boost::msm::back::tag::history_policy, NoHistory >::type HistoryPolicy;
+
+ typedef typename ::boost::parameter::binding<
+ state_machine_args, ::boost::msm::back::tag::compile_policy, favor_runtime_speed >::type CompilePolicy;
+
+ typedef typename ::boost::parameter::binding<
+ state_machine_args, ::boost::msm::back::tag::fsm_check_policy, no_fsm_check >::type FsmCheckPolicy;
+
+ typedef typename ::boost::parameter::binding<
+ state_machine_args, ::boost::msm::back::tag::queue_container_policy,
+ queue_container_deque >::type QueueContainerPolicy;
+
+private:
+
+ typedef boost::msm::back::state_machine<
+ A0,A1,A2,A3,A4> library_sm;
+
+ typedef ::boost::function<
+ execute_return ()> transition_fct;
+ typedef ::boost::function<
+ execute_return () > deferred_fct;
+ typedef typename QueueContainerPolicy::
+ template In<deferred_fct>::type deferred_events_queue_t;
+ typedef typename QueueContainerPolicy::
+ template In<transition_fct>::type events_queue_t;
+
+ typedef bool (*flag_handler)(library_sm const&);
+
+ // all state machines are friend with each other to allow embedding any of them in another fsm
+ template <class ,class , class, class, class
+ > friend class boost::msm::back::state_machine;
+
+ // helper to add, if needed, visitors to all states
+ // version without visitors
+ template <class StateType,class Enable=void>
+ struct visitor_fct_helper
+ {
+ public:
+ visitor_fct_helper(){}
+ void fill_visitors(int)
+ {
+ }
+ template <class FCT>
+ void insert(int,FCT)
+ {
+ }
+ template <class VISITOR>
+ void execute(int,VISITOR)
+ {
+ }
+ };
+ // version with visitors
+ template <class StateType>
+ struct visitor_fct_helper<StateType,typename ::boost::enable_if<has_accept_sig<StateType> >::type>
+ {
+ public:
+ visitor_fct_helper():m_state_visitors(){}
+ void fill_visitors(int number_of_states)
+ {
+ m_state_visitors.resize(number_of_states);
+ }
+ template <class FCT>
+ void insert(int index,FCT fct)
+ {
+ m_state_visitors[index]=fct;
+ }
+ void execute(int index)
+ {
+ m_state_visitors[index]();
+ }
+
+#define MSM_VISITOR_HELPER_EXECUTE_SUB(z, n, unused) ARG ## n vis ## n
+#define MSM_VISITOR_HELPER_EXECUTE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ void execute(int index BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM(n, MSM_VISITOR_HELPER_EXECUTE_SUB, ~ ) ) \
+ { \
+ m_state_visitors[index](BOOST_PP_ENUM_PARAMS(n,vis)); \
+ }
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_HELPER_EXECUTE, ~)
+#undef MSM_VISITOR_HELPER_EXECUTE
+#undef MSM_VISITOR_HELPER_EXECUTE_SUB
+ private:
+ typedef typename StateType::accept_sig::type visitor_fct;
+ typedef std::vector<visitor_fct> visitors;
+
+ visitors m_state_visitors;
+ };
+
+ template <class StateType,class Enable=int>
+ struct deferred_msg_queue_helper
+ {
+ };
+ template <class StateType>
+ struct deferred_msg_queue_helper<StateType,
+ typename ::boost::enable_if<
+ typename ::boost::msm::back::has_fsm_deferred_events<StateType>::type,int >::type>
+ {
+ public:
+ deferred_msg_queue_helper():m_deferred_events_queue(){}
+ deferred_events_queue_t m_deferred_events_queue;
+ };
+
+ public:
+ // tags
+ typedef int composite_tag;
+
+ // in case someone needs to know
+ typedef HistoryPolicy history_policy;
+
+ struct InitEvent { };
+ struct ExitEvent { };
+ // flag handling
+ struct Flag_AND
+ {
+ typedef std::logical_and<bool> type;
+ };
+ struct Flag_OR
+ {
+ typedef std::logical_or<bool> type;
+ };
+ typedef typename Derived::BaseAllStates BaseState;
+ typedef Derived ConcreteSM;
+
+ // if the front-end fsm provides an initial_event typedef, replace InitEvent by this one
+ typedef typename ::boost::mpl::eval_if<
+ typename has_initial_event<Derived>::type,
+ get_initial_event<Derived>,
+ ::boost::mpl::identity<InitEvent>
+ >::type fsm_initial_event;
+
+ // if the front-end fsm provides an exit_event typedef, replace ExitEvent by this one
+ typedef typename ::boost::mpl::eval_if<
+ typename has_final_event<Derived>::type,
+ get_final_event<Derived>,
+ ::boost::mpl::identity<ExitEvent>
+ >::type fsm_final_event;
+
+ template <class ExitPoint>
+ struct exit_pt : public ExitPoint
+ {
+ // tags
+ typedef ExitPoint wrapped_exit;
+ typedef int pseudo_exit;
+ typedef library_sm owner;
+ typedef int no_automatic_create;
+ typedef typename
+ ExitPoint::event Event;
+ typedef ::boost::function<execute_return (Event const&)>
+ forwarding_function;
+
+ // forward event to the higher-level FSM
+ template <class ForwardEvent>
+ void forward_event(ForwardEvent const& incomingEvent)
+ {
+ // use helper to forward or not
+ ForwardHelper< ::boost::is_convertible<ForwardEvent,Event>::value>::helper(incomingEvent,m_forward);
+ }
+ void set_forward_fct(::boost::function<execute_return (Event const&)> fct)
+ {
+ m_forward = fct;
+ }
+ exit_pt():m_forward(){}
+ // by assignments, we keep our forwarding functor unchanged as our containing SM did not change
+ template <class RHS>
+ exit_pt(RHS& rhs):m_forward(){}
+ exit_pt<ExitPoint>& operator= (const exit_pt<ExitPoint>& )
+ {
+ return *this;
+ }
+ private:
+ forwarding_function m_forward;
+
+ // using partial specialization instead of enable_if because of VC8 bug
+ template <bool OwnEvent, int Dummy=0>
+ struct ForwardHelper
+ {
+ template <class ForwardEvent>
+ static void helper(ForwardEvent const& ,forwarding_function& )
+ {
+ // Not our event, ignore
+ }
+ };
+ template <int Dummy>
+ struct ForwardHelper<true,Dummy>
+ {
+ template <class ForwardEvent>
+ static void helper(ForwardEvent const& incomingEvent,forwarding_function& forward_fct)
+ {
+ // call if handler set, if not, this state is simply a terminate state
+ if (forward_fct)
+ forward_fct(incomingEvent);
+ }
+ };
+
+ };
+ template <class EntryPoint>
+ struct entry_pt : public EntryPoint
+ {
+ // tags
+ typedef EntryPoint wrapped_entry;
+ typedef int pseudo_entry;
+ typedef library_sm owner;
+ typedef int no_automatic_create;
+ };
+ template <class EntryPoint>
+ struct direct : public EntryPoint
+ {
+ // tags
+ typedef EntryPoint wrapped_entry;
+ typedef int explicit_entry_state;
+ typedef library_sm owner;
+ typedef int no_automatic_create;
+ };
+ typedef typename get_number_of_regions<typename Derived::initial_state>::type nr_regions;
+ // Template used to form rows in the transition table
+ template<
+ typename ROW
+ >
+ struct row_
+ {
+ //typedef typename ROW::Source T1;
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ // if the source is an exit pseudo state, then
+ // current_state_type becomes the result of get_owner
+ // meaning the containing SM from which the exit occurs
+ typedef typename ::boost::mpl::eval_if<
+ typename has_pseudo_exit<T1>::type,
+ get_owner<T1,library_sm>,
+ ::boost::mpl::identity<typename ROW::Source> >::type current_state_type;
+
+ // if Target is a sequence, then we have a fork and expect a sequence of explicit_entry
+ // else if Target is an explicit_entry, next_state_type becomes the result of get_owner
+ // meaning the containing SM if the row is "outside" the containing SM or else the explicit_entry state itself
+ typedef typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::is_sequence<T2>::type,
+ get_fork_owner<T2,library_sm>,
+ ::boost::mpl::eval_if<
+ typename has_no_automatic_create<T2>::type,
+ get_owner<T2,library_sm>,
+ ::boost::mpl::identity<T2> >
+ >::type next_state_type;
+
+ // if a guard condition is here, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list ) )
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int region_index, int state, transition_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));
+ BOOST_ASSERT(state == (current_state));
+ // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active
+ if (has_pseudo_exit<T1>::type::value &&
+ !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
+ {
+ return HANDLED_FALSE;
+ }
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+
+ // the guard condition has already been checked
+ execute_exit<current_state_type>
+ (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),evt,fsm);
+
+ // then call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list);
+
+ // 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);
+ fsm.m_states[region_index]=next_state;
+ return res;
+ }
+ };
+
+ // row having only a guard condition
+ template<
+ typename ROW
+ >
+ struct g_row_
+ {
+ //typedef typename ROW::Source T1;
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ // if the source is an exit pseudo state, then
+ // current_state_type becomes the result of get_owner
+ // meaning the containing SM from which the exit occurs
+ typedef typename ::boost::mpl::eval_if<
+ typename has_pseudo_exit<T1>::type,
+ get_owner<T1,library_sm>,
+ ::boost::mpl::identity<typename ROW::Source> >::type current_state_type;
+
+ // if Target is a sequence, then we have a fork and expect a sequence of explicit_entry
+ // else if Target is an explicit_entry, next_state_type becomes the result of get_owner
+ // meaning the containing SM if the row is "outside" the containing SM or else the explicit_entry state itself
+ typedef typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::is_sequence<T2>::type,
+ get_fork_owner<T2,library_sm>,
+ ::boost::mpl::eval_if<
+ typename has_no_automatic_create<T2>::type,
+ get_owner<T2,library_sm>,
+ ::boost::mpl::identity<T2> >
+ >::type next_state_type;
+
+ // if a guard condition is defined, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list ))
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int region_index, int state, transition_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));
+ BOOST_ASSERT(state == (current_state));
+ // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active
+ if (has_pseudo_exit<T1>::type::value &&
+ !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
+ {
+ return HANDLED_FALSE;
+ }
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+ // the guard condition has already been checked
+ execute_exit<current_state_type>
+ (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),evt,fsm);
+
+ // 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);
+
+ fsm.m_states[region_index]=next_state;
+ return HANDLED_TRUE;
+ }
+ };
+
+ // row having only an action method
+ template<
+ typename ROW
+ >
+ struct a_row_
+ {
+ //typedef typename ROW::Source T1;
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ // if the source is an exit pseudo state, then
+ // current_state_type becomes the result of get_owner
+ // meaning the containing SM from which the exit occurs
+ typedef typename ::boost::mpl::eval_if<
+ typename has_pseudo_exit<T1>::type,
+ get_owner<T1,library_sm>,
+ ::boost::mpl::identity<typename ROW::Source> >::type current_state_type;
+
+ // if Target is a sequence, then we have a fork and expect a sequence of explicit_entry
+ // else if Target is an explicit_entry, next_state_type becomes the result of get_owner
+ // meaning the containing SM if the row is "outside" the containing SM or else the explicit_entry state itself
+ typedef typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::is_sequence<T2>::type,
+ get_fork_owner<T2,library_sm>,
+ ::boost::mpl::eval_if<
+ typename has_no_automatic_create<T2>::type,
+ get_owner<T2,library_sm>,
+ ::boost::mpl::identity<T2> >
+ >::type next_state_type;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int region_index, int state, transition_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));
+ BOOST_ASSERT(state == (current_state));
+
+ // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active
+ if (has_pseudo_exit<T1>::type::value &&
+ !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
+ {
+ return HANDLED_FALSE;
+ }
+ // no need to check the guard condition
+ // first call the exit method of the current state
+ execute_exit<current_state_type>
+ (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),evt,fsm);
+
+ // then call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list);
+
+ // 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);
+
+ fsm.m_states[region_index]=next_state;
+ return res;
+ }
+ };
+
+ // row having no guard condition or action, simply transitions
+ template<
+ typename ROW
+ >
+ struct _row_
+ {
+ //typedef typename ROW::Source T1;
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ // if the source is an exit pseudo state, then
+ // current_state_type becomes the result of get_owner
+ // meaning the containing SM from which the exit occurs
+ typedef typename ::boost::mpl::eval_if<
+ typename has_pseudo_exit<T1>::type,
+ get_owner<T1,library_sm>,
+ ::boost::mpl::identity<typename ROW::Source> >::type current_state_type;
+
+ // if Target is a sequence, then we have a fork and expect a sequence of explicit_entry
+ // else if Target is an explicit_entry, next_state_type becomes the result of get_owner
+ // meaning the containing SM if the row is "outside" the containing SM or else the explicit_entry state itself
+ typedef typename ::boost::mpl::eval_if<
+ typename ::boost::mpl::is_sequence<T2>::type,
+ get_fork_owner<T2,library_sm>,
+ ::boost::mpl::eval_if<
+ typename has_no_automatic_create<T2>::type,
+ get_owner<T2,library_sm>,
+ ::boost::mpl::identity<T2> >
+ >::type next_state_type;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int region_index, int state, transition_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));
+ BOOST_ASSERT(state == (current_state));
+
+ // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active
+ if (has_pseudo_exit<T1>::type::value &&
+ !is_exit_state_active<T1,get_owner<T1,library_sm> >(fsm))
+ {
+ return HANDLED_FALSE;
+ }
+ // first call the exit method of the current state
+ execute_exit<current_state_type>
+ (::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),evt,fsm);
+
+ // 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);
+
+ fsm.m_states[region_index]=next_state;
+ return HANDLED_TRUE;
+ }
+ };
+ // "i" rows are rows for internal transitions
+ template<
+ typename ROW
+ >
+ struct irow_
+ {
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ typedef typename ROW::Source current_state_type;
+ typedef T2 next_state_type;
+
+ // if a guard condition is here, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list))
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt)
+ {
+
+ BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
+ BOOST_ASSERT(state == (current_state));
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+
+ // call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list);
+ return res;
+ }
+ };
+
+ // row having only a guard condition
+ template<
+ typename ROW
+ >
+ struct g_irow_
+ {
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ typedef typename ROW::Source current_state_type;
+ typedef T2 next_state_type;
+
+ // if a guard condition is defined, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list) )
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt)
+ {
+ BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
+ BOOST_ASSERT(state == (current_state));
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+ return HANDLED_TRUE;
+ }
+ };
+
+ // row having only an action method
+ template<
+ typename ROW
+ >
+ struct a_irow_
+ {
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+
+ typedef typename ROW::Evt transition_event;
+ typedef typename ROW::Source current_state_type;
+ typedef T2 next_state_type;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt)
+ {
+ BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
+ BOOST_ASSERT(state == (current_state));
+
+ // call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<current_state_type>(fsm.m_substate_list),
+ ::boost::fusion::at_key<next_state_type>(fsm.m_substate_list),
+ fsm.m_substate_list);
+
+ return res;
+ }
+ };
+ // row simply ignoring the event
+ template<
+ typename ROW
+ >
+ struct _irow_
+ {
+ typedef typename make_entry<typename ROW::Source,library_sm>::type T1;
+ typedef typename make_exit<typename ROW::Target,library_sm>::type T2;
+ typedef typename ROW::Evt transition_event;
+ typedef typename ROW::Source current_state_type;
+ typedef T2 next_state_type;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& , int , int state, transition_event const& )
+ {
+ BOOST_STATIC_CONSTANT(int, current_state = (get_state_id<stt,current_state_type>::type::value));
+ BOOST_ASSERT(state == (current_state));
+ return HANDLED_TRUE;
+ }
+ };
+ // transitions internal to this state machine (no substate involved)
+ template<
+ typename ROW,
+ typename StateType
+ >
+ struct internal_
+ {
+ typedef StateType current_state_type;
+ typedef StateType next_state_type;
+ typedef typename ROW::Evt transition_event;
+
+ // if a guard condition is here, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ fsm.m_substate_list) )
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt)
+ {
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+
+ // then call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ fsm.m_substate_list);
+ return res;
+ }
+ };
+ template<
+ typename ROW,
+ typename StateType
+ >
+ struct a_internal_
+ {
+ typedef StateType current_state_type;
+ typedef StateType next_state_type;
+ typedef typename ROW::Evt transition_event;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int, int, transition_event const& evt)
+ {
+ // then call the action method
+ HandledEnum res = ROW::action_call(fsm,evt,
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ fsm.m_substate_list);
+ return res;
+ }
+ };
+ template<
+ typename ROW,
+ typename StateType
+ >
+ struct g_internal_
+ {
+ typedef StateType current_state_type;
+ typedef StateType next_state_type;
+ typedef typename ROW::Evt transition_event;
+
+ // if a guard condition is here, call it to check that the event is accepted
+ static bool check_guard(library_sm& fsm,transition_event const& evt)
+ {
+ if ( ROW::guard_call(fsm,evt,
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ ::boost::fusion::at_key<StateType>(fsm.m_substate_list),
+ fsm.m_substate_list) )
+ return true;
+ return false;
+ }
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int, int, transition_event const& evt)
+ {
+ if (!check_guard(fsm,evt))
+ {
+ // guard rejected the event, we stay in the current one
+ return HANDLED_GUARD_REJECT;
+ }
+ return HANDLED_TRUE;
+ }
+ };
+ template<
+ typename ROW,
+ typename StateType
+ >
+ struct _internal_
+ {
+ typedef StateType current_state_type;
+ typedef StateType next_state_type;
+ typedef typename ROW::Evt transition_event;
+ static HandledEnum execute(library_sm& , int , int , transition_event const& )
+ {
+ return HANDLED_TRUE;
+ }
+ };
+ // Template used to form forwarding rows in the transition table for every row of a composite SM
+ template<
+ typename T1
+ , class Evt
+ >
+ struct frow
+ {
+ typedef T1 current_state_type;
+ typedef T1 next_state_type;
+ typedef Evt transition_event;
+
+ // Take the transition action and return the next state.
+ static HandledEnum execute(library_sm& fsm, int region_index, int , transition_event const& evt)
+ {
+ execute_return 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 Tag, class Transition,class StateType>
+ struct create_backend_stt
+ {
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<g_row_tag,Transition,StateType>
+ {
+ typedef g_row_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<a_row_tag,Transition,StateType>
+ {
+ typedef a_row_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<_row_tag,Transition,StateType>
+ {
+ typedef _row_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<row_tag,Transition,StateType>
+ {
+ typedef row_<Transition> type;
+ };
+ // internal transitions
+ template <class Transition,class StateType>
+ struct create_backend_stt<g_irow_tag,Transition,StateType>
+ {
+ typedef g_irow_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<a_irow_tag,Transition,StateType>
+ {
+ typedef a_irow_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<irow_tag,Transition,StateType>
+ {
+ typedef irow_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<_irow_tag,Transition,StateType>
+ {
+ typedef _irow_<Transition> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<sm_a_i_row_tag,Transition,StateType>
+ {
+ typedef a_internal_<Transition,StateType> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<sm_g_i_row_tag,Transition,StateType>
+ {
+ typedef g_internal_<Transition,StateType> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<sm_i_row_tag,Transition,StateType>
+ {
+ typedef internal_<Transition,StateType> type;
+ };
+ template <class Transition,class StateType>
+ struct create_backend_stt<sm__i_row_tag,Transition,StateType>
+ {
+ typedef _internal_<Transition,StateType> type;
+ };
+ template <class Transition,class StateType=void>
+ struct make_row_tag
+ {
+ typedef typename create_backend_stt<typename Transition::row_type_tag,Transition,StateType>::type type;
+ };
+
+ // add to the stt the initial states which could be missing (if not being involved in a transition)
+ template <class BaseType, class stt_simulated = typename BaseType::transition_table>
+ struct create_real_stt
+ {
+ //typedef typename BaseType::transition_table stt_simulated;
+ typedef typename ::boost::mpl::fold<
+ stt_simulated,mpl::vector0<>,
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ make_row_tag< ::boost::mpl::placeholders::_2 , BaseType > >
+ >::type type;
+ };
+
+ template <class Table,class Intermediate,class StateType>
+ struct add_forwarding_row_helper
+ {
+ typedef typename generate_event_set<Table>::type all_events;
+ typedef typename ::boost::mpl::fold<
+ all_events, Intermediate,
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ frow<StateType, ::boost::mpl::placeholders::_2> > >::type type;
+ };
+ // gets the transition table from a composite and make from it a forwarding row
+ template <class StateType,class IsComposite>
+ struct get_internal_transition_table
+ {
+ // first get the table of a composite
+ typedef typename recursive_get_transition_table<StateType>::type original_table;
+
+ // add the internal events defined in the internal_transition_table
+ // Note: these are added first because they must have a lesser prio
+ // than the deeper transitions in the sub regions
+ typedef typename StateType::internal_transition_table istt_simulated;
+ typedef typename ::boost::mpl::fold<
+ istt_simulated,::boost::mpl::vector0<>,
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ make_row_tag< ::boost::mpl::placeholders::_2 , StateType> >
+ >::type intermediate;
+
+ // and add for every event a forwarding row
+ typedef typename ::boost::mpl::eval_if<
+ typename CompilePolicy::add_forwarding_rows,
+ add_forwarding_row_helper<original_table,intermediate,StateType>,
+ ::boost::mpl::identity<intermediate>
+ >::type type;
+ };
+ template <class StateType>
+ struct get_internal_transition_table<StateType, ::boost::mpl::false_ >
+ {
+ typedef typename create_real_stt<StateType, typename StateType::internal_transition_table >::type type;
+ };
+ typedef typename create_real_stt<Derived>::type real_transition_table;
+ typedef typename create_stt<library_sm>::type stt;
+ typedef typename get_initial_states<typename Derived::initial_state>::type initial_states;
+ typedef typename generate_state_set<stt>::type state_list;
+ typedef typename HistoryPolicy::template apply<nr_regions::value>::type concrete_history;
+
+ typedef typename ::boost::fusion::result_of::as_set<state_list>::type substate_list;
+
+ // extends the transition table with rows from composite states
+ template <class Composite>
+ struct extend_table
+ {
+ // add the init states
+ //typedef typename create_stt<Composite>::type stt;
+ typedef typename Composite::stt Stt;
+ // for every state, add its transition table (if any)
+ // transformed as frow
+ typedef typename ::boost::mpl::fold<state_list,Stt,
+ ::boost::mpl::insert_range<
+ ::boost::mpl::placeholders::_1,
+ ::boost::mpl::end< ::boost::mpl::placeholders::_1>,
+ get_internal_transition_table<
+ ::boost::mpl::placeholders::_2,
+ is_composite_state< ::boost::mpl::placeholders::_2> > >
+ >::type type;
+ };
+ // extend the table with tables from composite states
+ typedef typename extend_table<library_sm>::type complete_table;
+ // build a sequence of regions
+ typedef typename get_regions_as_sequence<typename Derived::initial_state>::type seq_initial_states;
+ // Member functions
+
+ // start the state machine (calls entry of the initial state)
+ void start()
+ {
+ // call on_entry on this SM
+ (static_cast<Derived*>(this))->on_entry(fsm_initial_event(),*this);
+ ::boost::mpl::for_each<initial_states, boost::msm::wrap<mpl::placeholders::_1> >
+ (call_init<fsm_initial_event>(fsm_initial_event(),this));
+ // give a chance to handle an anonymous (eventless) transition
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,true);
+ eventless_helper.process_completion_event();
+ }
+
+ // start the state machine (calls entry of the initial state passing incomingEvent to on_entry's)
+ template <class Event>
+ void start(Event const& incomingEvent)
+ {
+ // call on_entry on this SM
+ (static_cast<Derived*>(this))->on_entry(incomingEvent,*this);
+ ::boost::mpl::for_each<initial_states, boost::msm::wrap<mpl::placeholders::_1> >
+ (call_init<Event>(incomingEvent,this));
+ // give a chance to handle an anonymous (eventless) transition
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,true);
+ eventless_helper.process_completion_event();
+ }
+
+ // stop the state machine (calls exit of the current state)
+ void stop()
+ {
+ do_exit(fsm_final_event(),*this);
+ }
+
+ // stop the state machine (calls exit of the current state passing finalEvent to on_exit's)
+ template <class Event>
+ void stop(Event const& finalEvent)
+ {
+ do_exit(finalEvent,*this);
+ }
+
+ // Main function used by clients of the derived FSM to make
+ // transitions. Can also be called for internally (for example in an action method) generated events.
+ template<class Event>
+ execute_return process_event(Event const& evt)
+ {
+ HandledEnum ret_handled=HANDLED_FALSE;
+ // if the state machine has terminate or interrupt flags, check them, otherwise skip
+ 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<Event>
+ (evt,::boost::mpl::bool_<is_no_message_queue<library_sm>::type::value>()) )
+ {
+ // wait for the end of current processing
+ return HANDLED_TRUE;
+ }
+ else
+ {
+ // prepare the next deferred event for handling
+ // if one defer is found in the SM, otherwise skip
+ 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<Event>
+ (evt,::boost::mpl::bool_<is_no_exception_thrown<library_sm>::type::value>());
+ if (handled)
+ {
+ ret_handled = HANDLED_TRUE;
+ }
+
+ // process completion transitions BEFORE any other event in the pool (UML Standard 2.3 §15.3.14)
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,(handled == HANDLED_TRUE));
+ eventless_helper.process_completion_event();
+
+ // after handling, take care of the deferred events
+ defer_helper.do_post_handle_deferred(handled);
+
+ // 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(::boost::mpl::bool_<is_no_message_queue<library_sm>::type::value>());
+
+ return ret_handled;
+ }
+ }
+
+ template <class EventType>
+ void enqueue_event_helper(EventType const& evt, ::boost::mpl::false_ const &)
+ {
+ execute_return (library_sm::*pf) (EventType const& evt) =
+ &library_sm::process_event;
+
+ transition_fct f = ::boost::bind(pf,this,evt);
+ m_events_queue.m_events_queue.push_back(f);
+ }
+ template <class EventType>
+ void enqueue_event_helper(EventType const& evt, ::boost::mpl::true_ const &)
+ {
+ // no queue
+ }
+
+ void execute_queued_events_helper(::boost::mpl::false_ const &)
+ {
+ transition_fct to_call = m_events_queue.m_events_queue.front();
+ m_events_queue.m_events_queue.pop_front();
+ to_call();
+ }
+ void execute_queued_events_helper(::boost::mpl::true_ const &)
+ {
+ // no queue required
+ }
+
+ // enqueues an event in the message queue
+ // call execute_queued_events to process all queued events.
+ // Be careful if you do this during event processing, the event will be processed immediately
+ // and not kept in the queue
+ template <class EventType>
+ void enqueue_event(EventType const& evt)
+ {
+ enqueue_event_helper<EventType>(evt, typename is_no_message_queue<library_sm>::type());
+ }
+
+ // empty the queue and process events
+ void execute_queued_events()
+ {
+ execute_queued_events_helper(typename is_no_message_queue<library_sm>::type());
+ }
+
+ typename events_queue_t::size_type get_message_queue_size() const
+ {
+ return m_events_queue.m_events_queue.size();
+ }
+
+ events_queue_t& get_message_queue()
+ {
+ return m_events_queue.m_events_queue;
+ }
+
+ const events_queue_t& get_message_queue() const
+ {
+ return m_events_queue.m_events_queue;
+ }
+
+ deferred_events_queue_t& get_deferred_queue()
+ {
+ return m_deferred_events_queue;
+ }
+
+ const deferred_events_queue_t& get_deferred_queue() const
+ {
+ return m_deferred_events_queue;
+ }
+
+ // Getter that returns the current state of the FSM
+ const int* current_state() const
+ {
+ return this->m_states;
+ }
+
+ template <class Archive>
+ struct serialize_state
+ {
+ serialize_state(Archive& ar):ar_(ar){}
+
+ template<typename T>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::or_<
+ typename has_do_serialize<T>::type,
+ typename is_composite_state<T>::type
+ >::type
+ ,void
+ >::type
+ operator()(T& t) const
+ {
+ ar_ & t;
+ }
+ template<typename T>
+ typename ::boost::disable_if<
+ typename ::boost::mpl::or_<
+ typename has_do_serialize<T>::type,
+ typename is_composite_state<T>::type
+ >::type
+ ,void
+ >::type
+ operator()(T& t) const
+ {
+ // no state to serialize
+ }
+ Archive& ar_;
+ };
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int)
+ {
+ // invoke serialization of the base class
+ (serialize_state<Archive>(ar))(boost::serialization::base_object<Derived>(*this));
+ // now our attributes
+ ar & m_states;
+ // queues cannot be serialized => skip
+ ar & m_history;
+ ar & m_event_processing;
+ ar & m_is_included;
+ // visitors cannot be serialized => skip
+ ::boost::fusion::for_each(m_substate_list, serialize_state<Archive>(ar));
+ }
+
+ // linearly search for the state with the given id
+ struct get_state_id_helper
+ {
+ get_state_id_helper(int id,const BaseState** res,const library_sm* self_):
+ result_state(res),searched_id(id),self(self_) {}
+
+ template <class StateType>
+ 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));
+ if (!*result_state && (id == searched_id))
+ {
+ *result_state = &::boost::fusion::at_key<StateType>(self->m_substate_list);
+ }
+ }
+ const BaseState** result_state;
+ int searched_id;
+ const library_sm* self;
+ };
+ // return the state whose id is passed or 0 if not found
+ // caution if you need this, you probably need polymorphic states
+ // complexity: O(number of states)
+ BaseState* get_state_by_id(int id)
+ {
+ const BaseState* result_state=0;
+ ::boost::mpl::for_each<state_list,
+ ::boost::msm::wrap< ::boost::mpl::placeholders::_1> > (get_state_id_helper(id,&result_state,this));
+ return const_cast<BaseState*>(result_state);
+ }
+ const BaseState* get_state_by_id(int id) const
+ {
+ const BaseState* result_state=0;
+ ::boost::mpl::for_each<state_list,
+ ::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
+ bool is_contained() const
+ {
+ return m_is_included;
+ }
+ // get the history policy class
+ concrete_history& get_history()
+ {
+ return m_history;
+ }
+ concrete_history const& get_history() const
+ {
+ return m_history;
+ }
+ // get a state (const version)
+ // as a pointer
+ template <class State>
+ typename ::boost::enable_if<typename ::boost::is_pointer<State>::type,State >::type
+ get_state(::boost::msm::back::dummy<0> = 0) const
+ {
+ return const_cast<State >
+ (&
+ (::boost::fusion::at_key<
+ typename ::boost::remove_const<typename ::boost::remove_pointer<State>::type>::type>(m_substate_list)));
+ }
+ // as a reference
+ template <class State>
+ typename ::boost::enable_if<typename ::boost::is_reference<State>::type,State >::type
+ get_state(::boost::msm::back::dummy<1> = 0) const
+ {
+ return const_cast<State >
+ ( ::boost::fusion::at_key<
+ typename ::boost::remove_const<typename ::boost::remove_reference<State>::type>::type>(m_substate_list) );
+ }
+ // get a state (non const version)
+ // as a pointer
+ template <class State>
+ typename ::boost::enable_if<typename ::boost::is_pointer<State>::type,State >::type
+ get_state(::boost::msm::back::dummy<0> = 0)
+ {
+ return &(static_cast<typename boost::add_reference<typename ::boost::remove_pointer<State>::type>::type >
+ (::boost::fusion::at_key<typename ::boost::remove_pointer<State>::type>(m_substate_list)));
+ }
+ // as a reference
+ template <class State>
+ typename ::boost::enable_if<typename ::boost::is_reference<State>::type,State >::type
+ get_state(::boost::msm::back::dummy<1> = 0)
+ {
+ return ::boost::fusion::at_key<typename ::boost::remove_reference<State>::type>(m_substate_list);
+ }
+ // checks if a flag is active using the BinaryOp as folding function
+ template <class Flag,class BinaryOp>
+ bool is_flag_active() const
+ {
+ flag_handler* flags_entries = get_entries_for_flag<Flag>();
+
+ return std::accumulate(m_states,
+ m_states+nr_regions::value,false,
+ ::boost::bind(typename BinaryOp::type(),
+ ::boost::bind(::boost::apply<bool>(),
+ ::boost::bind(::boost::msm::back::deref<flag_handler>(),
+ ::boost::bind(::boost::msm::back::plus2<flag_handler*,int>(),
+ flags_entries, _2)),
+ ::boost::cref(*this)), _1));
+ }
+ // checks if a flag is active using no binary op if 1 region, or OR if > 1 regions
+ template <class Flag>
+ bool is_flag_active() const
+ {
+ return FlagHelper<Flag,(nr_regions::value>1)>::helper(*this,get_entries_for_flag<Flag>());
+ }
+ // visit the currently active states (if these are defined as visitable
+ // by implementing accept)
+ void visit_current_states()
+ {
+ for (int i=0; i<nr_regions::value;++i)
+ {
+ m_visitors.execute(m_states[i]);
+ }
+ }
+#define MSM_VISIT_STATE_SUB(z, n, unused) ARG ## n vis ## n
+#define MSM_VISIT_STATE_EXECUTE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ void visit_current_states(BOOST_PP_ENUM(n, MSM_VISIT_STATE_SUB, ~ ) ) \
+ { \
+ for (int i=0; i<nr_regions::value;++i) \
+ { \
+ m_visitors.execute(m_states[i],BOOST_PP_ENUM_PARAMS(n,vis)); \
+ } \
+ }
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISIT_STATE_EXECUTE, ~)
+#undef MSM_VISIT_STATE_EXECUTE
+#undef MSM_VISIT_STATE_SUB
+
+ // puts the given event into the deferred queue
+ template <class Event>
+ void defer_event(Event const& e)
+ {
+ // to call this function, you need either a state with a deferred_events typedef
+ // or that the fsm provides the activate_deferred_events typedef
+ BOOST_MPL_ASSERT(( has_fsm_deferred_events<library_sm> ));
+ execute_return (library_sm::*pf) (Event const& evt)= &library_sm::process_event;
+ Event temp (e);
+ ::boost::function<execute_return () > f= ::boost::bind(pf, this,temp);
+ post_deferred_event(f);
+ }
+
+ protected: // interface for the derived class
+
+ // helper used to fill the initial states
+ struct init_states
+ {
+ init_states(int* const init):m_initial_states(init),m_index(-1){}
+
+ // History initializer function object, used with mpl::for_each
+ template <class State>
+ void operator()(::boost::msm::wrap<State> const&)
+ {
+ m_initial_states[++m_index]=get_state_id<stt,State>::type::value;
+ }
+ int* const m_initial_states;
+ int m_index;
+ };
+ 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<A0,A1,A2,A3,A4 >()
+ :Derived()
+ ,m_events_queue()
+ ,m_deferred_events_queue()
+ ,m_history()
+ ,m_event_processing(false)
+ ,m_is_included(false)
+ ,m_visitors()
+ ,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::wrap<mpl::placeholders::_1> >
+ (init_states(m_states));
+ m_history.set_initial_states(m_states);
+ // create states
+ fill_states(this);
+ }
+ template <class Expr>
+ state_machine<A0,A1,A2,A3,A4 >
+ (Expr const& expr,typename ::boost::enable_if<typename ::boost::proto::is_expr<Expr>::type >::type* =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<A0,A1,A2,A3,A4 \
+ >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \
+ typename ::boost::disable_if<typename ::boost::proto::is_expr<ARG0>::type >::type* =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::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); \
+ } \
+ template <class Expr,BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ state_machine<A0,A1,A2,A3,A4 \
+ >(Expr const& expr,BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \
+ typename ::boost::enable_if<typename ::boost::proto::is_expr<Expr>::type >::type* =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
+
+
+
+ // assignment operator using the copy policy to decide if non_copyable, shallow or deep copying is necessary
+ library_sm& operator= (library_sm const& rhs)
+ {
+ if (this != &rhs)
+ {
+ Derived::operator=(rhs);
+ // initialize our list of states with the ones defined in Derived::initial_state
+ fill_states(this);
+ do_copy(rhs);
+ }
+ return *this;
+ }
+ state_machine<A0,A1,A2,A3,A4>
+ (library_sm const& rhs)
+ : Derived(rhs)
+ {
+ if (this != &rhs)
+ {
+ // initialize our list of states with the ones defined in Derived::initial_state
+ fill_states(this);
+ do_copy(rhs);
+ }
+ }
+
+ // the following 2 functions handle the terminate/interrupt states handling
+ // if one of these states is found, the first one is used
+ 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>())
+ return true;
+ // if the state machine is interrupted, do not handle any event
+ // unless the event is the end interrupt event
+ if ( is_flag_active< ::boost::msm::InterruptedFlag>() &&
+ !is_flag_active< ::boost::msm::EndInterruptFlag<Event> >())
+ return true;
+ return false;
+ }
+ // otherwise simple handling, no flag => continue
+ 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>
+ bool do_pre_msg_queue_helper(EventType const& evt, ::boost::mpl::true_ const &)
+ {
+ // no message queue needed
+ return true;
+ }
+ template <class StateType,class EventType>
+ 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;
+ // if we are already processing an event
+ if (m_event_processing)
+ {
+ // event has to be put into the queue
+ transition_fct f = ::boost::bind(pf,this,evt);
+ m_events_queue.m_events_queue.push_back(f);
+ return false;
+ }
+ // event can be handled, processing
+ m_event_processing = true;
+ return true;
+ }
+ void do_post_msg_queue_helper( ::boost::mpl::true_ const &)
+ {
+ // no message queue needed
+ }
+ void do_post_msg_queue_helper( ::boost::mpl::false_ const &)
+ {
+ m_event_processing = false;
+ process_message_queue(this);
+ }
+ // the following 2 functions handle the processing either with a try/catch protection or without
+ template <class StateType,class EventType>
+ HandledEnum do_process_helper(EventType const& evt, ::boost::mpl::true_ const &)
+ {
+ return this->do_process_event(evt);
+ }
+ template <class StateType,class EventType>
+ HandledEnum do_process_helper(EventType const& evt, ::boost::mpl::false_ const &)
+ {
+ try
+ {
+ return this->do_process_event(evt);
+ }
+ catch (std::exception& e)
+ {
+ // give a chance to the concrete state machine to handle
+ this->exception_caught(evt,*this,e);
+ }
+ return HANDLED_FALSE;
+ }
+ // handling of deferred events
+ // if none is found in the SM, take the following empty main version
+ template <class StateType, class Enable = int>
+ struct handle_defer_helper
+ {
+ handle_defer_helper(deferred_msg_queue_helper<library_sm>& ){}
+ void do_pre_handle_deferred()
+ {
+ }
+
+ void do_post_handle_deferred(HandledEnum)
+ {
+ }
+ };
+ // otherwise the standard version handling the deferred events
+ template <class StateType>
+ struct handle_defer_helper
+ <StateType, typename enable_if< typename ::boost::msm::back::has_fsm_deferred_events<StateType>::type,int >::type>
+ {
+ 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.m_deferred_events_queue.empty())
+ {
+ next_deferred_event = events_queue.m_deferred_events_queue.back();
+ events_queue.m_deferred_events_queue.pop_back();
+ }
+ }
+
+ void do_post_handle_deferred(HandledEnum handled)
+ {
+ if (((handled & HANDLED_DEFERRED) == HANDLED_DEFERRED) && next_deferred_event )
+ {
+ // the event was already deferred, no reason to process another deferred event
+ events_queue.m_deferred_events_queue.push_back(next_deferred_event);
+ return;
+ }
+ else if (next_deferred_event)
+ {
+ next_deferred_event();
+ }
+ }
+
+ private:
+ deferred_msg_queue_helper<library_sm>& events_queue;
+ deferred_fct next_deferred_event;
+ };
+
+ // handling of eventless transitions
+ // if none is found in the SM, nothing to do
+ template <class StateType, class Enable = void>
+ struct handle_eventless_transitions_helper
+ {
+ handle_eventless_transitions_helper(library_sm* , bool ){}
+ void process_completion_event(){}
+ };
+ // otherwise
+ template <class StateType>
+ struct handle_eventless_transitions_helper
+ <StateType, typename enable_if< typename ::boost::msm::back::has_fsm_eventless_transition<StateType>::type >::type>
+ {
+ handle_eventless_transitions_helper(library_sm* self_, bool handled_):self(self_),handled(handled_){}
+ void process_completion_event()
+ {
+ typedef typename ::boost::mpl::deref<
+ typename ::boost::mpl::begin<
+ typename find_completion_events<StateType>::type
+ >::type
+ >::type first_completion_event;
+ if (handled)
+ {
+ self->process_event(first_completion_event() );
+ }
+ }
+
+ private:
+ library_sm* self;
+ 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,CompilePolicy> 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,CompilePolicy> 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> >::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& ,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,CompilePolicy> table;
+ In< ::boost::mpl::int_<0> >::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)
+ {
+ HandledEnum handled = HANDLED_FALSE;
+ // dispatch the event to every region
+ 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
+ // but let the containing sm handle the error
+ // completion events do not produce an error
+ if (!handled && !is_contained() && !is_completion_event<Event>::type::value)
+ {
+ for (int i=0; i<nr_regions::value;++i)
+ {
+ this->no_transition(evt,*this,this->m_states[i]);
+ }
+ }
+ return handled;
+ }
+
+ // default row arguments for the compilers which accept this
+ template <class Event>
+ bool no_guard(Event const&){return true;}
+ template <class Event>
+ void no_action(Event const&){}
+
+ HandledEnum process_any_event( any_event const& evt) const;
+
+private:
+ // composite accept implementation. First calls accept on the composite, then accept on all its active states.
+ void composite_accept()
+ {
+ this->accept();
+ this->visit_current_states();
+ }
+
+#define MSM_COMPOSITE_ACCEPT_SUB(z, n, unused) ARG ## n vis ## n
+#define MSM_COMPOSITE_ACCEPT_EXECUTE(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ void composite_accept(BOOST_PP_ENUM(n, MSM_COMPOSITE_ACCEPT_SUB, ~ ) ) \
+ { \
+ this->accept(BOOST_PP_ENUM_PARAMS(n,vis)); \
+ this->visit_current_states(BOOST_PP_ENUM_PARAMS(n,vis)); \
+ }
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_COMPOSITE_ACCEPT_EXECUTE, ~)
+#undef MSM_COMPOSITE_ACCEPT_EXECUTE
+#undef MSM_COMPOSITE_ACCEPT_SUB
+
+ // helper used to call the init states at the start of the state machine
+ template <class Event>
+ struct call_init
+ {
+ call_init(Event const& an_event,library_sm* self_):
+ evt(an_event),self(self_){}
+ template <class State>
+ void operator()(boost::msm::wrap<State> const&)
+ {
+ execute_entry(::boost::fusion::at_key<State>(self->m_substate_list),evt,*self);
+ }
+ private:
+ Event const& evt;
+ library_sm* self;
+ };
+ // helper for flag handling. Uses OR by default on orthogonal zones.
+ template <class Flag,bool orthogonalStates>
+ struct FlagHelper
+ {
+ static bool helper(library_sm const& sm,flag_handler* )
+ {
+ // by default we use OR to accumulate the flags
+ return sm.is_flag_active<Flag,Flag_OR>();
+ }
+ };
+ template <class Flag>
+ struct FlagHelper<Flag,false>
+ {
+ static bool helper(library_sm const& sm,flag_handler* flags_entries)
+ {
+ // just one active state, so we can call operator[] with 0
+ return flags_entries[sm.current_state()[0]](sm);
+ }
+ };
+ // handling of flag
+ // defines a true and false functions plus a forwarding one for composite states
+ template <class StateType,class Flag>
+ struct FlagHandler
+ {
+ static bool flag_true(library_sm const& )
+ {
+ return true;
+ }
+ static bool flag_false(library_sm const& )
+ {
+ return false;
+ }
+ static bool forward(library_sm const& fsm)
+ {
+ return ::boost::fusion::at_key<StateType>(fsm.m_substate_list).template is_flag_active<Flag>();
+ }
+ };
+ template <class Flag>
+ struct init_flags
+ {
+ private:
+ // helper function, helps hiding the forward function for non-state machines states.
+ template <class T>
+ void helper (flag_handler* an_entry,int offset, ::boost::mpl::true_ const & )
+ {
+ // composite => forward
+ an_entry[offset] = &FlagHandler<T,Flag>::forward;
+ }
+ template <class T>
+ void helper (flag_handler* an_entry,int offset, ::boost::mpl::false_ const & )
+ {
+ // default no flag
+ an_entry[offset] = &FlagHandler<T,Flag>::flag_false;
+ }
+ // attributes
+ flag_handler* entries;
+
+ public:
+ init_flags(flag_handler* entries_)
+ : entries(entries_)
+ {}
+
+ // Flags initializer function object, used with mpl::for_each
+ template <class StateType>
+ void operator()( ::boost::msm::wrap<StateType> const& )
+ {
+ typedef typename StateType::flag_list flags;
+ typedef typename ::boost::mpl::contains<flags,Flag >::type found;
+ typedef typename is_composite_state<StateType>::type composite;
+
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,StateType>::type::value));
+ if (found::type::value)
+ {
+ // the type defined the flag => true
+ entries[state_id] = &FlagHandler<StateType,Flag>::flag_true;
+ }
+ else
+ {
+ // false or forward
+ 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>());
+ }
+ }
+ };
+ // maintains for every flag a static array containing the flag value for every state
+ template <class Flag>
+ flag_handler* get_entries_for_flag() const
+ {
+ BOOST_STATIC_CONSTANT(int, max_state = (mpl::size<state_list>::value));
+
+ static flag_handler flags_entries[max_state];
+ // build a state list
+ ::boost::mpl::for_each<state_list, boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+ (init_flags<Flag>(flags_entries));
+ return flags_entries;
+ }
+
+ // helper used to create a state using the correct constructor
+ template <class State, class Enable=void>
+ struct create_state_helper
+ {
+ static void set_sm(library_sm* )
+ {
+ // state doesn't need its sm
+ }
+ };
+ // create a state requiring a pointer to the state machine
+ template <class State>
+ struct create_state_helper<State,typename boost::enable_if<typename State::needs_sm >::type>
+ {
+ static void set_sm(library_sm* sm)
+ {
+ // create and set the fsm
+ ::boost::fusion::at_key<State>(sm->m_substate_list).set_sm_ptr(sm);
+ }
+ };
+ // main unspecialized helper class
+ template <class StateType,int ARGS>
+ struct visitor_args;
+
+#define MSM_VISITOR_ARGS_SUB(z, n, unused) BOOST_PP_CAT(_,BOOST_PP_ADD(n,1))
+#define MSM_VISITOR_ARGS_TYPEDEF_SUB(z, n, unused) typename StateType::accept_sig::argument ## n
+
+#define MSM_VISITOR_ARGS_EXECUTE(z, n, unused) \
+ template <class StateType> \
+ struct visitor_args<StateType,n> \
+ { \
+ template <class State> \
+ static typename enable_if_c<!is_composite_state<State>::value,void >::type \
+ helper (library_sm* sm, \
+ int id,StateType& astate) \
+ { \
+ sm->m_visitors.insert(id, boost::bind(&StateType::accept, \
+ ::boost::ref(astate) BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, MSM_VISITOR_ARGS_SUB, ~) )); \
+ } \
+ template <class State> \
+ static typename enable_if_c<is_composite_state<State>::value,void >::type \
+ helper (library_sm* sm, \
+ int id,StateType& astate) \
+ { \
+ void (StateType::*caccept)(BOOST_PP_ENUM(n, MSM_VISITOR_ARGS_TYPEDEF_SUB, ~ ) ) \
+ = &StateType::composite_accept; \
+ sm->m_visitors.insert(id, boost::bind(caccept, \
+ ::boost::ref(astate) BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, MSM_VISITOR_ARGS_SUB, ~) )); \
+ } \
+};
+BOOST_PP_REPEAT(BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_ARGS_EXECUTE, ~)
+#undef MSM_VISITOR_ARGS_EXECUTE
+#undef MSM_VISITOR_ARGS_SUB
+
+// the IBM compiler seems to have problems with nested classes
+// the same seems to apply to the Apple version of gcc 4.0.1 (just in case we do for < 4.1)
+// and also to MS VC < 8
+#if defined (__IBMCPP__) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (defined(_MSC_VER) && (_MSC_VER < 1400))
+ public:
+#endif
+ template<class ContainingSM>
+ void set_containing_sm(ContainingSM* sm)
+ {
+ m_is_included=true;
+ ::boost::fusion::for_each(m_substate_list,add_state<ContainingSM>(this,sm));
+ }
+#if defined (__IBMCPP__) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (defined(_MSC_VER) && (_MSC_VER < 1400))
+ private:
+#endif
+ // A function object for use with mpl::for_each that stuffs
+ // states into the state list.
+ template<class ContainingSM>
+ struct add_state
+ {
+ add_state(library_sm* self_,ContainingSM* sm)
+ : self(self_),containing_sm(sm){}
+
+ // State is a sub fsm with exit pseudo states and gets a pointer to this fsm, so it can build a callback
+ template <class StateType>
+ typename ::boost::enable_if<
+ typename is_composite_state<StateType>::type,void >::type
+ new_state_helper(boost::msm::back::dummy<0> = 0) const
+ {
+ ::boost::fusion::at_key<StateType>(self->m_substate_list).set_containing_sm(containing_sm);
+ }
+ // State is a sub fsm without exit pseudo states and does not get a callback to this fsm
+ // or state is a normal state and needs nothing except creation
+ template <class StateType>
+ typename ::boost::enable_if<
+ typename boost::mpl::and_<typename boost::mpl::not_
+ <typename is_composite_state<StateType>::type>::type,
+ typename boost::mpl::not_
+ <typename is_pseudo_exit<StateType>::type>::type
+ >::type,void>::type
+ new_state_helper( ::boost::msm::back::dummy<1> = 0) const
+ {
+ //nothing to do
+ }
+ // state is exit pseudo state and gets callback to target fsm
+ template <class StateType>
+ typename ::boost::enable_if<typename is_pseudo_exit<StateType>::type,void >::type
+ new_state_helper( ::boost::msm::back::dummy<2> = 0) const
+ {
+ execute_return (ContainingSM::*pf) (typename StateType::event const& evt)=
+ &ContainingSM::process_event;
+ ::boost::function<execute_return (typename StateType::event const&)> fct =
+ ::boost::bind(pf,containing_sm,_1);
+ ::boost::fusion::at_key<StateType>(self->m_substate_list).set_forward_fct(fct);
+ }
+ // for every defined state in the sm
+ template <class State>
+ void operator()( State const&) const
+ {
+ //create a new state with the defined id and type
+ BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+
+ this->new_state_helper<State>(),
+ create_state_helper<State>::set_sm(self);
+ // create a visitor callback
+ 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>
+ 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>
+ void visitor_helper(int ,StateType& , ::boost::mpl::false_ const &) const
+ {
+ // nothing to do
+ }
+
+ library_sm* self;
+ ContainingSM* containing_sm;
+ };
+
+ // helper used to copy every state if needed
+ struct copy_helper
+ {
+ copy_helper(library_sm* sm):
+ m_sm(sm){}
+ template <class StateType>
+ 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
+ visitor_helper<StateType>(state_id);
+
+ // and for states that keep a pointer to the fsm, reset the pointer
+ create_state_helper<StateType>::set_sm(m_sm);
+ }
+ template <class StateType>
+ typename ::boost::enable_if<typename has_accept_sig<StateType>::type,void >::type
+ visitor_helper(int id) const
+ {
+ visitor_args<StateType,StateType::accept_sig::args_number>::template helper<StateType>
+ (m_sm,id,::boost::fusion::at_key<StateType>(m_sm->m_substate_list));
+ }
+ template <class StateType>
+ typename ::boost::disable_if<typename has_accept_sig<StateType>::type,void >::type
+ visitor_helper(int) const
+ {
+ // nothing to do
+ }
+
+ 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
+ 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;
+ m_event_processing = rhs.m_event_processing;
+ m_is_included = rhs.m_is_included;
+ m_substate_list = rhs.m_substate_list;
+ // except for the states themselves, which get duplicated
+
+ ::boost::mpl::for_each<state_list, ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+ (copy_helper(this));
+ }
+
+ // helper used to call the correct entry/exit method
+ // unfortunately in O(number of states in the sub-sm) but should be better than a virtual call
+ template<class Event,bool is_entry>
+ struct entry_exit_helper
+ {
+ entry_exit_helper(int id,Event const& e,library_sm* self_):
+ state_id(id),evt(e),self(self_){}
+ // helper for entry actions
+ template <class IsEntry,class State>
+ typename ::boost::enable_if<typename IsEntry::type,void >::type
+ helper( ::boost::msm::back::dummy<0> = 0)
+ {
+ BOOST_STATIC_CONSTANT(int, id = (get_state_id<stt,State>::value));
+ if (id == state_id)
+ {
+ execute_entry<State>(::boost::fusion::at_key<State>(self->m_substate_list),evt,*self);
+ }
+ }
+ // helper for exit actions
+ template <class IsEntry,class State>
+ typename boost::disable_if<typename IsEntry::type,void >::type
+ helper( ::boost::msm::back::dummy<1> = 0)
+ {
+ BOOST_STATIC_CONSTANT(int, id = (get_state_id<stt,State>::value));
+ if (id == state_id)
+ {
+ execute_exit<State>(::boost::fusion::at_key<State>(self->m_substate_list),evt,*self);
+ }
+ }
+ // iterates through all states to find the one to be activated
+ template <class State>
+ void operator()( ::boost::msm::wrap<State> const&)
+ {
+ entry_exit_helper<Event,is_entry>::template helper< ::boost::mpl::bool_<is_entry>,State >();
+ }
+ private:
+ int state_id;
+ Event const& evt;
+ library_sm* self;
+ };
+
+ // helper to start the fsm
+ template <class region_id,int Dummy=0>
+ struct region_start_helper
+ {
+ 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::wrap< ::boost::mpl::placeholders::_1> >
+ (entry_exit_helper<Event,true>(self_->m_states[region_id::value],incomingEvent,self_));
+ region_start_helper
+ < ::boost::mpl::int_<region_id::value+1> >::do_start(self_,incomingEvent);
+ }
+ };
+ 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 internal_start(Event const& incomingEvent)
+ {
+ region_start_helper< ::boost::mpl::int_<0> >::do_start(this,incomingEvent);
+ // give a chance to handle an anonymous (eventless) transition
+ handle_eventless_transitions_helper<library_sm> eventless_helper(this,true);
+ eventless_helper.process_completion_event();
+ }
+
+ template <class StateType>
+ struct find_region_id
+ {
+ template <int region,int Dummy=0>
+ struct In
+ {
+ enum {region_index=region};
+ };
+ // if the user provides no region, find it!
+ template<int Dummy>
+ struct In<-1,Dummy>
+ {
+ typedef typename build_orthogonal_regions<
+ library_sm,
+ typename Derived::initial_state
+ >::type all_regions;
+ enum {region_index= find_region_index<all_regions,StateType>::value };
+ };
+ enum {region_index = In<StateType::zone_index>::region_index };
+ };
+ // helper used to set the correct state as active state upon entry into a fsm
+ struct direct_event_start_helper
+ {
+ direct_event_start_helper(library_sm* self_):self(self_){}
+ // this variant is for the standard case, entry due to activation of the containing FSM
+ template <class EventType,class FsmType>
+ typename ::boost::disable_if<typename has_direct_entry<EventType>::type,void>::type
+ operator()(EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<0> = 0)
+ {
+ (static_cast<Derived*>(self))->on_entry(evt,fsm);
+ self->internal_start(evt);
+ }
+
+ // this variant is for the direct entry case (just one entry, not a sequence of entries)
+ template <class EventType,class FsmType>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::not_< typename is_pseudo_entry<
+ typename EventType::active_state>::type >::type,
+ typename ::boost::mpl::and_<typename has_direct_entry<EventType>::type,
+ typename ::boost::mpl::not_<typename ::boost::mpl::is_sequence
+ <typename EventType::active_state>::type >::type
+ >::type>::type,void
+ >::type
+ operator()(EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<1> = 0)
+ {
+ (static_cast<Derived*>(self))->on_entry(evt,fsm);
+ int state_id = get_state_id<stt,typename EventType::active_state::wrapped_entry>::value;
+ BOOST_STATIC_ASSERT(find_region_id<typename EventType::active_state::wrapped_entry>::region_index >= 0);
+ BOOST_STATIC_ASSERT(find_region_id<typename EventType::active_state::wrapped_entry>::region_index <= nr_regions::value);
+ // just set the correct zone, the others will be default/history initialized
+ self->m_states[find_region_id<typename EventType::active_state::wrapped_entry>::region_index] = state_id;
+ self->internal_start(evt.m_event);
+ }
+
+ // this variant is for the fork entry case (a sequence on entries)
+ template <class EventType,class FsmType>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::not_<
+ typename is_pseudo_entry<typename EventType::active_state>::type >::type,
+ typename ::boost::mpl::and_<typename has_direct_entry<EventType>::type,
+ typename ::boost::mpl::is_sequence<
+ typename EventType::active_state>::type
+ >::type>::type,void
+ >::type
+ operator()(EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<2> = 0)
+ {
+ (static_cast<Derived*>(self))->on_entry(evt,fsm);
+ ::boost::mpl::for_each<typename EventType::active_state,
+ ::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->internal_start(evt.m_event);
+ }
+
+ // this variant is for the pseudo state entry case
+ template <class EventType,class FsmType>
+ typename ::boost::enable_if<
+ typename is_pseudo_entry<typename EventType::active_state >::type,void
+ >::type
+ operator()(EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<3> = 0)
+ {
+ // entry on the FSM
+ (static_cast<Derived*>(self))->on_entry(evt,fsm);
+ int state_id = get_state_id<stt,typename EventType::active_state::wrapped_entry>::value;
+ // given region starts with the entry pseudo state as active state
+ self->m_states[find_region_id<typename EventType::active_state::wrapped_entry>::region_index] = state_id;
+ self->internal_start(evt.m_event);
+ // and we process the transition in the zone of the newly active state
+ // (entry pseudo states are, according to UML, a state connecting 1 transition outside to 1 inside
+ self->process_event(evt.m_event);
+ }
+ private:
+ // helper for the fork case, does almost like the direct entry
+ library_sm* self;
+ template <class EventType>
+ struct fork_helper
+ {
+ fork_helper(library_sm* self_,EventType const& evt_):
+ helper_self(self_),helper_evt(evt_){}
+ template <class StateType>
+ void operator()( ::boost::msm::wrap<StateType> const& )
+ {
+ int state_id = get_state_id<stt,typename StateType::wrapped_entry>::value;
+ BOOST_STATIC_ASSERT(find_region_id<typename StateType::wrapped_entry>::region_index >= 0);
+ BOOST_STATIC_ASSERT(find_region_id<typename StateType::wrapped_entry>::region_index <= nr_regions::value);
+ helper_self->m_states[find_region_id<typename StateType::wrapped_entry>::region_index] = state_id;
+ }
+ private:
+ library_sm* helper_self;
+ EventType const& helper_evt;
+ };
+ };
+
+ // 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];
+ region_entry_exit_helper
+ < ::boost::mpl::int_<region_id::value+1> >::do_entry(self_,incomingEvent);
+ }
+ 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_));
+ region_entry_exit_helper
+ < ::boost::mpl::int_<region_id::value+1> >::do_exit(self_,incomingEvent);
+ }
+ };
+ 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,class FsmType>
+ void do_entry(Event const& incomingEvent,FsmType& fsm)
+ {
+ // by default we activate the history/init states, can be overwritten by direct_event_start_helper
+ region_entry_exit_helper< ::boost::mpl::int_<0> >::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,fsm);
+ // handle messages which were generated and blocked in the init calls
+ m_event_processing = false;
+ process_message_queue(this);
+ }
+ template <class Event,class FsmType>
+ void do_exit(Event const& incomingEvent,FsmType& fsm)
+ {
+ // first recursively exit the sub machines
+ // forward the event for handling by sub state machines
+ region_entry_exit_helper< ::boost::mpl::int_<0> >::do_exit(this,incomingEvent);
+ // then call our own exit
+ (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);
+ }
+
+ // the IBM and VC<8 compilers seem to have problems with the friend declaration of dispatch_table
+#if defined (__IBMCPP__) || (defined(_MSC_VER) && (_MSC_VER < 1400))
+ public:
+#endif
+ // no transition for event.
+ template <class Event>
+ static HandledEnum call_no_transition(library_sm& , int , int , Event const& )
+ {
+ return HANDLED_FALSE;
+ }
+ // called for deferred events. Address set in the dispatch_table at init
+ template <class Event>
+ static HandledEnum defer_transition(library_sm& fsm, int , int , Event const& e)
+ {
+ fsm.defer_event(e);
+ return HANDLED_DEFERRED;
+ }
+ // called for completion events. Default address set in the dispatch_table at init
+ // prevents no-transition detection for completion events
+ template <class Event>
+ static HandledEnum default_eventless_transition(library_sm& fsm, int, int , Event const&)
+ {
+ return HANDLED_FALSE;
+ }
+#if defined (__IBMCPP__) || (defined(_MSC_VER) && (_MSC_VER < 1400))
+ private:
+#endif
+ // puts a deferred event in the queue
+ void post_deferred_event(deferred_fct& deferred)
+ {
+ m_deferred_events_queue.m_deferred_events_queue.push_front(deferred);
+ }
+ // removes one event from the message queue and processes it
+ template <class StateType>
+ void process_message_queue(StateType*,
+ typename ::boost::disable_if<typename is_no_message_queue<StateType>::type,void >::type* = 0)
+ {
+ if (!m_events_queue.m_events_queue.empty())
+ {
+ transition_fct to_call = m_events_queue.m_events_queue.front();
+ m_events_queue.m_events_queue.pop_front();
+ to_call();
+ }
+ }
+ template <class StateType>
+ void process_message_queue(StateType*,
+ typename ::boost::enable_if<typename is_no_message_queue<StateType>::type,void >::type* = 0)
+ {
+ // nothing to process
+ }
+ // calls the entry/exit or on_entry/on_exit depending on the state type
+ // (avoids calling virtually)
+ // variant for FSMs
+ template <class StateType,class EventType,class FsmType>
+ static
+ typename boost::enable_if<typename is_composite_state<StateType>::type,void >::type
+ execute_entry(StateType& astate,EventType const& evt,FsmType& fsm,boost::msm::back::dummy<0> = 0)
+ {
+ // calls on_entry on the fsm then handles direct entries, fork, entry pseudo state
+ astate.do_entry(evt,fsm);
+ }
+ // variant for states
+ template <class StateType,class EventType,class FsmType>
+ static
+ typename ::boost::disable_if<
+ typename ::boost::mpl::or_<typename is_composite_state<StateType>::type,
+ typename is_pseudo_exit<StateType>::type >::type,void >::type
+ execute_entry(StateType& astate,EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<1> = 0)
+ {
+ // simple call to on_entry
+ astate.on_entry(evt,fsm);
+ }
+ // variant for exit pseudo states
+ template <class StateType,class EventType,class FsmType>
+ static
+ typename ::boost::enable_if<typename is_pseudo_exit<StateType>::type,void >::type
+ execute_entry(StateType& astate,EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<2> = 0)
+ {
+ // calls on_entry on the state then forward the event to the transition which should be defined inside the
+ // contained fsm
+ astate.on_entry(evt,fsm);
+ astate.forward_event(evt);
+ }
+ template <class StateType,class EventType,class FsmType>
+ static
+ typename ::boost::enable_if<typename is_composite_state<StateType>::type,void >::type
+ execute_exit(StateType& astate,EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<0> = 0)
+ {
+ astate.do_exit(evt,fsm);
+ }
+ template <class StateType,class EventType,class FsmType>
+ static
+ typename ::boost::disable_if<typename is_composite_state<StateType>::type,void >::type
+ execute_exit(StateType& astate,EventType const& evt,FsmType& fsm, ::boost::msm::back::dummy<1> = 0)
+ {
+ // simple call to on_exit
+ astate.on_exit(evt,fsm);
+ }
+
+ // helper allowing special handling of direct entries / fork
+ template <class StateType,class TargetType,class EventType,class FsmType>
+ static
+ typename ::boost::disable_if<
+ typename ::boost::mpl::or_<typename has_explicit_entry_state<TargetType>::type,
+ ::boost::mpl::is_sequence<TargetType> >::type,void>::type
+ convert_event_and_execute_entry(StateType& astate,EventType const& evt, FsmType& fsm, ::boost::msm::back::dummy<1> = 0)
+ {
+ // if the target is a normal state, do the standard entry handling
+ execute_entry<StateType>(astate,evt,fsm);
+ }
+ template <class StateType,class TargetType,class EventType,class FsmType>
+ static
+ typename ::boost::enable_if<
+ typename ::boost::mpl::or_<typename has_explicit_entry_state<TargetType>::type,
+ ::boost::mpl::is_sequence<TargetType> >::type,void >::type
+ convert_event_and_execute_entry(StateType& astate,EventType const& evt, FsmType& fsm, ::boost::msm::back::dummy<0> = 0)
+ {
+ // for the direct entry, pack the event in a wrapper so that we handle it differently during fsm entry
+ execute_entry(astate,msm::back::direct_entry_event<TargetType,EventType>(evt),fsm);
+ }
+
+ // creates all the states
+ template <class ContainingSM>
+ void fill_states(ContainingSM* containing_sm=0)
+ {
+ // checks that regions are truly orthogonal
+ FsmCheckPolicy::template check_orthogonality<library_sm>();
+ // checks that all states are reachable
+ FsmCheckPolicy::template check_unreachable_states<library_sm>();
+
+ BOOST_STATIC_CONSTANT(int, max_state = (mpl::size<state_list>::value));
+ // allocate the place without reallocation
+ m_visitors.fill_visitors(max_state);
+ ::boost::fusion::for_each(m_substate_list,add_state<ContainingSM>(this,containing_sm));
+
+ }
+
+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, class Compile>
+ friend struct dispatch_table;
+
+ // data members
+ 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;
+
+
+};
+
+} } }// boost::msm::back
+#endif //BOOST_MSM_BACK_STATEMACHINE_H
+

Added: branches/msm/msm_phoenix/boost/msm/back/tools.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/back/tools.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,68 @@
+// 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_BACK_TOOLS_H
+#define BOOST_MSM_BACK_TOOLS_H
+
+
+#include <string>
+#include <iostream>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/back/metafunctions.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+
+// fills the array passed in with the state names in the correct order
+// the array must be big enough. To know the needed size, use mpl::size
+// on fsm::generate_state_set
+template <class stt>
+struct fill_state_names
+{
+ fill_state_names(char const** names):m_names(names){}
+ template <class StateType>
+ void operator()(boost::msm::wrap<StateType> const&)
+ {
+ m_names[get_state_id<stt,StateType>::value]= typeid(StateType).name();
+ }
+private:
+ char const** m_names;
+};
+
+// fills the typeid-generated name of the given state in the string passed as argument
+template <class stt>
+struct get_state_name
+{
+ 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::wrap<StateType> const&)
+ {
+ if (get_state_id<stt,StateType>::value == m_state_id)
+ {
+ m_name = typeid(StateType).name();
+ }
+ }
+private:
+ std::string& m_name;
+ int m_state_id;
+};
+
+// displays the typeid of the given Type
+struct display_type
+{
+ template <class Type>
+ void operator()(boost::msm::wrap<Type> const&)
+ {
+ std::cout << typeid(Type).name() << std::endl;
+ }
+};
+
+} } }//boost::msm::back
+#endif //BOOST_MSM_BACK_TOOLS_H

Added: branches/msm/msm_phoenix/boost/msm/common.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/common.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -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
+

Added: branches/msm/msm_phoenix/boost/msm/front/common_states.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/common_states.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,37 @@
+// 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_FRONT_COMMON_STATES_H
+#define BOOST_MSM_FRONT_COMMON_STATES_H
+
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/include/at_c.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/msm/front/detail/common_states.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+// default base: non-polymorphic, not visitable
+struct default_base_state
+{
+ ~default_base_state(){}
+};
+// default polymorphic base state. Derive all states from it to get polymorphic behavior
+struct polymorphic_state
+{
+ virtual ~polymorphic_state() {}
+};
+
+}}}
+
+#endif //BOOST_MSM_FRONT_COMMON_STATES_H
+

Added: branches/msm/msm_phoenix/boost/msm/front/completion_event.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/completion_event.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -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_FRONT_COMMON_COMPLETION_EVENT_H
+#define BOOST_MSM_FRONT_COMMON_COMPLETION_EVENT_H
+
+namespace boost { namespace msm { namespace front
+{
+
+ struct none
+ {
+ typedef int completion_event;
+ };
+
+}}}
+
+#endif //BOOST_MSM_FRONT_COMMON_COMPLETION_EVENT_H
+

Added: branches/msm/msm_phoenix/boost/msm/front/detail/common_states.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/detail/common_states.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,77 @@
+// 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_FRONT_DETAILS_COMMON_STATES_H
+#define BOOST_MSM_FRONT_DETAILS_COMMON_STATES_H
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/type_traits/add_const.hpp>
+
+namespace boost { namespace msm { namespace front {namespace detail
+{
+template <class Attributes= ::boost::fusion::map<> >
+struct inherit_attributes
+{
+ inherit_attributes():m_attributes(){}
+ inherit_attributes(Attributes const& the_attributes):m_attributes(the_attributes){}
+ // on the fly attribute creation capability
+ typedef Attributes attributes_type;
+ template <class Index>
+ typename ::boost::fusion::result_of::at_key<attributes_type,
+ Index>::type
+ get_attribute(Index const&)
+ {
+ return ::boost::fusion::at_key<Index>(m_attributes);
+ }
+
+ template <class Index>
+ typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key<attributes_type,
+ Index>::type>::type
+ get_attribute(Index const&)const
+ {
+ return const_cast<
+ typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key< attributes_type,
+ Index >::type>::type>
+ (::boost::fusion::at_key<Index>(m_attributes));
+ }
+
+private:
+ // attributes
+ Attributes m_attributes;
+};
+
+// the interface for all states. Defines entry and exit functions. Overwrite to implement for any state needing it.
+template<class USERBASE,class Attributes= ::boost::fusion::map<> >
+struct state_base : public inherit_attributes<Attributes>, USERBASE
+{
+ typedef USERBASE user_state_base;
+ typedef Attributes attributes_type;
+
+ // empty implementation for the states not wishing to define an entry condition
+ // will not be called polymorphic way
+ template <class Event,class FSM>
+ void on_entry(Event const& ,FSM&){}
+ template <class Event,class FSM>
+ void on_exit(Event const&,FSM& ){}
+ // default (empty) transition table;
+ typedef ::boost::mpl::vector0<> internal_transition_table;
+ typedef ::boost::mpl::vector0<> transition_table;
+};
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_DETAILS_COMMON_STATES_H
+

Added: branches/msm/msm_phoenix/boost/msm/front/detail/row2_helper.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/detail/row2_helper.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,71 @@
+// 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_ROW2_HELPER_HPP
+#define BOOST_MSM_ROW2_HELPER_HPP
+
+#include <boost/mpl/bool.hpp>
+#include <boost/fusion/include/at_key.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+ namespace detail
+ {
+ template<
+ typename CalledForAction
+ , typename Event
+ , void (CalledForAction::*action)(Event const&)
+ >
+ struct row2_action_helper
+ {
+ template <class FSM,class Evt,class SourceState,class TargetState, class AllStates>
+ static void call_helper(FSM&,Evt const& evt,SourceState&,TargetState&,
+ AllStates& all_states,::boost::mpl::false_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ ( ::boost::fusion::at_key<CalledForAction>(all_states).*action)(evt);
+ }
+ template <class FSM,class Evt,class SourceState,class TargetState, class AllStates>
+ static void call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&,AllStates&,
+ ::boost::mpl::true_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ }
+ };
+
+ template<
+ typename CalledForGuard
+ , typename Event
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct row2_guard_helper
+ {
+ template <class FSM,class Evt,class SourceState,class TargetState,class AllStates>
+ static bool call_helper(FSM&,Evt const& evt,SourceState&,TargetState&,
+ AllStates& all_states, ::boost::mpl::false_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ( ::boost::fusion::at_key<CalledForGuard>(all_states).*guard)(evt);
+ }
+ template <class FSM,class Evt,class SourceState,class TargetState,class AllStates>
+ static bool call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&,
+ AllStates&,::boost::mpl::true_ const &)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ }
+
+}}}
+
+#endif //BOOST_MSM_ROW2_HELPER_HPP
+

Added: branches/msm/msm_phoenix/boost/msm/front/euml/algorithm.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/algorithm.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,19 @@
+// 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_FRONT_EUML_ALGORITHM_H
+#define BOOST_MSM_FRONT_EUML_ALGORITHM_H
+
+#include <boost/msm/front/euml/iteration.hpp>
+#include <boost/msm/front/euml/querying.hpp>
+#include <boost/msm/front/euml/transformation.hpp>
+
+
+#endif //BOOST_MSM_FRONT_EUML_ALGORITHM_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/common.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/common.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,2436 @@
+// 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_FRONT_EUML_COMMON_H
+#define BOOST_MSM_FRONT_EUML_COMMON_H
+
+#include <boost/config.hpp>
+#include <boost/msm/proto_config.hpp>
+
+#ifndef BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+#endif
+
+#include <iterator>
+#include <utility>
+
+#include <boost/proto/core.hpp>
+#include <boost/proto/transform.hpp>
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/add_const.hpp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/less_equal.hpp>
+
+#if BOOST_VERSION >= 104000
+#include <boost/mpl/string.hpp>
+#endif
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/include/at_c.hpp>
+#include <boost/fusion/include/make_map.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/control/expr_if.hpp>
+#include <boost/preprocessor/punctuation/comma.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/msm/front/functor_row.hpp>
+
+namespace proto = boost::proto;
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(tag_type)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(action_name)
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+template <class T>
+struct get_iterator
+{
+ typedef typename T::iterator type;
+};
+template <class T>
+struct get_reverse_iterator
+{
+ typedef typename T::reverse_iterator type;
+};
+template <class T>
+struct get_reference
+{
+ typedef typename T::reference type;
+};
+template <class T>
+struct get_size_type
+{
+ typedef typename T::size_type type;
+};
+template <class T>
+struct get_value_type
+{
+ typedef typename T::value_type type;
+};
+template <class T>
+struct get_first_type
+{
+ typedef typename T::first_type type;
+};
+template <class T>
+struct get_second_type
+{
+ typedef typename T::second_type type;
+};
+template <class T>
+struct get_action_tag_type
+{
+ typedef typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type type;
+};
+template <class T>
+struct get_state_action_tag_type
+{
+ typedef typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type type;
+};
+
+template <class T,class EVT,class FSM,class SourceState,class TargetState>
+struct get_result_type
+{
+ typedef typename T::template transition_action_result<EVT,FSM,SourceState,TargetState>::type type;
+};
+template <class T,class Event,class FSM,class STATE>
+struct get_result_type2
+{
+ typedef typename T::template state_action_result<Event,FSM,STATE>::type type;
+};
+template<class SEQ>
+struct get_sequence
+{
+ typedef typename SEQ::sequence type;
+};
+
+template <class T>
+struct get_attributes_type
+{
+ typedef typename T::attributes_type type;
+};
+
+template <class T>
+struct get_euml_tag_type
+{
+ typedef typename T::euml_tag_type type;
+};
+
+template <class T,class Arg1=void,class Arg2=void,class Arg3=void,class Arg4=void,class Arg5=void
+#ifdef BOOST_MSVC
+,class Arg6=void
+#endif
+>
+struct get_fct
+{
+ typedef typename T::template In<Arg1,Arg2,Arg3,Arg4,Arg5
+#ifdef BOOST_MSVC
+,Arg6
+#endif
+>::type type;
+};
+
+template <class T>
+struct get_action_name
+{
+ typedef typename T::action_name type;
+};
+template <class T>
+struct get_event_name
+{
+ typedef typename T::event_name type;
+};
+
+// grammar forbidding address of for terminals
+struct terminal_grammar : proto::not_<proto::address_of<proto::_> >
+{};
+
+// Forward-declare an expression wrapper
+template<typename Expr>
+struct euml_terminal;
+
+struct sm_domain
+ : proto::domain< proto::generator<euml_terminal>, terminal_grammar >
+{};
+
+struct state_grammar :
+ proto::and_<
+ proto::not_<proto::address_of<proto::_> >,
+ proto::not_<proto::shift_right<proto::_,proto::_> >,
+ proto::not_<proto::shift_left<proto::_,proto::_> >,
+ proto::not_<proto::bitwise_and<proto::_,proto::_> >
+ >
+{};
+struct state_domain
+ : proto::domain< proto::generator<euml_terminal>, state_grammar,sm_domain >
+{};
+
+template<typename Expr>
+struct euml_terminal
+ : proto::extends<Expr, euml_terminal<Expr>, sm_domain>
+{
+ typedef
+ proto::extends<Expr, euml_terminal<Expr>, sm_domain>
+ base_type;
+ // Needs a constructor
+ euml_terminal(Expr const &e = Expr())
+ : base_type(e)
+ {}
+ // Unhide Proto's overloaded assignment operator
+ using base_type::operator=;
+};
+
+template <class EVT>
+struct euml_event: proto::extends<typename proto::terminal<event_tag>::type, EVT, sm_domain>
+{
+ typedef event_tag euml_tag_type;
+ typedef EVT event_name;
+ using proto::extends<typename proto::terminal<event_tag>::type, EVT, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef EVT type;
+ };
+};
+template <class STATE>
+struct euml_state: proto::extends<typename proto::terminal<state_tag>::type, STATE, state_domain>
+{
+ typedef state_tag euml_tag_type;
+ using proto::extends<typename proto::terminal<state_tag>::type, STATE, state_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef STATE type;
+ };
+};
+template <class ACTION>
+struct euml_action: proto::extends<typename proto::terminal<action_tag>::type, ACTION, sm_domain>
+{
+ typedef action_tag euml_tag_type;
+ typedef ACTION action_name;
+ using proto::extends<typename proto::terminal<action_tag>::type, ACTION, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ACTION type;
+ };
+};
+template <class FLAG>
+struct euml_flag: proto::extends<typename proto::terminal<flag_tag>::type, FLAG, sm_domain>
+{
+ typedef flag_tag euml_tag_type;
+ using proto::extends<typename proto::terminal<flag_tag>::type, FLAG, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef FLAG type;
+ };
+};
+
+template <class CONFIG>
+struct euml_config: proto::extends<typename proto::terminal<config_tag>::type, CONFIG, sm_domain>
+{
+ typedef config_tag euml_tag_type;
+ using proto::extends<typename proto::terminal<config_tag>::type, CONFIG, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef CONFIG type;
+ };
+};
+
+struct No_Exception : euml_config<No_Exception>
+{
+ typedef int no_exception_thrown;
+ No_Exception(){}
+};
+struct No_Msg_Queue : euml_config<No_Msg_Queue>
+{
+ typedef int no_message_queue;
+ No_Msg_Queue(){}
+};
+struct Deferred_Events : euml_config<Deferred_Events>
+{
+ typedef int activate_deferred_events;
+ Deferred_Events(){}
+};
+No_Exception const no_exception;
+No_Msg_Queue const no_msg_queue;
+Deferred_Events const deferred_events;
+
+struct invalid_type{};
+struct make_invalid_type
+{
+ typedef invalid_type type;
+};
+
+template <class ROW>
+struct make_vector_one_row
+{
+ typedef boost::mpl::vector<ROW> type;
+};
+template <class T>
+T make_T(T t) {return t;}
+
+struct make_vector_no_row
+{
+ typedef boost::mpl::vector0<> type;
+};
+
+struct NoAction : euml_action<NoAction>
+{
+ NoAction(){}
+ // return value if used inside a state action (entry/exit)
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ // return value if used inside a transition (action/guard)
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ // this functor can be used in both modes, state action and transition action
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const&,FSM&,STATE& )
+ {
+ // does nothing
+ return true;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& ,FSM& ,SourceState& ,TargetState&)const
+ {
+ // does nothing
+ return true;
+ }
+};
+NoAction const no_action;
+
+struct fsm_artefact_tag {};
+template <class Index=void>
+struct GetSource_ : euml_action<GetSource_<Index> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::fusion::result_of::at_key<typename SourceState::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& ,FSM& ,SourceState& src,TargetState&)const
+ {
+ return src.get_attribute(Index());
+ }
+};
+template<>
+struct GetSource_<void> : euml_action<GetSource_<void> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef SourceState& type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& , FSM&,SourceState& src,TargetState& )const
+ {
+ return src;
+ }
+};
+struct GetSource_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetSource_Helper, sm_domain>
+{
+ GetSource_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetSource_<Arg1> type;
+ };
+};
+GetSource_Helper const source_;
+
+template <class Index=void>
+struct GetTarget_ : euml_action<GetTarget_<Index> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::fusion::result_of::at_key<typename TargetState::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const
+ {
+ return tgt.get_attribute(Index());
+ }
+};
+template<>
+struct GetTarget_<void> : euml_action<GetTarget_<void> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef TargetState& type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& , FSM&,SourceState& ,TargetState& tgt)const
+ {
+ return tgt;
+ }
+};
+struct GetTarget_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetTarget_Helper, sm_domain>
+{
+ GetTarget_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetTarget_<Arg1> type;
+ };
+};
+GetTarget_Helper const target_;
+
+template <class Index=void>
+struct GetState_ : euml_action<GetState_<Index> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::fusion::result_of::at_key<typename STATE::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& ,STATE& state )
+ {
+ return state.get_attribute(Index());
+ }
+};
+template<>
+struct GetState_<void> : euml_action<GetState_<void> >
+{
+ using euml_action<GetState_ >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef STATE& type;
+ };
+ typedef ::boost::mpl::set<state_action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& ,STATE& state )
+ {
+ return state;
+ }
+};
+struct GetState_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetState_Helper, sm_domain>
+{
+ GetState_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetState_<Arg1> type;
+ };
+};
+GetState_Helper const state_;
+
+template <class Index=void>
+struct GetEvent_ : euml_action<GetEvent_<Index> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key<typename Event::attributes_type,
+ Index >::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key<typename EVT::attributes_type,
+ Index >::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& ,STATE& )
+ {
+ return evt.get_attribute(Index());
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const
+ {
+ return evt.get_attribute(Index());
+ }
+};
+template <>
+struct GetEvent_<void> : euml_action<GetEvent_<void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef Event const& type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef EVT const& type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& ,STATE& )
+ {
+ return evt;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const
+ {
+ return evt;
+ }
+};
+struct GetEvent_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetEvent_Helper, sm_domain>
+{
+ GetEvent_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetEvent_<Arg1> type;
+ };
+};
+GetEvent_Helper const event_;
+
+template <class Index=void>
+struct GetFsm_ : euml_action<GetFsm_<Index> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::fusion::result_of::at_key<typename FSM::attributes_type,
+ Index >::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::fusion::result_of::at_key<typename FSM::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& fsm,STATE& )
+ {
+ return fsm.get_attribute(Index());
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& ,FSM& fsm,SourceState& ,TargetState&)const
+ {
+ return fsm.get_attribute(Index());
+ }
+};
+template<>
+struct GetFsm_<void> : euml_action<GetFsm_<void> >
+{
+ using euml_action<GetFsm_>::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef FSM& type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef FSM& type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& fsm,STATE& )
+ {
+ return fsm;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt ,FSM& fsm,SourceState& ,TargetState&)const
+ {
+ return fsm;
+ }
+};
+struct GetFsm_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetFsm_Helper, sm_domain>
+{
+ GetFsm_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetFsm_<Arg1> type;
+ };
+};
+GetFsm_Helper const fsm_;
+
+template <class StateName,class Param1>
+struct SubState_ : euml_action<SubState_<StateName, Param1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef StateName& type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef StateName& type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ StateName& operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Param1()(evt,fsm,src,tgt)).template get_state<StateName&>();
+ }
+ template <class Event,class FSM,class STATE>
+ StateName& operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (Param1()(evt,fsm,state)).template get_state<StateName&>();
+ }
+};
+template <class StateName>
+struct SubState_ <StateName,void>
+ : euml_action<SubState_<StateName, void > >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef StateName& type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef StateName& type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ StateName& operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const
+ {
+ return fsm.template get_state<StateName&>();
+ }
+ template <class Event,class FSM,class STATE>
+ StateName& operator()(Event const& ,FSM& fsm,STATE& )const
+ {
+ return fsm.template get_state<StateName&>();
+ }
+};
+
+struct SubState_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, SubState_Helper, sm_domain>
+{
+ SubState_Helper(){}
+ using proto::extends< proto::terminal<fsm_artefact_tag>::type, SubState_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef SubState_<Arg1,Arg2> type;
+ };
+};
+SubState_Helper const substate_;
+
+template <class Target,class Index>
+struct GetAttribute_ : euml_action<GetAttribute_<Target, Index> >
+{
+ using euml_action<GetAttribute_<Target,Index> >::operator=;
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<
+ typename get_attributes_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Target,Event,FSM,STATE>::type>::type>::type,
+ Index >::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<
+ typename get_attributes_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Target,EVT,FSM,SourceState,TargetState>::type>::type>::type,
+ Index >::type type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Target::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Target()(evt,fsm,src,tgt)).get_attribute(Index());
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Target::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Target()(evt,fsm,state)).get_attribute(Index());
+ }
+};
+
+struct GetAttribute_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, GetAttribute_Helper, sm_domain>
+{
+ GetAttribute_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef GetAttribute_<Arg1,Arg2> type;
+ };
+};
+GetAttribute_Helper const attribute_;
+
+template <class Index>
+struct Source_ : euml_action<Source_<Index> >
+{
+ using euml_action<Source_<Index> >::operator=;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename SourceState::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& , FSM&,SourceState& src,TargetState& )const
+ {
+ return src.get_attribute(Index());
+ }
+};
+template <class Index>
+struct Target_ : euml_action<Target_<Index> >
+{
+ using euml_action<Target_<Index> >::operator=;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename TargetState::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& ,FSM& ,SourceState& ,TargetState& tgt)const
+ {
+ return tgt.get_attribute(Index());
+ }
+};
+template <class Index>
+struct State_ : euml_action<State_<Index> >
+{
+ using euml_action<State_<Index> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename STATE::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& ,STATE& state )
+ {
+ return state.get_attribute(Index());
+ }
+};
+template <class Index>
+struct Event_ : euml_action<Event_<Index> >
+{
+ using euml_action<Event_<Index> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key<typename Event::attributes_type,
+ Index >::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename ::boost::fusion::result_of::at_key<typename EVT::attributes_type,
+ Index >::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& ,STATE& )
+ {
+ return evt.get_attribute(Index());
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt ,FSM& ,SourceState& ,TargetState&)const
+ {
+ return evt.get_attribute(Index());
+ }
+};
+template <class StateType,class Index>
+struct State_Attribute_ : euml_action<State_Attribute_<StateType,Index> >
+{
+ using euml_action<State_Attribute_<StateType,Index> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename StateType::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& fsm,STATE& )
+ {
+ return fsm.template get_state<StateType&>().get_attribute(Index());
+ }
+};
+
+template <class Index>
+struct Fsm_ : euml_action<Fsm_<Index> >
+{
+ using euml_action<Fsm_<Index> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename FSM::attributes_type,
+ Index >::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename
+ ::boost::fusion::result_of::at_key<typename FSM::attributes_type,
+ Index >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const&,FSM& fsm,STATE& )
+ {
+ return fsm.get_attribute(Index());
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt ,FSM& fsm,SourceState& ,TargetState&)const
+ {
+ return fsm.get_attribute(Index());
+ }
+};
+
+struct True_ : euml::euml_action<True_>
+{
+ using euml_action<True_>::operator=;
+ True_(){}
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const&,FSM&,SourceState& ,TargetState& )
+ {
+ return true;
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const&,FSM&,STATE& )
+ {
+ return true;
+ }
+};
+True_ const true_;
+
+struct False_ : euml::euml_action<False_>
+{
+ using euml_action<False_>::operator=;
+ False_(){}
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const&,FSM&,SourceState& ,TargetState& )
+ {
+ return false;
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const&,FSM&,STATE& )
+ {
+ return false;
+ }
+};
+False_ const false_;
+
+template <int Val>
+struct Int_ : euml_action<Int_<Val> >
+{
+ using euml_action<Int_<Val> >::operator=;
+ typedef ::boost::mpl::int_<Val> value_type;
+ enum {value = Val};
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef int type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef int type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ int operator()(EVT const& , FSM& ,SourceState& ,TargetState& )
+ {
+ return Val;
+ }
+ template <class Event,class FSM,class STATE>
+ int operator()(Event const& ,FSM& ,STATE& )
+ {
+ return Val;
+ }
+};
+
+template <char Val>
+struct Char_ : euml_action<Char_<Val> >
+{
+ using euml_action<Char_<Val> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef char type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef char type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ char operator()(EVT const& , FSM& ,SourceState& ,TargetState& )
+ {
+ return Val;
+ }
+ template <class Event,class FSM,class STATE>
+ char operator()(Event const& ,FSM& ,STATE& )
+ {
+ return Val;
+ }
+};
+
+template <size_t Val>
+struct Size_t_ : euml_action<Size_t_<Val> >
+{
+ using euml_action<Size_t_<Val> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef size_t type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef size_t type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ size_t operator()(EVT const& , FSM& ,SourceState& ,TargetState& )
+ {
+ return Val;
+ }
+ template <class Event,class FSM,class STATE>
+ size_t operator()(Event const& ,FSM& ,STATE& )
+ {
+ return Val;
+ }
+};
+
+#if BOOST_VERSION >= 104000
+
+template <class T>
+struct String_ : euml_action<String_<T> >
+{
+ using euml_action<String_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef char const* type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef char const* type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ char const* operator()(EVT const& , FSM& ,SourceState& ,TargetState& )
+ {
+ return ::boost::mpl::c_str<T>::value;
+ }
+ template <class Event,class FSM,class STATE>
+ char const* operator()(Event const& ,FSM& ,STATE& )
+ {
+ return ::boost::mpl::c_str<T>::value;
+ }
+};
+#endif
+
+
+template <class T>
+struct Predicate_ : euml_action<Predicate_<T> >
+{
+ using euml_action<Predicate_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef T type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef T type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ T operator()(EVT const& , FSM& ,SourceState& ,TargetState& )
+ {
+ return T();
+ }
+ template <class Event,class FSM,class STATE>
+ T operator()(Event const& ,FSM& ,STATE& )
+ {
+ return T();
+ }
+};
+
+template <class ToProcessEvt,class Param1, class Param2, class Param3, class Param4>
+struct Process_ : euml_action<Process_<ToProcessEvt, Param1, Param2, Param3, Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param4()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param3()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param4()(evt,fsm,state)).process_event(ToProcessEvt());
+ }
+};
+template <class ToProcessEvt>
+struct Process_ <ToProcessEvt,void,void,void,void>
+ : euml_action<Process_<ToProcessEvt, void, void, void, void > >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const
+ {
+ fsm.process_event(ToProcessEvt());
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& ,FSM& fsm,STATE& )const
+ {
+ fsm.process_event(ToProcessEvt());
+ }
+};
+
+template <class ToProcessEvt,class Param1>
+struct Process_ <ToProcessEvt,Param1,void,void,void>
+ : euml_action<Process_<ToProcessEvt, Param1, void, void, void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt());
+ }
+};
+
+template <class ToProcessEvt,class Param1, class Param2>
+struct Process_ <ToProcessEvt,Param1,Param2,void,void>
+ : euml_action<Process_<ToProcessEvt, Param1, Param2, void, void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,state)).process_event(ToProcessEvt());
+ }
+};
+
+template <class ToProcessEvt,class Param1, class Param2, class Param3>
+struct Process_ <ToProcessEvt,Param1,Param2,Param3,void>
+ : euml_action<Process_<ToProcessEvt, Param1, Param2, Param3, void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt());
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param2()(evt,fsm,state)).process_event(ToProcessEvt());
+ (Param3()(evt,fsm,state)).process_event(ToProcessEvt());
+ }
+};
+struct process_tag {};
+struct Process_Helper: proto::extends< proto::terminal<process_tag>::type, Process_Helper, sm_domain>
+{
+ Process_Helper(){}
+ using proto::extends< proto::terminal<process_tag>::type, Process_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Process_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+Process_Helper const process_;
+
+template <class ToProcessEvt,class Value,class Param1, class Param2, class Param3>
+struct Process2_ : euml_action<Process2_<ToProcessEvt,Value, Param1, Param2, Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ (Param3()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ (Param3()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ }
+};
+
+template <class ToProcessEvt,class Value>
+struct Process2_ <ToProcessEvt,Value,void,void,void>
+ : euml_action<Process2_<ToProcessEvt,Value, void, void, void > >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ fsm.process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ fsm.process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ }
+};
+
+template <class ToProcessEvt,class Value,class Param1>
+struct Process2_ <ToProcessEvt,Value,Param1,void,void>
+ : euml_action<Process2_<ToProcessEvt,Value, Param1, void, void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ }
+};
+
+template <class ToProcessEvt,class Value,class Param1, class Param2>
+struct Process2_ <ToProcessEvt,Value,Param1,Param2,void>
+ : euml_action<Process2_<ToProcessEvt,Value, Param1, Param2, void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Param1()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ (Param2()(evt,fsm,src,tgt)).process_event(ToProcessEvt(Value()(evt,fsm,src,tgt)));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ (Param1()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ (Param2()(evt,fsm,state)).process_event(ToProcessEvt(Value()(evt,fsm,state)));
+ }
+};
+
+struct process2_tag {};
+struct Process2_Helper : proto::extends< proto::terminal<process2_tag>::type, Process2_Helper, sm_domain>
+{
+ Process2_Helper(){}
+ using proto::extends< proto::terminal<process2_tag>::type, Process2_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Process2_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+Process2_Helper const process2_;
+
+template <class Flag,class Param1=void, class Enable=void >
+struct Get_Flag_ : euml_action<Get_Flag_<Flag,Param1,Enable> > {};
+
+template <class Flag,class Param1>
+struct Get_Flag_ <Flag,Param1
+ , typename ::boost::enable_if<typename ::boost::is_same<Param1,void>::type >::type>
+ : euml_action<Get_Flag_<Flag, Param1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const&,FSM& fsm,SourceState& ,TargetState& )const
+ {
+ return fsm.template is_flag_active<Flag>();
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& ,FSM& fsm,STATE& )const
+ {
+ return fsm.template is_flag_active<Flag>();
+ }
+};
+
+template <class Flag,class Param1>
+struct Get_Flag_ <Flag,Param1
+ , typename ::boost::disable_if<
+ typename ::boost::is_same<Param1,void>::type
+ >::type>
+ : euml_action<Get_Flag_<Flag, Param1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt,FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Param1()(evt,fsm,src,tgt)).template is_flag_active<Flag>();
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (Param1()(evt,fsm,state)).template is_flag_active<Flag>();
+ }
+};
+
+struct Get_Flag_Helper: proto::extends< proto::terminal<fsm_artefact_tag>::type, Get_Flag_Helper, sm_domain>
+{
+ Get_Flag_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Get_Flag_<Arg1,Arg2> type;
+ };
+};
+Get_Flag_Helper const is_flag_;
+
+// deferring an event
+struct DeferEvent_ : euml_action< DeferEvent_ >
+{
+ typedef ::boost::mpl::set<action_tag> tag_type;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& ) const
+ {
+ fsm.defer_event(evt);
+ }
+};
+struct Defer_Helper : proto::extends< proto::terminal<fsm_artefact_tag>::type, Defer_Helper, sm_domain>
+{
+ Defer_Helper(){}
+ using proto::extends< proto::terminal<fsm_artefact_tag>::type, Defer_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef DeferEvent_ type;
+ };
+};
+Defer_Helper const defer_;
+
+struct explicit_tag {};
+struct Explicit_Helper : proto::extends< proto::terminal<explicit_tag>::type, Explicit_Helper, sm_domain>
+{
+ Explicit_Helper(){}
+ using proto::extends< proto::terminal<explicit_tag>::type, Explicit_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef typename Arg1::template direct<Arg2> type;
+ };
+};
+Explicit_Helper const explicit_;
+
+struct entry_pt_tag {};
+struct Entry_Pt_Helper : proto::extends< proto::terminal<entry_pt_tag>::type, Entry_Pt_Helper, sm_domain>
+{
+ Entry_Pt_Helper(){}
+ using proto::extends< proto::terminal<entry_pt_tag>::type, Entry_Pt_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef typename Arg1::template entry_pt<Arg2> type;
+ };
+};
+Entry_Pt_Helper const entry_pt_;
+
+struct exit_pt_tag {};
+struct Exit_Pt_Helper : proto::extends< proto::terminal<exit_pt_tag>::type, Exit_Pt_Helper, sm_domain>
+{
+ Exit_Pt_Helper(){}
+ using proto::extends< proto::terminal<exit_pt_tag>::type, Exit_Pt_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef typename Arg1::template exit_pt<Arg2> type;
+ };
+};
+Exit_Pt_Helper const exit_pt_;
+
+#ifdef BOOST_MSVC
+#define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \
+ template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \
+ class Param5=void,class Param6=void,class Enable=void > \
+ struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6,Enable> > {}; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::enable_if<typename ::boost::is_same<Param1,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type \
+ operator()(EVT const& , FSM& ,SourceState& ,TargetState& )const { \
+ return function ();} \
+ template <class Event,class FSM,class STATE> \
+ typename state_action_result<Event,FSM,STATE>::type \
+ operator()(Event const& ,FSM& ,STATE& )const { \
+ return function ();} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param1,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param2,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param5,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param6,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::is_same<Param6,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \
+ struct function_name ## tag{}; \
+ struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \
+ functor ## Helper , sm_domain> { functor ## Helper(){} \
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5,class Arg6> \
+ struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> type;}; }; \
+ functor ## Helper const function_name ;
+
+#define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \
+ template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \
+ class Param5=void,class Param6=void,class Enable=void > \
+ struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6,Enable> > {}; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::enable_if<typename ::boost::is_same<Param2,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function();} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function();} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param5,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param6,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5,class Param6> \
+ struct functor<Param1,Param2,Param3,Param4,Param5,Param6, \
+ typename ::boost::disable_if<typename ::boost::is_same<Param6,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Param6> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt),Param6()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state),Param6()(evt,fsm,state));} }; \
+ struct function_name ## tag{}; \
+ struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \
+ functor ## Helper , sm_domain> { functor ## Helper(){} \
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5,class Arg6> \
+ struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5,Arg6> type;}; }; \
+ functor ## Helper const function_name ;
+
+#else
+
+#define BOOST_MSM_EUML_FUNCTION(functor,function,function_name,result_trans,result_state) \
+ template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \
+ class Param5=void,class Enable=void > \
+ struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Enable> > {}; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param1,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param2,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::is_same<Param5,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return function (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return function (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \
+ struct function_name ## tag{}; \
+ struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \
+ functor ## Helper , sm_domain> { functor ## Helper(){} \
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5> \
+ struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5> type;}; }; \
+ functor ## Helper const function_name ;
+
+#define BOOST_MSM_EUML_METHOD(functor,function,function_name,result_trans,result_state) \
+ template <class Param1=void , class Param2=void , class Param3=void , class Param4=void, \
+ class Param5=void,class Enable=void > \
+ struct functor : euml_action<functor<Param1,Param2,Param3,Param4,Param5,Enable> > {}; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::enable_if<typename ::boost::is_same<Param2,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function();} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function();} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param2,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param3,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param3,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param4,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::mpl::or_< \
+ typename ::boost::is_same<Param4,void>::type,typename ::boost::mpl::not_< \
+ typename ::boost::is_same<Param5,void>::type>::type>::type >::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state));} }; \
+ template <class Param1, class Param2, class Param3, class Param4, class Param5> \
+ struct functor<Param1,Param2,Param3,Param4,Param5, \
+ typename ::boost::disable_if<typename ::boost::is_same<Param5,void>::type>::type> \
+ : euml_action<functor<Param1,Param2,Param3,Param4,Param5> > { \
+ template <class Event,class FSM,class STATE > struct state_action_result { \
+ typedef result_state type;} ; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ struct transition_action_result { typedef result_trans type;}; \
+ typedef ::boost::mpl::set<boost::msm::front::state_action_tag,boost::msm::front::action_tag> tag_type; \
+ template <class EVT,class FSM,class SourceState,class TargetState> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::action_tag>::type, \
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type \
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const { \
+ return (Param1()(evt,fsm,src,tgt)).function(Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt) \
+ ,Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));} \
+ template <class Event,class FSM,class STATE> \
+ typename ::boost::enable_if<typename ::boost::mpl::has_key< \
+ typename Param1::tag_type,boost::msm::front::state_action_tag>::type, \
+ typename state_action_result<Event,FSM,STATE>::type >::type \
+ operator()(Event const& evt,FSM& fsm,STATE& state )const { \
+ return (Param1()(evt,fsm,state)).function(Param2()(evt,fsm,state),Param3()(evt,fsm,state) \
+ ,Param4()(evt,fsm,state),Param5()(evt,fsm,state));} }; \
+ struct function_name ## tag{}; \
+ struct functor ## Helper : proto::extends< proto::terminal< function_name ## tag >::type, \
+ functor ## Helper , sm_domain> { functor ## Helper(){} \
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5> \
+ struct In {typedef functor <Arg1,Arg2,Arg3,Arg4,Arg5> type;}; }; \
+ functor ## Helper const function_name ;
+
+#endif
+
+#define RESULT_TYPE2_PARAM1 typename get_result_type2<Param1,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM1 typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type
+#define RESULT_TYPE2_PARAM2 typename get_result_type2<Param2,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM2 typename get_result_type<Param2,EVT,FSM,SourceState,TargetState>::type
+#define RESULT_TYPE2_PARAM3 typename get_result_type2<Param3,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM3 typename get_result_type<Param3,EVT,FSM,SourceState,TargetState>::type
+#define RESULT_TYPE2_PARAM4 typename get_result_type2<Param4,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM4 typename get_result_type<Param4,EVT,FSM,SourceState,TargetState>::type
+#define RESULT_TYPE2_PARAM5 typename get_result_type2<Param5,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM5 typename get_result_type<Param5,EVT,FSM,SourceState,TargetState>::type
+#define RESULT_TYPE2_PARAM6 typename get_result_type2<Param6,Event,FSM,STATE>::type
+#define RESULT_TYPE_PARAM6 typename get_result_type<Param6,EVT,FSM,SourceState,TargetState>::type
+
+
+#define RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits<typename get_result_type2<Param1,Event,FSM,STATE>::type>::difference_type
+#define RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 typename std::iterator_traits<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::difference_type
+
+#define RESULT_TYPE2_REMOVE_REF_PARAM1 typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type
+#define RESULT_TYPE_REMOVE_REF_PARAM1 typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type
+
+#define RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 std::pair<RESULT_TYPE2_REMOVE_REF_PARAM1,RESULT_TYPE2_REMOVE_REF_PARAM1>
+#define RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 std::pair<RESULT_TYPE_REMOVE_REF_PARAM1,RESULT_TYPE_REMOVE_REF_PARAM1>
+
+#define RESULT_TYPE2_GET_REF_REMOVE_REF_PARAM1 typename get_reference<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type
+#define RESULT_TYPE_GET_REF_REMOVE_REF_PARAM1 typename get_reference<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type
+
+#define RESULT_TYPE2_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type
+#define RESULT_TYPE_GET_ITERATOR_REMOVE_REF_PARAM1 typename get_iterator<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type
+
+#define RESULT_TYPE2_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type
+#define RESULT_TYPE_GET_REV_ITERATOR_REMOVE_REF_PARAM1 typename get_reverse_iterator<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type
+
+#define RESULT_TYPE2_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type<typename ::boost::remove_reference<typename get_result_type2<Param1,Event,FSM,STATE>::type>::type>::type
+#define RESULT_TYPE_GET_SIZE_TYPE_REMOVE_REF_PARAM1 typename get_size_type<typename ::boost::remove_reference<typename get_result_type<Param1,EVT,FSM,SourceState,TargetState>::type>::type>::type
+
+#define BOOST_MSM_EUML_ACTION(instance_name) \
+ struct instance_name ## _impl; \
+ struct instance_name ## _helper : msm::front::euml::euml_action<instance_name ## _impl> \
+ { \
+ instance_name ## _helper(){} \
+ typedef instance_name ## _impl action_name; \
+ }; \
+ instance_name ## _helper instance_name; \
+ struct instance_name ## _impl : instance_name ## _helper
+
+
+#define BOOST_MSM_EUML_EVENT(instance_name) \
+ struct instance_name ## _helper : msm::front::euml::euml_event<instance_name ## _helper>{ \
+ instance_name ## _helper(){} \
+ instance_name ## _helper const& operator()(){return *this;} }; \
+ instance_name ## _helper instance_name;
+
+#define MSM_EUML_CONCAT(param1,param2) param1
+#define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1(z, n, unused) ARG ## n arg ## n
+#define MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2(z, n, unused) arg ## n
+#define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP_ENTRY(z, n, unused) \
+ typename boost::fusion::result_of::first< \
+ typename ::boost::remove_reference< \
+ typename boost::fusion::result_of::at_c<T, BOOST_PP_CAT( , n)>::type>::type>::type \
+
+#define MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE(z, n, unused) \
+ get_attribute( \
+ typename boost::fusion::result_of::first< \
+ typename ::boost::remove_reference< \
+ typename boost::fusion::result_of::at_c<T, n>::type>::type>::type())=arg ## n;
+
+#define MSM_EUML_EVENT_HELPER_CONSTRUCTORS(z, n, mytuple) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, mytuple) , _helper)(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ )): \
+ BOOST_PP_TUPLE_ELEM(2, 1, mytuple)(){ \
+ init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ),attribute_vec());}
+
+#define MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG),class T> \
+ void init(BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ), \
+ T,typename ::boost::enable_if< typename boost::mpl::eval_if< typename ::boost::fusion::traits::is_sequence<T>::type,size_helper<T,n>,::boost::mpl::false_>::type,void >::type* dummyval=0) \
+ { \
+ BOOST_PP_REPEAT_FROM_TO(0,n , \
+ MSM_EUML_EVENT_HELPER_GET_ATTRIBUTE, ~) \
+ }
+
+#define MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL(z, n, instance) \
+ template <BOOST_PP_ENUM_PARAMS(n, class ARG)> \
+ BOOST_PP_CAT(instance,_helper) operator() \
+ (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE1, ~ ))const{ \
+ return BOOST_PP_CAT(instance,_helper) (BOOST_PP_ENUM(n, MSM_EUML_EVENT_INSTANCE_HELPER_EXECUTE2, ~ ));}
+
+#define BOOST_MSM_EUML_EVENT_WITH_ATTRIBUTES(instance_name, attributes_name) \
+ struct instance_name ## _helper : \
+ msm::front::euml::euml_event<instance_name ## _helper> , public attributes_name \
+ { \
+ template <class T,int checked_size> struct size_helper \
+ { \
+ typedef typename ::boost::mpl::less_equal< \
+ typename ::boost::fusion::result_of::size<T>::type, \
+ ::boost::mpl::int_<checked_size> >::type type; \
+ }; \
+ BOOST_PP_CAT(instance_name,_helper()) : attributes_name(){} \
+ typedef attributes_name::attributes_type attribute_map; \
+ typedef ::boost::fusion::result_of::as_vector<attribute_map>::type attribute_vec; \
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \
+ MSM_EUML_EVENT_HELPER_CONSTRUCTORS, (instance_name,attributes_name)) \
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \
+ MSM_EUML_EVENT_INSTANCE_HELPER_ATTRIBUTE_MAP, ~) \
+ BOOST_PP_CAT(instance_name,_helper) operator()(){ \
+ return BOOST_PP_CAT(instance_name,_helper)();} \
+ BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(FUSION_MAX_MAP_SIZE ,1), \
+ MSM_EUML_EVENT_INSTANCE_HELPER_OPERATOR_IMPL, instance_name) \
+ }; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_EVENT_NAME(instance_name) instance_name ## _helper
+
+#define BOOST_MSM_EUML_FLAG_NAME(instance_name) instance_name ## _helper
+
+#define BOOST_MSM_EUML_FLAG(instance_name) \
+ struct instance_name ## _helper : msm::front::euml::euml_flag<instance_name ## _helper>{}; \
+ instance_name ## _helper instance_name;
+
+#define BOOST_MSM_EUML_STATE_NAME(instance_name) instance_name ## _helper
+
+#define BOOST_MSM_EUML_BUILD_STT_HELPER build_stt(
+#define BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER build_internal_stt(
+#define BOOST_MSM_EUML_BUILD_STT_HELPER2(expr) expr)
+#define BOOST_MSM_EUML_ENTRY_STATE_HELPER(expr) ,expr
+
+
+#define BOOST_MSM_EUML_ATTRIBUTES(expr,instance_name) \
+ typedef BOOST_TYPEOF(build_attributes expr) instance_name;
+
+// following macros declare a state type but do not create an instance
+#define BOOST_MSM_EUML_DECLARE_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_state<instance_name ## tag> expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_INTERRUPT_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_interrupt_state<instance_name ## tag> expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_TERMINATE_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_terminate_state<instance_name ## tag> expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_explicit_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_ENTRY_STATE(region,expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_EXIT_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_exit_state<instance_name ## tag> expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_STATE_MACHINE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_sm<instance_name ## tag> expr) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_TRANSITION_TABLE(expr,instance_name) \
+ typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name;
+
+#define BOOST_MSM_EUML_DECLARE_INTERNAL_TRANSITION_TABLE(expr) \
+ typedef BOOST_TYPEOF( \
+ BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) internal_transition_table;
+
+// following macros declare a state type and create an instance
+#define BOOST_MSM_EUML_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_state<instance_name ## tag> expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_INTERRUPT_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_interrupt_state<instance_name ## tag> expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_TERMINATE_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_terminate_state<instance_name ## tag> expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_EXPLICIT_ENTRY_STATE(region,expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_explicit_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_ENTRY_STATE(region,expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_entry_state<instance_name ## tag BOOST_MSM_EUML_ENTRY_STATE_HELPER(region) > expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_EXIT_STATE(expr,instance_name) \
+ struct instance_name ## tag{}; \
+ typedef BOOST_TYPEOF(build_exit_state<instance_name ## tag> expr) instance_name ## _helper; \
+ instance_name ## _helper const instance_name;
+
+
+#ifndef BOOST_MSVC
+
+#define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \
+ typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \
+ struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \
+ typedef BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) instance_name ## _def; \
+ struct instance_name ## _helper : public instance_name ## _def{instance_name ## _helper(){}}; \
+ instance_name ## _helper const instance_name;
+
+#else
+
+#define BOOST_MSM_EUML_TRANSITION_TABLE(expr,instance_name) \
+ struct instance_name ## _helper : \
+ public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \
+ {instance_name ## _helper(){}} ; \
+ instance_name ## _helper const instance_name;
+
+#define BOOST_MSM_EUML_INTERNAL_TRANSITION_TABLE(expr,instance_name) \
+ struct instance_name ## _helper : \
+ public BOOST_TYPEOF(BOOST_MSM_EUML_BUILD_INTERNAL_STT_HELPER BOOST_MSM_EUML_BUILD_STT_HELPER2(expr)) \
+ {instance_name ## _helper(){}} ; \
+ instance_name ## _helper const instance_name;
+
+#endif
+
+}}}} // boost::msm::front::euml
+
+#endif // BOOST_MSM_FRONT_EUML_COMMON_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/container.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/container.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,4068 @@
+// 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_FRONT_EUML_CONTAINER_H
+#define BOOST_MSM_FRONT_EUML_CONTAINER_H
+
+#include <utility>
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/msm/front/euml/operator.hpp>
+#include <boost/type_traits.hpp>
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+template <class T>
+struct Front_ : euml_action<Front_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_reference<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_reference<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).front();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).front();
+ }
+};
+
+struct front_tag {};
+struct Front_Helper: proto::extends< proto::terminal<front_tag>::type, Front_Helper, sm_domain>
+{
+ Front_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Front_<Arg1> type;
+ };
+};
+Front_Helper const front_;
+
+template <class T>
+struct Back_ : euml_action<Back_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_reference<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_reference<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).back();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).back();
+ }
+};
+
+struct back_tag {};
+struct Back_Helper: proto::extends< proto::terminal<back_tag>::type, Back_Helper, sm_domain>
+{
+ Back_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Back_<Arg1> type;
+ };
+};
+Back_Helper const back_;
+
+template <class T>
+struct Begin_ : euml_action<Begin_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).begin();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).begin();
+ }
+};
+
+struct begin_tag {};
+struct Begin_Helper: proto::extends< proto::terminal<begin_tag>::type, Begin_Helper, sm_domain>
+{
+ Begin_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Begin_<Arg1> type;
+ };
+};
+Begin_Helper const begin_;
+
+template <class T>
+struct End_ : euml_action<End_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).end();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).end();
+ }
+};
+struct end_tag {};
+struct End_Helper: proto::extends< proto::terminal<end_tag>::type, End_Helper, sm_domain>
+{
+ End_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef End_<Arg1> type;
+ };
+};
+End_Helper const end_;
+
+template <class T>
+struct RBegin_ : euml_action<RBegin_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_reverse_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_reverse_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).rbegin();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).rbegin();
+ }
+};
+
+struct rbegin_tag {};
+struct RBegin_Helper: proto::extends< proto::terminal<rbegin_tag>::type, RBegin_Helper, sm_domain>
+{
+ RBegin_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef RBegin_<Arg1> type;
+ };
+};
+RBegin_Helper const rbegin_;
+
+template <class T>
+struct REnd_ : euml_action<REnd_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_reverse_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_reverse_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).rend();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).rend();
+ }
+};
+struct rend_tag {};
+struct REnd_Helper: proto::extends< proto::terminal<rend_tag>::type, REnd_Helper, sm_domain>
+{
+ REnd_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef REnd_<Arg1> type;
+ };
+};
+REnd_Helper const rend_;
+
+template <class Container,class Element>
+struct Push_Back_ : euml_action<Push_Back_<Container,Element> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).push_back(Element()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).push_back(Element()(evt,fsm,state));
+ }
+};
+struct push_back_tag {};
+struct Push_Back_Helper: proto::extends< proto::terminal<push_back_tag>::type, Push_Back_Helper, sm_domain>
+{
+ Push_Back_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Push_Back_<Arg1,Arg2> type;
+ };
+};
+Push_Back_Helper const push_back_;
+
+template <class Container>
+struct Pop_Back_ : euml_action<Pop_Back_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).pop_back();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).pop_back();
+ }
+};
+struct pop_back_tag {};
+struct Pop_Back_Helper: proto::extends< proto::terminal<pop_back_tag>::type, Pop_Back_Helper, sm_domain>
+{
+ Pop_Back_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Pop_Back_<Arg1> type;
+ };
+};
+Pop_Back_Helper const pop_back_;
+
+template <class Container,class Element>
+struct Push_Front_ : euml_action<Push_Front_<Container,Element> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).push_front(Element()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).push_front(Element()(evt,fsm,state));
+ }
+};
+struct push_front_tag {};
+struct Push_Front_Helper: proto::extends< proto::terminal<push_front_tag>::type, Push_Front_Helper, sm_domain>
+{
+ Push_Front_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Push_Front_<Arg1,Arg2> type;
+ };
+};
+Push_Front_Helper const push_front_;
+
+template <class Container>
+struct Pop_Front_ : euml_action<Pop_Front_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).pop_front();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).pop_front();
+ }
+};
+struct pop_front_tag {};
+struct Pop_Front_Helper: proto::extends< proto::terminal<pop_front_tag>::type, Pop_Front_Helper, sm_domain>
+{
+ Pop_Front_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Pop_Front_<Arg1> type;
+ };
+};
+Pop_Front_Helper const pop_front_;
+
+template <class Container>
+struct Clear_ : euml_action<Clear_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).clear();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).clear();
+ }
+};
+struct clear_tag {};
+struct Clear_Helper: proto::extends< proto::terminal<clear_tag>::type, Clear_Helper, sm_domain>
+{
+ Clear_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Clear_<Arg1> type;
+ };
+};
+Clear_Helper const clear_;
+
+template <class Container>
+struct ListReverse_ : euml_action<ListReverse_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).reverse();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).reverse();
+ }
+};
+struct list_reverse_tag {};
+struct ListReverse_Helper: proto::extends< proto::terminal<list_reverse_tag>::type, ListReverse_Helper, sm_domain>
+{
+ ListReverse_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListReverse_<Arg1> type;
+ };
+};
+ListReverse_Helper const list_reverse_;
+
+template <class Container, class Predicate, class Enable=void>
+struct ListUnique_ : euml_action<ListUnique_<Container,Predicate,Enable> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).unique();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).unique();
+ }
+};
+template <class Container, class Predicate >
+struct ListUnique_<Container,Predicate,
+ typename ::boost::disable_if<typename ::boost::is_same<Predicate,void>::type >::type>
+ : euml_action<ListUnique_<Container,Predicate> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).unique(Predicate()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).unique(Predicate()(evt,fsm,state));
+ }
+};
+struct list_unique_tag {};
+struct ListUnique_Helper: proto::extends< proto::terminal<list_unique_tag>::type, ListUnique_Helper, sm_domain>
+{
+ ListUnique_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListUnique_<Arg1,Arg2> type;
+ };
+};
+ListUnique_Helper const list_unique_;
+
+template <class Container, class Predicate, class Enable=void>
+struct ListSort_ : euml_action<ListSort_<Container,Predicate,Enable> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).sort();
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).sort();
+ }
+};
+template <class Container, class Predicate >
+struct ListSort_<Container,Predicate,
+ typename ::boost::disable_if<typename ::boost::is_same<Predicate,void>::type >::type>
+ : euml_action<ListSort_<Container,Predicate> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).sort(Predicate()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).sort(Predicate()(evt,fsm,state));
+ }
+};
+struct list_sort_tag {};
+struct ListSort_Helper: proto::extends< proto::terminal<list_sort_tag>::type, ListSort_Helper, sm_domain>
+{
+ ListSort_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListSort_<Arg1,Arg2> type;
+ };
+};
+ListSort_Helper const list_sort_;
+
+template <class Container>
+struct Capacity_ : euml_action<Capacity_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).capacity();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).capacity();
+ }
+};
+struct capacity_tag {};
+struct Capacity_Helper: proto::extends< proto::terminal<capacity_tag>::type, Capacity_Helper, sm_domain>
+{
+ Capacity_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Capacity_<Arg1> type;
+ };
+};
+Capacity_Helper const capacity_;
+
+template <class Container>
+struct Size_ : euml_action<Size_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).size();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).size();
+ }
+};
+struct size_tag {};
+struct Size_Helper: proto::extends< proto::terminal<size_tag>::type, Size_Helper, sm_domain>
+{
+ Size_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Size_<Arg1> type;
+ };
+};
+Size_Helper const size_;
+
+template <class Container>
+struct Max_Size_ : euml_action<Max_Size_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).max_size();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).max_size();
+ }
+};
+struct max_size_tag {};
+struct Max_Size_Helper: proto::extends< proto::terminal<max_size_tag>::type, Max_Size_Helper, sm_domain>
+{
+ Max_Size_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Max_Size_<Arg1> type;
+ };
+};
+Max_Size_Helper const max_size_;
+
+template <class Container, class Value>
+struct Reserve_ : euml_action<Reserve_<Container,Value> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).reserve(Value()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).reserve(Value()(evt,fsm,state));
+ }
+};
+struct reserve_tag {};
+struct Reserve_Helper: proto::extends< proto::terminal<reserve_tag>::type, Reserve_Helper, sm_domain>
+{
+ Reserve_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Reserve_<Arg1,Arg2> type;
+ };
+};
+Reserve_Helper const reserve_;
+
+template <class Container, class Num, class Value ,class Enable=void >
+struct Resize_ : euml_action<Resize_<Container,Num,Value> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).resize(Num()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).resize(Num()(evt,fsm,state));
+ }
+};
+template <class Container, class Num , class Value >
+struct Resize_<Container,Num,Value,typename ::boost::disable_if<typename ::boost::is_same<Value,void>::type >::type>
+ : euml_action<Resize_<Container,Num,Value> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).resize(Num()(evt,fsm,src,tgt),Value()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).resize(Num()(evt,fsm,state),Value()(evt,fsm,state));
+ }
+};
+struct resize_tag {};
+struct Resize_Helper: proto::extends< proto::terminal<resize_tag>::type, Resize_Helper, sm_domain>
+{
+ Resize_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Resize_<Arg1,Arg2,Arg3> type;
+ };
+};
+Resize_Helper const resize_;
+
+// version for 3 parameters (sequence containers)
+template <class Container, class Param1, class Param2, class Param3 >
+struct Insert_ : euml_action<Insert_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+// version for 2 parameters
+template <class Container, class Param1, class Param2>
+struct Insert_ < Container,Param1,Param2,void>
+ : euml_action<Insert_<Container,Param1,Param2,void> >
+{
+ // return value will actually not be correct for set::insert(it1,it2), should be void
+ // but it's ok as nobody should call an inexistent return type
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ // version for transition + second param not an iterator (meaning that, Container is not an associative container)
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename ::boost::mpl::not_<
+ typename has_iterator_category<
+ typename Param2::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ >::type
+ >::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+
+ // version for transition + second param is an iterator (meaning that, Container is an associative container)
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename has_iterator_category<
+ typename Param2::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ >::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+
+ // version for state action + second param not an iterator (meaning that, Container is not an associative container)
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename ::boost::mpl::not_<
+ typename has_iterator_category<
+ typename Param2::template state_action_result<Event,FSM,STATE>::type
+ >::type
+ >::type
+ >::type,
+ typename state_action_result<Event,FSM,STATE>::type
+ >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+
+ // version for state action + second param is an iterator (meaning that, Container is an associative container)
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename has_iterator_category<
+ typename Param2::template state_action_result<Event,FSM,STATE>::type
+ >::type
+ >::type,
+ typename state_action_result<Event,FSM,STATE>::type
+ >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+// version for 1 parameter (associative containers)
+template <class Container, class Param1>
+struct Insert_ < Container,Param1,void,void>
+ : euml_action<Insert_<Container,Param1,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename std::pair<
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type,bool> type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename std::pair<
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type,bool> type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state));
+ }
+};
+struct insert_tag {};
+struct Insert_Helper: proto::extends< proto::terminal<insert_tag>::type, Insert_Helper, sm_domain>
+{
+ Insert_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Insert_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+Insert_Helper const insert_;
+
+template <class Container1,class Container2>
+struct Swap_ : euml_action<Swap_<Container1,Container2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container1()(evt,fsm,src,tgt)).swap(Container2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container1()(evt,fsm,state)).swap(Container2()(evt,fsm,state));
+ }
+};
+struct swap_tag {};
+struct Swap_Helper: proto::extends< proto::terminal<swap_tag>::type, Swap_Helper, sm_domain>
+{
+ Swap_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Swap_<Arg1,Arg2> type;
+ };
+};
+Swap_Helper const swap_;
+
+template <class Container, class Iterator1, class Iterator2 ,class Enable=void >
+struct Erase_ : euml_action<Erase_<Container,Iterator1,Iterator2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Iterator1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Iterator1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Iterator1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).erase(Iterator1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Iterator1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).erase(Iterator1()(evt,fsm,state));
+ }
+};
+template <class Container, class Iterator1 , class Iterator2 >
+struct Erase_<Container,Iterator1,Iterator2,
+ typename ::boost::disable_if<typename ::boost::is_same<Iterator2,void>::type >::type>
+ : euml_action<Erase_<Container,Iterator1,Iterator2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Iterator1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Iterator1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Iterator1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).erase(Iterator1()(evt,fsm,src,tgt),Iterator2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Iterator1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).erase(Iterator1()(evt,fsm,state),Iterator2()(evt,fsm,state));
+ }
+};
+struct erase_tag {};
+struct Erase_Helper: proto::extends< proto::terminal<erase_tag>::type, Erase_Helper, sm_domain>
+{
+ Erase_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Erase_<Arg1,Arg2,Arg3> type;
+ };
+};
+Erase_Helper const erase_;
+
+template <class Container>
+struct Empty_ : euml_action<Empty_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).empty();
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).empty();
+ }
+};
+struct empty_tag {};
+struct Empty_Helper: proto::extends< proto::terminal<empty_tag>::type, Empty_Helper, sm_domain>
+{
+ Empty_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Empty_<Arg1> type;
+ };
+};
+Empty_Helper const empty_;
+
+template <class Container,class Element>
+struct ListRemove_ : euml_action<ListRemove_<Container,Element> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).remove(Element()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).remove(Element()(evt,fsm,state));
+ }
+};
+struct list_remove_tag {};
+struct ListRemove_Helper: proto::extends< proto::terminal<list_remove_tag>::type, ListRemove_Helper, sm_domain>
+{
+ ListRemove_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListRemove_<Arg1,Arg2> type;
+ };
+};
+ListRemove_Helper const list_remove_;
+
+template <class Container,class Element>
+struct ListRemove_If_ : euml_action<ListRemove_If_<Container,Element> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).remove_if(Element()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).remove_if(Element()(evt,fsm,state));
+ }
+};
+struct list_remove_if_tag {};
+struct ListRemove_If_Helper: proto::extends< proto::terminal<list_remove_if_tag>::type, ListRemove_If_Helper, sm_domain>
+{
+ ListRemove_If_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListRemove_If_<Arg1,Arg2> type;
+ };
+};
+ListRemove_If_Helper const list_remove_if_;
+
+template <class Container, class ToMerge, class Predicate, class Enable=void>
+struct ListMerge_ : euml_action<ListMerge_<Container,ToMerge,Predicate,Enable> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).merge(ToMerge()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).merge(ToMerge()(evt,fsm,state));
+ }
+};
+template <class Container, class ToMerge, class Predicate >
+struct ListMerge_<Container,ToMerge,Predicate,
+ typename ::boost::disable_if<typename ::boost::is_same<Predicate,void>::type >::type>
+ : euml_action<ListMerge_<Container,ToMerge,Predicate> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).merge(ToMerge()(evt,fsm,src,tgt),Predicate()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).merge(ToMerge()(evt,fsm,state),Predicate()(evt,fsm,state));
+ }
+};
+struct list_merge_tag {};
+struct ListMerge_Helper: proto::extends< proto::terminal<list_merge_tag>::type, ListMerge_Helper, sm_domain>
+{
+ ListMerge_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef ListMerge_<Arg1,Arg2,Arg3> type;
+ };
+};
+ListMerge_Helper const list_merge_;
+
+template <class Container, class Param1, class Param2, class Param3, class Param4 ,class Enable=void >
+struct Splice_ : euml_action<Splice_<Container,Param1,Param2,Param3,Param4,Enable> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).splice(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).splice(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1, class Param2, class Param3, class Param4 >
+struct Splice_<Container,Param1,Param2,Param3,Param4,
+ typename ::boost::disable_if<
+ typename ::boost::mpl::or_<typename ::boost::is_same<Param3,void>::type,
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<Param4,void>::type>::type>::type >::type>
+ : euml_action<Splice_<Container,Param1,Param2,Param3,Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).splice(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).splice(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1, class Param2, class Param3, class Param4 >
+struct Splice_<Container,Param1,Param2,Param3,Param4,
+ typename ::boost::disable_if<typename ::boost::is_same<Param4,void>::type >::type>
+ : euml_action<Splice_<Container,Param1,Param2,Param3,Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).splice(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt),Param4()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).splice(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state),Param4()(evt,fsm,state));
+ }
+};
+struct splice_tag {};
+struct Splice_Helper: proto::extends< proto::terminal<splice_tag>::type, Splice_Helper, sm_domain>
+{
+ Splice_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Splice_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+Splice_Helper const splice_;
+
+//template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+//struct StringFind_ : euml_action<StringFind_<Container,Param1,Param2,Param3,Enable> >
+//{
+//};
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFind_ : euml_action<StringFind_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ find(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ find(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1>
+struct StringFind_ < Container,Param1,void,void>
+ : euml_action<StringFind_<Container,Param1,void,void> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2>
+struct StringFind_ <Container,Param1,Param2,void>
+ : euml_action<StringFind_<Container,Param1,Param2,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+struct string_find_tag {};
+struct StringFind_Helper: proto::extends< proto::terminal<string_find_tag>::type, StringFind_Helper, sm_domain>
+{
+ StringFind_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringFind_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringFind_Helper const string_find_;
+
+template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+struct StringRFind_ : euml_action<StringRFind_<Container,Param1,Param2,Param3,Enable> >
+{
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringRFind_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >
+ : euml_action<StringRFind_<Container,Param1,Param2,Param3> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).rfind(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).rfind(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringRFind_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::is_same<Param3,void>::type,
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >::type
+ >::type
+ >
+ : euml_action<StringRFind_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).rfind(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).rfind(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringRFind_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::disable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringRFind_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ rfind(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ rfind(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+struct string_rfind_tag {};
+struct StringRFind_Helper: proto::extends< proto::terminal<string_rfind_tag>::type, StringRFind_Helper, sm_domain>
+{
+ StringRFind_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringRFind_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringRFind_Helper const string_rfind_;
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindFirstOf_ : euml_action<StringFindFirstOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ find_first_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ find_first_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+template <class Container,class Param1>
+struct StringFindFirstOf_ <Container,Param1,void,void>
+ : euml_action<StringFindFirstOf_<Container,Param1,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_first_of(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_first_of(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2>
+struct StringFindFirstOf_ <Container,Param1,Param2,void>
+ : euml_action<StringFindFirstOf_<Container,Param1,Param2,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_first_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_first_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+struct string_find_first_of_tag {};
+struct StringFindFirstOf_Helper:
+ proto::extends< proto::terminal<string_find_first_of_tag>::type, StringFindFirstOf_Helper, sm_domain>
+{
+ StringFindFirstOf_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringFindFirstOf_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringFindFirstOf_Helper const string_find_first_of_;
+
+template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+struct StringFindFirstNotOf_ : euml_action<StringFindFirstNotOf_<Container,Param1,Param2,Param3,Enable> >
+{
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindFirstNotOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >
+ : euml_action<StringFindFirstNotOf_<Container,Param1,Param2,Param3> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_first_not_of(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_first_not_of(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindFirstNotOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::is_same<Param3,void>::type,
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >::type
+ >::type
+ >
+ : euml_action<StringFindFirstNotOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_first_not_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_first_not_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindFirstNotOf_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::disable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringFindFirstNotOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ find_first_not_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ find_first_not_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+struct string_find_first_not_of_tag {};
+struct StringFindFirstNotOf_Helper:
+ proto::extends< proto::terminal<string_find_first_not_of_tag>::type, StringFindFirstNotOf_Helper, sm_domain>
+{
+ StringFindFirstNotOf_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringFindFirstNotOf_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringFindFirstNotOf_Helper const string_find_first_not_of_;
+
+template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+struct StringFindLastOf_ : euml_action<StringFindLastOf_<Container,Param1,Param2,Param3,Enable> >
+{
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >
+ : euml_action<StringFindLastOf_<Container,Param1,Param2,Param3> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_last_of(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_last_of(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::is_same<Param3,void>::type,
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >::type
+ >::type
+ >
+ : euml_action<StringFindLastOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_last_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_last_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastOf_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::disable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringFindLastOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ find_last_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ find_last_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+struct string_find_last_of_tag {};
+struct StringFindLastOf_Helper:
+ proto::extends< proto::terminal<string_find_last_of_tag>::type, StringFindLastOf_Helper, sm_domain>
+{
+ StringFindLastOf_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringFindLastOf_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringFindLastOf_Helper const string_find_last_of_;
+
+template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+struct StringFindLastNotOf_ : euml_action<StringFindLastNotOf_<Container,Param1,Param2,Param3,Enable> >
+{
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastNotOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >
+ : euml_action<StringFindLastNotOf_<Container,Param1,Param2,Param3> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_last_not_of(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_last_not_of(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastNotOf_ <
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::is_same<Param3,void>::type,
+ typename ::boost::mpl::not_<
+ typename ::boost::is_same<Param2,void>::type
+ >::type
+ >::type
+ >::type
+ >
+ : euml_action<StringFindLastNotOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).find_last_not_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).find_last_not_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringFindLastNotOf_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::disable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringFindLastNotOf_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ find_last_not_of(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ find_last_not_of(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+struct string_find_last_not_of_tag {};
+struct StringFindLastNotOf_Helper:
+ proto::extends< proto::terminal<string_find_last_of_tag>::type, StringFindLastNotOf_Helper, sm_domain>
+{
+ StringFindLastNotOf_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringFindLastNotOf_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringFindLastNotOf_Helper const string_find_last_not_of_;
+
+template <class Container>
+struct Npos_ : euml_action<Npos_<Container> >
+{
+ Npos_(){}
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename Container::size_type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename Container::size_type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return Container::npos;
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return Container::npos;
+ }
+};
+
+// version for 2 parameters
+template <class Container, class Param1, class Param2>
+struct Associative_Erase_ : euml_action<Associative_Erase_<Container,Param1,Param2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).erase(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).erase(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+// version for 1 parameter
+template <class Container, class Param1>
+struct Associative_Erase_ < Container,Param1,void>
+ : euml_action<Associative_Erase_<Container,Param1,void> >
+{
+ // return value will actually not be correct for set::erase(it), should be void
+ // but it's ok as nobody should call an inexistent return type
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ // version for transition + param is an iterator
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename has_iterator_category<
+ typename Param1::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ >::type,
+ void
+ >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ (Container()(evt,fsm,src,tgt)).erase(Param1()(evt,fsm,src,tgt));
+ }
+
+ // version for state action + param is an iterator
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename has_iterator_category<
+ typename Param1::template state_action_result<Event,FSM,STATE>::type
+ >::type
+ >::type,
+ void
+ >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ (Container()(evt,fsm,state)).erase(Param1()(evt,fsm,state));
+ }
+
+ // version for transition + param not an iterator
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename ::boost::mpl::not_<
+ typename has_iterator_category<
+ typename Param1::template transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ >::type
+ >::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).erase(Param1()(evt,fsm,src,tgt));
+ }
+
+ // version for state action + param not an iterator
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::and_<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename ::boost::mpl::not_<
+ typename has_iterator_category<
+ typename Param1::template state_action_result<Event,FSM,STATE>::type
+ >::type
+ >::type
+ >::type,
+ typename state_action_result<Event,FSM,STATE>::type
+ >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).erase(Param1()(evt,fsm,state));
+ }
+};
+
+struct associative_erase_tag {};
+struct Associative_Erase_Helper: proto::extends< proto::terminal<associative_erase_tag>::type, Associative_Erase_Helper, sm_domain>
+{
+ Associative_Erase_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Associative_Erase_<Arg1,Arg2,Arg3> type;
+ };
+};
+Associative_Erase_Helper const associative_erase_;
+
+
+template <class T, class Param>
+struct Associative_Find_ : euml_action<Associative_Find_<T,Param> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).find(Param()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).find(Param()(evt,fsm,state));
+ }
+};
+
+struct associative_find_tag {};
+struct Associative_Find_Helper: proto::extends< proto::terminal<associative_find_tag>::type, Associative_Find_Helper, sm_domain>
+{
+ Associative_Find_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Associative_Find_<Arg1,Arg2> type;
+ };
+};
+Associative_Find_Helper const associative_find_;
+
+template <class Container,class Param>
+struct AssociativeCount_ : euml_action<AssociativeCount_<Container,Param> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).count(Param()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).count(Param()(evt,fsm,state));
+ }
+};
+struct associative_count_tag {};
+struct AssociativeCount_Helper: proto::extends< proto::terminal<associative_count_tag>::type, AssociativeCount_Helper, sm_domain>
+{
+ AssociativeCount_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef AssociativeCount_<Arg1,Arg2> type;
+ };
+};
+AssociativeCount_Helper const associative_count_;
+
+template <class T, class Param>
+struct Associative_Lower_Bound_ : euml_action<Associative_Lower_Bound_<T,Param> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).lower_bound(Param()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).lower_bound(Param()(evt,fsm,state));
+ }
+};
+
+struct associative_lower_bound_tag {};
+struct Associative_Lower_Bound_Helper: proto::extends< proto::terminal<associative_lower_bound_tag>::type,
+ Associative_Lower_Bound_Helper, sm_domain>
+{
+ Associative_Lower_Bound_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Associative_Lower_Bound_<Arg1,Arg2> type;
+ };
+};
+Associative_Lower_Bound_Helper const associative_lower_bound_;
+
+template <class T, class Param>
+struct Associative_Upper_Bound_ : euml_action<Associative_Upper_Bound_<T,Param> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).upper_bound(Param()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).upper_bound(Param()(evt,fsm,state));
+ }
+};
+
+struct associative_upper_bound_tag {};
+struct Associative_Upper_Bound_Helper: proto::extends< proto::terminal<associative_upper_bound_tag>::type,
+ Associative_Upper_Bound_Helper, sm_domain>
+{
+ Associative_Upper_Bound_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Associative_Upper_Bound_<Arg1,Arg2> type;
+ };
+};
+Associative_Upper_Bound_Helper const associative_upper_bound_;
+
+template <class T>
+struct First_ : euml_action<First_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_first_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_first_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).first;
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).first;
+ }
+};
+
+struct first_tag {};
+struct First_Helper: proto::extends< proto::terminal<first_tag>::type, First_Helper, sm_domain>
+{
+ First_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef First_<Arg1> type;
+ };
+};
+First_Helper const first_;
+
+template <class T>
+struct Second_ : euml_action<Second_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_second_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_second_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).second;
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).second;
+ }
+};
+
+struct second_tag {};
+struct Second_Helper: proto::extends< proto::terminal<second_tag>::type, Second_Helper, sm_domain>
+{
+ Second_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Second_<Arg1> type;
+ };
+};
+Second_Helper const second_;
+
+template <class T, class Param>
+struct Associative_Equal_Range_ : euml_action<Associative_Equal_Range_<T,Param> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef std::pair<
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type,
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::type > type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef std::pair<
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type,
+ typename get_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type>::type > type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T()(evt,fsm,src,tgt)).equal_range(Param()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T()(evt,fsm,state)).equal_range(Param()(evt,fsm,state));
+ }
+};
+
+struct associative_equal_range_tag {};
+struct Associative_Equal_Range_Helper: proto::extends< proto::terminal<associative_equal_range_tag>::type,
+ Associative_Equal_Range_Helper, sm_domain>
+{
+ Associative_Equal_Range_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Associative_Equal_Range_<Arg1,Arg2> type;
+ };
+};
+Associative_Equal_Range_Helper const associative_equal_range_;
+
+template <class Container,class Param1, class Param2>
+struct Substr_ : euml_action<Substr_<Container,Param1,Param2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ substr(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ substr(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+template <class Container>
+struct Substr_ <Container,void,void>
+ : euml_action<Substr_<Container,void,void> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).substr();
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).substr();
+ }
+};
+
+template <class Container,class Param1>
+struct Substr_ < Container,Param1,void>
+ : euml_action<Substr_<Container,Param1,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).substr(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).substr(Param1()(evt,fsm,state));
+ }
+};
+struct substr_tag {};
+struct Substr_Helper: proto::extends< proto::terminal<substr_tag>::type, Substr_Helper, sm_domain>
+{
+ Substr_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Substr_<Arg1,Arg2,Arg3> type;
+ };
+};
+Substr_Helper const substr_;
+
+template <class Container, class Param1, class Param2, class Param3, class Param4 >
+struct StringCompare_ : euml_action<StringCompare_<Container,Param1,Param2,Param3,Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef int type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef int type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).compare(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt),Param4()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).compare(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state),Param4()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1 >
+struct StringCompare_<Container,Param1,void,void,void>
+ : euml_action<StringCompare_<Container,Param1,void,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef int type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef int type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).compare(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).compare(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container, class Param1, class Param2>
+struct StringCompare_<Container,Param1,Param2,void,void>
+ : euml_action<StringCompare_<Container,Param1,Param2,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef int type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef int type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).compare(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).compare(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container, class Param1, class Param2, class Param3 >
+struct StringCompare_<Container,Param1,Param2,Param3,void>
+ : euml_action<StringCompare_<Container,Param1,Param2,Param3,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef int type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef int type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).compare(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).compare(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+
+struct string_compare_tag {};
+struct StringCompare_Helper: proto::extends< proto::terminal<string_compare_tag>::type, StringCompare_Helper, sm_domain>
+{
+ StringCompare_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringCompare_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+StringCompare_Helper const string_compare_;
+
+template <class Container, class Param1, class Param2, class Param3 >
+struct Append_ : euml_action<Append_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).append (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).append (Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1>
+struct Append_<Container,Param1,void,void>
+ : euml_action<Append_<Container,Param1,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).append(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).append(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container, class Param1, class Param2 >
+struct Append_<Container,Param1,Param2,void>
+ : euml_action<Append_<Container,Param1,Param2,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).append(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).append(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+struct append_tag {};
+struct Append_Helper: proto::extends< proto::terminal<append_tag>::type, Append_Helper, sm_domain>
+{
+ Append_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Append_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+Append_Helper const append_;
+
+template <class Container, class Param1, class Param2, class Param3, class Param4 >
+struct StringInsert_ : euml_action<StringInsert_<Container,Param1,Param2,Param3,Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt),Param4()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state),Param4()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1, class Param2>
+struct StringInsert_ <Container,Param1,Param2,void,void>
+ : euml_action<StringInsert_<Container,Param1,Param2,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+template <class Container, class Param1, class Param2, class Param3>
+struct StringInsert_<Container,Param1,Param2,Param3,void>
+ : euml_action<StringInsert_<Container,Param1,Param2,Param3,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).insert(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).insert(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+
+struct string_insert_tag {};
+struct StringInsert_Helper: proto::extends< proto::terminal<string_insert_tag>::type, StringInsert_Helper, sm_domain>
+{
+ StringInsert_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringInsert_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+StringInsert_Helper const string_insert_;
+
+template <class Container,class Param1, class Param2>
+struct StringErase_ : euml_action<StringErase_<Container,Param1,Param2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ erase(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ erase(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+template <class Container>
+struct StringErase_ <Container,void,void>
+ : euml_action<StringErase_<Container,void,void> >
+
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).erase();
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).erase();
+ }
+};
+
+template <class Container,class Param1>
+struct StringErase_ <Container,Param1,void>
+ : euml_action<StringErase_<Container,Param1,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).erase(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).erase(Param1()(evt,fsm,state));
+ }
+};
+
+struct string_erase_tag {};
+struct StringErase_Helper: proto::extends< proto::terminal<string_erase_tag>::type, StringErase_Helper, sm_domain>
+{
+ StringErase_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringErase_<Arg1,Arg2,Arg3> type;
+ };
+};
+StringErase_Helper const string_erase_;
+
+template <class Container, class Param1, class Param2, class Param3 >
+struct StringAssign_ : euml_action<StringAssign_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).assign (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).assign (Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+template <class Container,class Param1>
+struct StringAssign_ <
+ Container,Param1,void,void>
+ : euml_action<StringAssign_<Container,Param1,void,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).assign(Param1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).assign(Param1()(evt,fsm,state));
+ }
+};
+
+template <class Container, class Param1, class Param2 >
+struct StringAssign_<Container,Param1,Param2,void>
+ : euml_action<StringAssign_<Container,Param1,Param2,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).assign(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).assign(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+struct assign_tag {};
+struct StringAssign_Helper: proto::extends< proto::terminal<assign_tag>::type, StringAssign_Helper, sm_domain>
+{
+ StringAssign_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringAssign_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringAssign_Helper const string_assign_;
+
+template <class Container,class Param1, class Param2, class Param3, class Param4>
+struct StringReplace_ : euml_action<StringReplace_<Container,Param1,Param2,Param3,Param4> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).replace (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt),Param4()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).replace (Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state),Param4()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringReplace_<Container,Param1,Param2,Param3,void>
+ : euml_action<StringReplace_<Container,Param1,Param2,Param3,void> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Container,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).replace(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),
+ Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).replace(Param1()(evt,fsm,state),Param2()(evt,fsm,state),
+ Param3()(evt,fsm,state));
+ }
+};
+
+struct string_replace_tag {};
+struct StringReplace_Helper: proto::extends< proto::terminal<string_replace_tag>::type, StringReplace_Helper, sm_domain>
+{
+ StringReplace_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringReplace_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+StringReplace_Helper const string_replace_;
+
+template <class Container>
+struct CStr_ : euml_action<CStr_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename get_value_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type>::type* type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename get_value_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type>::type* type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).c_str();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).c_str();
+ }
+};
+struct c_str_tag {};
+struct CStr_Helper: proto::extends< proto::terminal<c_str_tag>::type, CStr_Helper, sm_domain>
+{
+ CStr_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef CStr_<Arg1> type;
+ };
+};
+CStr_Helper const c_str_;
+
+template <class Container>
+struct StringData_ : euml_action<StringData_<Container> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename get_value_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type>::type* type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::add_const<
+ typename get_value_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type>::type* type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).data();
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Container::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).data();
+ }
+};
+struct string_data_tag {};
+struct StringData_Helper: proto::extends< proto::terminal<string_data_tag>::type, StringData_Helper, sm_domain>
+{
+ StringData_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringData_<Arg1> type;
+ };
+};
+StringData_Helper const string_data_;
+
+template <class Container, class Param1, class Param2, class Param3, class Enable=void >
+struct StringCopy_ : euml_action<StringCopy_<Container,Param1,Param2,Param3,Enable> >
+{
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringCopy_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::enable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringCopy_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).copy(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).copy(Param1()(evt,fsm,state),Param2()(evt,fsm,state));
+ }
+};
+
+template <class Container,class Param1, class Param2, class Param3>
+struct StringCopy_<
+ Container,Param1,Param2,Param3,
+ typename ::boost::disable_if<
+ typename ::boost::is_same<Param3,void>::type
+ >::type
+ >
+ : euml_action<StringCopy_<Container,Param1,Param2,Param3> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type2<Container,Event,FSM,STATE>::type>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_size_type<
+ typename ::boost::remove_reference<
+ typename get_result_type<Container,EVT,FSM,SourceState,TargetState>::type>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (Container()(evt,fsm,src,tgt)).
+ copy(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename state_action_result<Event,FSM,STATE>::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (Container()(evt,fsm,state)).
+ copy(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state));
+ }
+};
+
+struct string_copy_tag {};
+struct StringCopy_Helper: proto::extends< proto::terminal<string_copy_tag>::type, StringCopy_Helper, sm_domain>
+{
+ StringCopy_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef StringCopy_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+StringCopy_Helper const string_copy_;
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_CONTAINER_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/euml.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/euml.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,20 @@
+// 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_FRONT_EUML_EUML_H
+#define BOOST_MSM_FRONT_EUML_EUML_H
+
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/msm/front/euml/operator.hpp>
+#include <boost/msm/front/euml/guard_grammar.hpp>
+#include <boost/msm/front/euml/state_grammar.hpp>
+#include <boost/msm/front/euml/stt_grammar.hpp>
+
+#endif //BOOST_MSM_FRONT_EUML_EUML_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/euml_typeof.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/euml_typeof.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,121 @@
+// 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_FRONT_EUML_TYPEOF_H
+#define BOOST_MSM_FRONT_EUML_TYPEOF_H
+
+#include <boost/typeof/typeof.hpp>
+
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(::boost::mpl::vector0, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(::boost::mpl::vector50, 50)
+BOOST_TYPEOF_REGISTER_TYPE(::boost::mpl::na)
+BOOST_TYPEOF_REGISTER_TEMPLATE(::boost::fusion::vector, 10)
+BOOST_TYPEOF_REGISTER_TYPE(::boost::fusion::void_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(::boost::mpl::vector, 20)
+BOOST_TYPEOF_REGISTER_TYPE(std::string)
+BOOST_TYPEOF_REGISTER_TEMPLATE(::boost::mpl::size_t, (unsigned int))
+
+BOOST_TYPEOF_REGISTER_TYPE(::boost::msm::front::default_base_state)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::detail::inherit_attributes, 1)
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::func_state, 6)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::entry_func_state, (int)(typename)(typename)(typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::explicit_entry_func_state, (int)(typename)(typename)(typename)(typename)(typename)(typename))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::exit_func_state, 7)
+
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::define_flag, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::attribute, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::define_defer, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::define_init, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Source_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Target_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Current_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Event_, (int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::State_Attribute_, (typename)(int))
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::State_Machine_, (int))
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::none)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::Row, 5)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::ActionSequence_, 1)
+
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::NoAction)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::And_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Or_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Not_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::If_Else_, 3)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::If)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::If_Then_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::If_Then)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::While_Do_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::While_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Do_While_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Do_While_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::For_Loop_, 4)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::For_Loop_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Process_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Process_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Process2_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Process2_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Get_Flag_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Get_Flag_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Begin_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Begin_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::End_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::End_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Deref_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Deref_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Push_Back_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Push_Back_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Clear_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Clear_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Empty_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Empty_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Find_, 2)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Find_Helper)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Npos_, 1)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::False_)
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::True_)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Int_, (int))
+BOOST_TYPEOF_REGISTER_TYPE(boost::msm::front::euml::Int)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Pre_inc_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Pre_dec_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Post_inc_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Post_dec_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Plus_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Minus_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Multiplies_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Divides_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Modulus_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Bitwise_And_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Bitwise_Or_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Bitwise_Xor_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Subscript_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Plus_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Minus_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Multiplies_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Divides_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Modulus_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::ShiftLeft_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::ShiftRight_Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::ShiftLeft_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::ShiftRight_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Assign_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Unary_Plus_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Unary_Minus_, 1)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Less_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::LessEqual_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::Greater_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::GreaterEqual_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::EqualTo_, 2)
+BOOST_TYPEOF_REGISTER_TEMPLATE(boost::msm::front::euml::NotEqualTo_, 2)
+
+#endif //BOOST_MSM_FRONT_EUML_TYPEOF_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/guard_grammar.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/guard_grammar.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,356 @@
+// 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_FRONT_EUML_GUARD_GRAMMAR_H
+#define BOOST_MSM_FRONT_EUML_GUARD_GRAMMAR_H
+
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/msm/front/euml/operator.hpp>
+#include <boost/msm/front/euml/state_grammar.hpp>
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+struct BuildGuards;
+struct BuildActions;
+
+struct BuildGuardsCases
+{
+ // The primary template matches nothing:
+ template<typename Tag>
+ struct case_
+ : proto::not_<proto::_>
+ {};
+};
+template<>
+struct BuildGuardsCases::case_<proto::tag::logical_or>
+ : proto::when<
+ proto::logical_or<BuildGuards,BuildGuards >,
+ Or_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::logical_and>
+ : proto::when<
+ proto::logical_and<BuildGuards,BuildGuards >,
+ And_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::logical_not>
+ : proto::when<
+ proto::logical_not<BuildGuards >,
+ Not_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::less>
+ : proto::when<
+ proto::less<BuildGuards, BuildGuards >,
+ Less_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::less_equal>
+ : proto::when<
+ proto::less_equal<BuildGuards, BuildGuards >,
+ LessEqual_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::greater>
+ : proto::when<
+ proto::greater<BuildGuards, BuildGuards >,
+ Greater_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::greater_equal>
+ : proto::when<
+ proto::greater_equal<BuildGuards, BuildGuards >,
+ GreaterEqual_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::equal_to>
+ : proto::when<
+ proto::equal_to<BuildGuards, BuildGuards >,
+ EqualTo_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::not_equal_to>
+ : proto::when<
+ proto::not_equal_to<BuildGuards, BuildGuards >,
+ NotEqualTo_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::pre_inc>
+ : proto::when<
+ proto::pre_inc<BuildGuards >,
+ Pre_inc_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::dereference>
+ : proto::when<
+ proto::dereference<BuildGuards >,
+ Deref_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::pre_dec>
+ : proto::when<
+ proto::pre_dec<BuildGuards >,
+ Pre_dec_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::post_inc>
+ : proto::when<
+ proto::post_inc<BuildGuards >,
+ Post_inc_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::post_dec>
+ : proto::when<
+ proto::post_dec<BuildGuards >,
+ Post_dec_<BuildGuards(proto::_child)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::plus>
+ : proto::when<
+ proto::plus<BuildGuards,BuildGuards >,
+ Plus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::minus>
+ : proto::when<
+ proto::minus<BuildGuards,BuildGuards >,
+ Minus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::multiplies>
+ : proto::when<
+ proto::multiplies<BuildGuards,BuildGuards >,
+ Multiplies_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::divides>
+ : proto::when<
+ proto::divides<BuildGuards,BuildGuards >,
+ Divides_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::modulus>
+ : proto::when<
+ proto::modulus<BuildGuards,BuildGuards >,
+ Modulus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::bitwise_and>
+ : proto::when<
+ proto::bitwise_and<BuildGuards,BuildGuards >,
+ Bitwise_And_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::bitwise_or>
+ : proto::when<
+ proto::bitwise_or<BuildGuards,BuildGuards >,
+ Bitwise_Or_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::subscript>
+ : proto::when<
+ proto::subscript<BuildGuards,BuildGuards >,
+ Subscript_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::plus_assign>
+ : proto::when<
+ proto::plus_assign<BuildGuards,BuildGuards >,
+ Plus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::minus_assign>
+ : proto::when<
+ proto::minus_assign<BuildGuards,BuildGuards >,
+ Minus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::multiplies_assign>
+ : proto::when<
+ proto::multiplies_assign<BuildGuards,BuildGuards >,
+ Multiplies_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::divides_assign>
+ : proto::when<
+ proto::divides_assign<BuildGuards,BuildGuards >,
+ Divides_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::modulus_assign>
+ : proto::when<
+ proto::modulus_assign<BuildGuards,BuildGuards >,
+ Modulus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::shift_left_assign>
+ : proto::when<
+ proto::shift_left_assign<BuildGuards,BuildGuards >,
+ ShiftLeft_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::shift_right_assign>
+ : proto::when<
+ proto::shift_right_assign<BuildGuards,BuildGuards >,
+ ShiftRight_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::shift_left>
+ : proto::when<
+ proto::shift_left<BuildGuards,BuildGuards >,
+ ShiftLeft_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::shift_right>
+ : proto::when<
+ proto::shift_right<BuildGuards,BuildGuards >,
+ ShiftRight_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::assign>
+ : proto::when<
+ proto::assign<BuildGuards,BuildGuards >,
+ Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::bitwise_xor>
+ : proto::when<
+ proto::bitwise_xor<BuildGuards,BuildGuards >,
+ Bitwise_Xor_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
+ >
+{};
+template<>
+struct BuildGuardsCases::case_<proto::tag::negate>
+ : proto::when<
+ proto::negate<BuildGuards >,
+ Unary_Minus_<BuildGuards(proto::_child)>()
+ >
+{};
+
+template<>
+struct BuildGuardsCases::case_<proto::tag::function>
+ : proto::or_<
+ proto::when<
+ proto::function<proto::terminal<if_tag>,BuildGuards,BuildGuards,BuildGuards >,
+ If_Else_<BuildGuards(proto::_child_c<1>),
+ BuildGuards(proto::_child_c<2>),
+ BuildGuards(proto::_child_c<3>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_> >,
+ get_fct<proto::_child_c<0> >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>)
+ ,BuildActions(proto::_child_c<2>),BuildActions(proto::_child_c<3>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>),BuildActions(proto::_child_c<5>) >()
+ >
+#ifdef BOOST_MSVC
+ ,proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
+ ,BuildActions(proto::_child_c<5>),BuildActions(proto::_child_c<6>) >()
+ >
+#endif
+ >
+{};
+
+template<>
+struct BuildGuardsCases::case_<proto::tag::terminal>
+ : proto::or_<
+ proto::when <
+ proto::terminal<action_tag>,
+ get_action_name<proto::_ >()
+ >,
+ proto::when<
+ proto::terminal<state_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<flag_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<event_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<fsm_artefact_tag>,
+ get_fct<proto::_ >()
+ >,
+ proto::when<
+ proto::terminal<proto::_>,
+ proto::_value
+ >
+ >
+{};
+
+struct BuildGuards
+ : proto::switch_<BuildGuardsCases>
+{};
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_GUARD_GRAMMAR_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/iteration.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/iteration.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,26 @@
+// 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_FRONT_EUML_ITERATION_H
+#define BOOST_MSM_FRONT_EUML_ITERATION_H
+
+#include <algorithm>
+#include <numeric>
+#include <boost/msm/front/euml/common.hpp>
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+BOOST_MSM_EUML_FUNCTION(ForEach_ , std::for_each , for_each_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(Accumulate_ , std::accumulate , accumulate_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_ITERATION_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/operator.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/operator.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,1566 @@
+// 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_FRONT_EUML_OPERATOR_H
+#define BOOST_MSM_FRONT_EUML_OPERATOR_H
+
+#include <iterator>
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+#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)
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+template <class T1,class T2>
+struct Or_ : euml_action<Or_<T1,T2> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
+ {
+ return (T1()(evt,fsm,src,tgt) || T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)
+ {
+ return (T1()(evt,fsm,state) || T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct And_ : euml_action<And_<T1,T2> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
+ {
+ return (T1()(evt,fsm,src,tgt) && T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)
+ {
+ return (T1()(evt,fsm,state) && T2()(evt,fsm,state));
+ }
+};
+template <class T1>
+struct Not_ : euml_action<Not_<T1> >
+{
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)
+ {
+ return !(T1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)
+ {
+ return !(T1()(evt,fsm,state));
+ }
+};
+
+template <class Condition,class Action1,class Action2, class Enable=void >
+struct If_Else_ : euml_action<If_Else_<Condition,Action1,Action2,Enable> > {};
+
+template <class Condition,class Action1,class Action2>
+struct If_Else_<Condition,Action1,Action2
+ , typename ::boost::enable_if<typename has_tag_type<Action1>::type >::type>
+ : euml_action<If_Else_<Condition,Action1,Action2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Action1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Action1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Action1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ if (Condition()(evt,fsm,src,tgt))
+ {
+ return Action1()(evt,fsm,src,tgt);
+ }
+ return Action2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Action1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ if (Condition()(evt,fsm,state))
+ {
+ return Action1()(evt,fsm,state);
+ }
+ return Action2()(evt,fsm,state);
+ }
+};
+
+template <class Condition,class Action1,class Action2>
+struct If_Else_<Condition,Action1,Action2
+ , typename ::boost::disable_if<typename has_tag_type<Action1>::type >::type>
+ : euml_action<If_Else_<Condition,Action1,Action2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ if (Condition()(evt,fsm,src,tgt))
+ {
+ return Action1()(evt,fsm,src,tgt);
+ }
+ return Action2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ if (Condition()(evt,fsm,state))
+ {
+ return Action1()(evt,fsm,state);
+ }
+ return Action2()(evt,fsm,state);
+ }
+};
+
+struct if_tag
+{
+};
+struct If : proto::extends<proto::terminal<if_tag>::type, If, sm_domain>
+{
+ If(){}
+ using proto::extends< proto::terminal<if_tag>::type, If, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef If_Else_<Arg1,Arg2,Arg3> type;
+ };
+};
+If const if_then_else_;
+
+template <class Condition,class Action1, class Enable=void >
+struct If_Then_ : euml_action<If_Then_<Condition,Action1,Enable> > {};
+
+template <class Condition,class Action1>
+struct If_Then_<Condition,Action1
+ , typename ::boost::enable_if<typename has_tag_type<Action1>::type >::type>
+ : euml_action<If_Then_<Condition,Action1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Action1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Action1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Action1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ if (Condition()(evt,fsm,src,tgt))
+ {
+ return Action1()(evt,fsm,src,tgt);
+ }
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Action1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ if (Condition()(evt,fsm,state))
+ {
+ return Action1()(evt,fsm,state);
+ }
+ }
+};
+
+template <class Condition,class Action1>
+struct If_Then_<Condition,Action1
+ , typename ::boost::disable_if<typename has_tag_type<Action1>::type >::type>
+ : euml_action<If_Then_<Condition,Action1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ if (Condition()(evt,fsm,src,tgt))
+ {
+ return Action1()(evt,fsm,src,tgt);
+ }
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ if (Condition()(evt,fsm,state))
+ {
+ return Action1()(evt,fsm,state);
+ }
+ }
+};
+struct if_then_tag
+{
+};
+struct If_Then : proto::extends< proto::terminal<if_then_tag>::type, If_Then, sm_domain>
+{
+ If_Then(){}
+ using proto::extends< proto::terminal<if_then_tag>::type, If_Then, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef If_Then_<Arg1,Arg2> type;
+ };
+};
+If_Then const if_then_;
+
+template <class Condition,class Body>
+struct While_Do_ : euml_action<While_Do_<Condition,Body> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ Body body_;
+ Condition cond_;
+ while (cond_(evt,fsm,src,tgt))
+ {
+ body_(evt,fsm,src,tgt);
+ }
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ Body body_;
+ Condition cond_;
+ while (cond_(evt,fsm,state))
+ {
+ body_(evt,fsm,state);
+ }
+ }
+};
+struct while_do_tag
+{
+};
+struct While_Do_Helper : proto::extends< proto::terminal<while_do_tag>::type, While_Do_Helper, sm_domain>
+{
+ While_Do_Helper(){}
+ using proto::extends< proto::terminal<while_do_tag>::type, While_Do_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef While_Do_<Arg1,Arg2> type;
+ };
+};
+While_Do_Helper const while_;
+
+template <class Condition,class Body>
+struct Do_While_ : euml_action<Do_While_<Condition,Body> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ Condition cond_;
+ Body body_;
+ do
+ {
+ body_(evt,fsm,src,tgt);
+ } while (cond_(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ Condition cond_;
+ Body body_;
+ do
+ {
+ body_(evt,fsm,state);
+ } while (cond_(evt,fsm,state));
+ }
+};
+struct do_while_tag
+{
+};
+struct Do_While_Helper : proto::extends< proto::terminal<do_while_tag>::type, Do_While_Helper, sm_domain>
+{
+ Do_While_Helper(){}
+ using proto::extends< proto::terminal<do_while_tag>::type, Do_While_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Do_While_<Arg1,Arg2> type;
+ };
+};
+Do_While_Helper const do_while_;
+
+template <class Begin,class End,class EndLoop,class Body>
+struct For_Loop_ : euml_action<For_Loop_<Begin,End,EndLoop,Body> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ End end_;
+ EndLoop end_loop_;
+ Body body_;
+ for(Begin()(evt,fsm,src,tgt);end_(evt,fsm,src,tgt);end_loop_(evt,fsm,src,tgt))
+ {
+ body_(evt,fsm,src,tgt);
+ }
+ }
+ template <class Event,class FSM,class STATE>
+ void operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ End end_;
+ EndLoop end_loop_;
+ Body body_;
+ for(Begin()(evt,fsm,state);end_(evt,fsm,state);end_loop_(evt,fsm,state))
+ {
+ body_(evt,fsm,state);
+ }
+ }
+};
+struct for_loop_tag
+{
+};
+struct For_Loop_Helper : proto::extends< proto::terminal<for_loop_tag>::type, For_Loop_Helper, sm_domain>
+{
+ For_Loop_Helper(){}
+ using proto::extends< proto::terminal<for_loop_tag>::type, For_Loop_Helper, sm_domain>::operator=;
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef For_Loop_<Arg1,Arg2,Arg3,Arg4> type;
+ };
+};
+For_Loop_Helper const for_;
+
+
+
+
+template <class T>
+struct Deref_ : euml_action<Deref_<T> >
+{
+ Deref_(){}
+ using euml_action<Deref_<T> >::operator=;
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::add_reference<
+ typename std::iterator_traits <
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type>::value_type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::add_reference<
+ typename std::iterator_traits<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type
+ >::value_type
+ >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return *(T()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return *(T()(evt,fsm,state));
+ }
+};
+
+template <class T>
+struct Pre_inc_ : euml_action<Pre_inc_<T> >
+{
+ using euml_action<Pre_inc_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return ++T()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return ++T()(evt,fsm,state);
+ }
+};
+template <class T>
+struct Pre_dec_ : euml_action<Pre_dec_<T> >
+{
+ using euml_action<Pre_dec_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return --T()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return --T()(evt,fsm,state);
+ }
+};
+template <class T>
+struct Post_inc_ : euml_action<Post_inc_<T> >
+{
+ using euml_action<Post_inc_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T()(evt,fsm,src,tgt)++;
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T()(evt,fsm,state)++;
+ }
+};
+template <class T>
+struct Post_dec_ : euml_action<Post_dec_<T> >
+{
+ using euml_action<Post_dec_<T> >::operator=;
+
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T()(evt,fsm,src,tgt)--;
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T()(evt,fsm,state)--;
+ }
+};
+
+template <class T1,class T2>
+struct Plus_ : euml_action<Plus_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)+T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)+T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Minus_ : euml_action<Minus_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)-T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)-T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Multiplies_ : euml_action<Multiplies_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)*T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)*T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Divides_ : euml_action<Divides_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)/T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)/T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Modulus_ : euml_action<Modulus_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)%T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)%T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Bitwise_And_ : euml_action<Bitwise_And_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)&T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)&T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Bitwise_Or_ : euml_action<Bitwise_Or_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)|T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)|T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Bitwise_Xor_ : euml_action<Bitwise_Xor_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)^T2()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)^T2()(evt,fsm,state);
+ }
+};
+template <class T1,class T2>
+struct Subscript_ : euml_action<Subscript_<T1,T2> >
+{
+ template <class T>
+ struct get_reference
+ {
+ typedef typename T::reference type;
+ };
+ template <class T>
+ struct get_mapped_type
+ {
+ typedef typename T::value_type::second_type& type;
+ };
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type container_type;
+ typedef typename ::boost::mpl::eval_if<
+ typename has_key_type<container_type>::type,
+ get_mapped_type<container_type>,
+ ::boost::mpl::eval_if<
+ typename ::boost::is_pointer<container_type>::type,
+ ::boost::add_reference<typename ::boost::remove_pointer<container_type>::type >,
+ get_reference<container_type>
+ >
+ >::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type container_type;
+ typedef typename ::boost::mpl::eval_if<
+ typename has_key_type<container_type>::type,
+ get_mapped_type<container_type>,
+ ::boost::mpl::eval_if<
+ typename ::boost::is_pointer<container_type>::type,
+ ::boost::add_reference<typename ::boost::remove_pointer<container_type>::type >,
+ get_reference<container_type>
+ >
+ >::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return T1()(evt,fsm,src,tgt)[T2()(evt,fsm,src,tgt)];
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return T1()(evt,fsm,state)[T2()(evt,fsm,state)];
+ }
+};
+template <class T1,class T2>
+struct Plus_Assign_ : euml_action<Plus_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)+=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)+=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Minus_Assign_ : euml_action<Minus_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)-=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)-=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Multiplies_Assign_ : euml_action<Multiplies_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)*=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)*=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Divides_Assign_ : euml_action<Divides_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)/=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)/=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Modulus_Assign_ : euml_action<Modulus_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)%=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)%=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct ShiftLeft_Assign_ : euml_action<ShiftLeft_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)<<=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)<<=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct ShiftRight_Assign_ : euml_action<ShiftRight_Assign_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)>>=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)>>=T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct ShiftLeft_ : euml_action<ShiftLeft_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)<<T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)<<T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct ShiftRight_ : euml_action<ShiftRight_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)>>T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)>>T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Assign_ : euml_action<Assign_<T1,T2> >
+{
+ using euml_action< Assign_<T1,T2> >::operator=;
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<T1,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt)=T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return (T1()(evt,fsm,state)=T2()(evt,fsm,state));
+ }
+};
+template <class T1>
+struct Unary_Plus_ : euml_action<Unary_Plus_<T1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return +T1()(evt,fsm,src,tgt);
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return +T1()(evt,fsm,state);
+ }
+};
+template <class T1>
+struct Unary_Minus_ : euml_action<Unary_Minus_<T1> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type2<T1,Event,FSM,STATE>::type>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename ::boost::remove_reference<
+ typename get_result_type<T1,EVT,FSM,SourceState,TargetState>::type>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return -(T1()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return -(T1()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Less_ : euml_action<Less_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) < T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) < T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct LessEqual_ : euml_action<LessEqual_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) <= T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) <= T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct Greater_ : euml_action<Greater_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) > T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) > T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct GreaterEqual_ : euml_action<GreaterEqual_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) >= T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) >= T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct EqualTo_ : euml_action<EqualTo_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) == T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) == T2()(evt,fsm,state));
+ }
+};
+template <class T1,class T2>
+struct NotEqualTo_ : euml_action<NotEqualTo_<T1,T2> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef bool type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef bool type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ bool operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return (T1()(evt,fsm,src,tgt) != T2()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ bool operator()(Event const& evt,FSM& fsm,STATE& state)const
+ {
+ return (T1()(evt,fsm,state) != T2()(evt,fsm,state));
+ }
+};
+
+}}}}
+
+#endif // BOOST_MSM_FRONT_EUML_OPERATOR_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/querying.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/querying.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,43 @@
+// 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_FRONT_EUML_QUERYING_H
+#define BOOST_MSM_FRONT_EUML_QUERYING_H
+
+#include <algorithm>
+#include <boost/msm/front/euml/common.hpp>
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+BOOST_MSM_EUML_FUNCTION(Find_ , std::find , find_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(FindIf_ , std::find_if , find_if_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(LowerBound_ , std::lower_bound , lower_bound_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(UpperBound_ , std::upper_bound , upper_bound_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(BinarySearch_ , std::binary_search , binary_search_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(MinElement_ , std::min_element , min_element_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(MaxElement_ , std::max_element , max_element_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(AdjacentFind_ , std::adjacent_find , adjacent_find_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(FindEnd_ , std::find_end , find_end_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(FindFirstOf_ , std::find_first_of , find_first_of_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Equal_ , std::equal , equal_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(Search_ , std::search , search_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Includes_ , std::includes , includes_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(LexicographicalCompare_ , std::lexicographical_compare , lexicographical_compare_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(Count_ , std::count , count_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(CountIf_ , std::count_if , count_if_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Distance_ , std::distance , distance_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(EqualRange_ , std::equal_range , equal_range_ , RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 , RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Mismatch_ , std::mismatch , mismatch_ , RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 , RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 )
+
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_QUERYING_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/state_grammar.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/state_grammar.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,1783 @@
+// 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_FRONT_EUML_STATE_GRAMMAR_H
+#define BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H
+
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/as_map.hpp>
+
+#include <boost/mpl/remove_if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/assert.hpp>
+
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/front/common_states.hpp>
+#include <boost/msm/front/state_machine_def.hpp>
+#include <boost/msm/front/euml/operator.hpp>
+#include <boost/msm/front/euml/guard_grammar.hpp>
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(attribute_tag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(flag_create_tag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(defer_create_tag)
+BOOST_MPL_HAS_XXX_TRAIT_DEF(control_configure_tag)
+
+namespace proto = boost::proto;
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+// provides the typedefs and interface. Concrete states derive from it.
+template<class StateNameTag,
+ class EntryFunctor=NoAction,
+ class ExitFunctor=NoAction,
+ class Attributes= ::boost::fusion::vector<>,
+ class Flags = ::boost::mpl::vector0<>,
+ class Defer = ::boost::mpl::vector0<>,
+ class BASE = ::boost::msm::front::default_base_state>
+struct func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
+ euml_state<func_state<StateNameTag,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
+{
+ func_state(){}
+ // grammar testing
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
+
+ typedef StateNameTag state_name_tag;
+ // flags
+ typedef Flags flag_list;
+ // deferred events
+ typedef Defer deferred_events;
+
+ template <class Event,class FSM>
+ void on_entry(Event const& evt,FSM& fsm)
+ {
+ EntryFunctor()(evt,fsm,*this);
+ }
+ template <class Event,class FSM>
+ void on_exit(Event const& evt,FSM& fsm)
+ {
+ ExitFunctor()(evt,fsm,*this);
+ }
+};
+
+// provides the typedefs and interface. Concrete states derive from it.
+template<class StateNameTag,
+ int ZoneIndex=-1,
+ class EntryFunctor=NoAction,
+ class ExitFunctor=NoAction,
+ class Attributes= ::boost::fusion::vector<>,
+ class Flags = ::boost::mpl::vector0<>,
+ class Defer = ::boost::mpl::vector0<>,
+ class BASE = default_base_state>
+struct entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
+ euml_state<entry_func_state<StateNameTag,ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
+{
+ entry_func_state(){}
+ // grammar testing
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
+
+ typedef StateNameTag state_name_tag;
+ // tags
+ typedef int pseudo_entry;
+ enum {zone_index=ZoneIndex};
+ typedef int explicit_entry_state;
+
+ // flags
+ typedef Flags flag_list;
+ // deferred events
+ typedef Defer deferred_events;
+
+ template <class Event,class FSM>
+ void on_entry(Event const& evt,FSM& fsm)
+ {
+ EntryFunctor()(evt,fsm,*this);
+ }
+ template <class Event,class FSM>
+ void on_exit(Event const& evt,FSM& fsm)
+ {
+ ExitFunctor()(evt,fsm,*this);
+ }
+};
+// provides the typedefs and interface. Concrete states derive from it.
+template<class StateNameTag,
+ int ZoneIndex=-1,
+ class EntryFunctor=NoAction,
+ class ExitFunctor=NoAction,
+ class Attributes= ::boost::fusion::vector<>,
+ class Flags = ::boost::mpl::vector0<>,
+ class Defer = ::boost::mpl::vector0<>,
+ class BASE = default_base_state>
+struct explicit_entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
+ public ::boost::msm::front::explicit_entry<ZoneIndex>,
+ euml_state<explicit_entry_func_state<StateNameTag,
+ ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
+{
+ explicit_entry_func_state(){}
+ // grammar testing
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
+
+ typedef StateNameTag state_name_tag;
+ // flags
+ typedef Flags flag_list;
+ // deferred events
+ typedef Defer deferred_events;
+
+ template <class Event,class FSM>
+ void on_entry(Event const& evt,FSM& fsm)
+ {
+ EntryFunctor()(evt,fsm,*this);
+ }
+ template <class Event,class FSM>
+ void on_exit(Event const& evt,FSM& fsm)
+ {
+ ExitFunctor()(evt,fsm,*this);
+ }
+};
+
+// provides the typedefs and interface. Concrete states derive from it.
+template<class StateNameTag,
+ class Event,
+ class EntryFunctor=NoAction,
+ class ExitFunctor=NoAction,
+ class Attributes= ::boost::fusion::vector<>,
+ class Flags = ::boost::mpl::vector0<>,
+ class Defer = ::boost::mpl::vector0<>,
+ class BASE = default_base_state>
+struct exit_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
+ euml_state<exit_func_state<StateNameTag,Event,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
+{
+ exit_func_state(){}
+ // grammar testing
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
+
+ typedef StateNameTag state_name_tag;
+ // tags
+ typedef Event event;
+ typedef BASE Base;
+ typedef int pseudo_exit;
+
+ // flags
+ typedef Flags flag_list;
+ // deferred events
+ typedef Defer deferred_events;
+
+ template <class Evt,class FSM>
+ void on_entry(Evt const& evt,FSM& fsm)
+ {
+ EntryFunctor()(evt,fsm,*this);
+ }
+ template <class Evt,class FSM>
+ void on_exit(Evt const& evt,FSM& fsm)
+ {
+ ExitFunctor()(evt,fsm,*this);
+ }
+};
+
+struct BuildActions;
+struct BuildGuards;
+
+struct BuildActionSequence
+ : proto::or_<
+ proto::when <
+ BuildActions,
+ ActionSequence_<make_vector_one_row<BuildActions(proto::_)>()>()
+ >,
+ proto::when <
+ proto::comma<BuildActions,BuildActions >,
+ ActionSequence_<boost::mpl::push_back<
+ make_vector_one_row<BuildActions(proto::_left)>(),
+ BuildActions(proto::_right)>()>()
+ >,
+ proto::when <
+ proto::comma<BuildActionSequence,BuildActions >,
+ ActionSequence_<boost::mpl::push_back<
+ get_sequence<BuildActionSequence(proto::_left) >(),
+ BuildActions(proto::_right) >() >()
+ >
+ >
+{};
+
+struct BuildActionsCases
+{
+ // The primary template matches nothing:
+ template<typename Tag>
+ struct case_
+ : proto::not_<proto::_>
+ {};
+};
+
+template<>
+struct BuildActionsCases::case_<proto::tag::pre_inc>
+ : proto::when<
+ proto::pre_inc<BuildActions >,
+ Pre_inc_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::pre_dec>
+ : proto::when<
+ proto::pre_dec<BuildActions >,
+ Pre_dec_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::post_inc>
+ : proto::when<
+ proto::post_inc<BuildActions >,
+ Post_inc_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::post_dec>
+ : proto::when<
+ proto::post_dec<BuildActions >,
+ Post_dec_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::dereference>
+ : proto::when<
+ proto::dereference<BuildActions >,
+ Deref_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::plus>
+ : proto::when<
+ proto::plus<BuildActions,BuildActions >,
+ Plus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::minus>
+ : proto::when<
+ proto::minus<BuildActions,BuildActions >,
+ Minus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::multiplies>
+ : proto::when<
+ proto::multiplies<BuildActions,BuildActions >,
+ Multiplies_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::divides>
+ : proto::when<
+ proto::divides<BuildActions,BuildActions >,
+ Divides_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::modulus>
+ : proto::when<
+ proto::modulus<BuildActions,BuildActions >,
+ Modulus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::bitwise_and>
+ : proto::when<
+ proto::bitwise_and<BuildActions,BuildActions >,
+ Bitwise_And_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::bitwise_or>
+ : proto::when<
+ proto::bitwise_or<BuildActions,BuildActions >,
+ Bitwise_Or_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::bitwise_xor>
+ : proto::when<
+ proto::bitwise_xor<BuildActions,BuildActions >,
+ Bitwise_Xor_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+
+template<>
+struct BuildActionsCases::case_<proto::tag::plus_assign>
+ : proto::when<
+ proto::plus_assign<BuildActions,BuildActions >,
+ Plus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::minus_assign>
+ : proto::when<
+ proto::minus_assign<BuildActions,BuildActions >,
+ Minus_Assign_<BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::multiplies_assign>
+ : proto::when<
+ proto::multiplies_assign<BuildActions,BuildActions >,
+ Multiplies_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::divides_assign>
+ : proto::when<
+ proto::divides_assign<BuildActions,BuildActions >,
+ Divides_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::modulus_assign>
+ : proto::when<
+ proto::modulus_assign<BuildActions,BuildActions >,
+ Modulus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::shift_left_assign>
+ : proto::when<
+ proto::shift_left_assign<BuildActions,BuildActions >,
+ ShiftLeft_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::shift_right_assign>
+ : proto::when<
+ proto::shift_right_assign<BuildActions,BuildActions >,
+ ShiftRight_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::shift_left>
+ : proto::when<
+ proto::shift_left<BuildActions,BuildActions >,
+ ShiftLeft_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::shift_right>
+ : proto::when<
+ proto::shift_right<BuildActions,BuildActions >,
+ ShiftRight_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::assign>
+ : proto::when<
+ proto::assign<BuildActions,BuildActions >,
+ Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::subscript>
+ : proto::when<
+ proto::subscript<BuildActions,BuildActions >,
+ Subscript_< BuildActions(proto::_left),BuildActions(proto::_right)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::unary_plus>
+ : proto::when<
+ proto::unary_plus<BuildActions >,
+ Unary_Plus_< BuildActions(proto::_child)>()
+ >
+{};
+template<>
+struct BuildActionsCases::case_<proto::tag::negate>
+ : proto::when<
+ proto::negate<BuildActions >,
+ Unary_Minus_< BuildActions(proto::_child)>()
+ >
+{};
+
+template<>
+struct BuildActionsCases::case_<proto::tag::function>
+ : proto::or_<
+ proto::when<
+ proto::function<proto::terminal<if_tag>,BuildGuards,BuildActionSequence,BuildActionSequence >,
+ If_Else_<BuildGuards(proto::_child_c<1>),
+ BuildActionSequence(proto::_child_c<2>),
+ BuildActionSequence(proto::_child_c<3>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<if_then_tag>,BuildGuards,BuildActionSequence >,
+ If_Then_<BuildGuards(proto::_child_c<1>),
+ BuildActionSequence(proto::_child_c<2>)>()
+ >,
+ proto::when<
+ proto::function<proto::terminal<while_do_tag>,BuildGuards,BuildActionSequence >,
+ While_Do_<BuildGuards(proto::_child_c<1>),
+ BuildActionSequence(proto::_child_c<2>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<do_while_tag>,BuildGuards,BuildActionSequence >,
+ Do_While_<BuildGuards(proto::_child_c<1>),
+ BuildActionSequence(proto::_child_c<2>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<for_loop_tag>,
+ BuildActionSequence,BuildGuards,BuildActionSequence,BuildActionSequence>,
+ For_Loop_<BuildActionSequence(proto::_child_c<1>),
+ BuildGuards(proto::_child_c<2>),
+ BuildActionSequence(proto::_child_c<3>),
+ BuildActionSequence(proto::_child_c<4>) >()
+ >,
+ proto::or_<
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_> >,
+ get_fct<proto::_child_c<0> >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>)
+ ,BuildActions(proto::_child_c<2>),BuildActions(proto::_child_c<3>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>) >()
+ >,
+ proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
+ ,BuildActions(proto::_child_c<5>) >()
+ >
+#ifdef BOOST_MSVC
+ ,proto::when<
+ proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
+ get_fct<proto::_child_c<0>
+ ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
+ ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
+ ,BuildActions(proto::_child_c<5>),BuildActions(proto::_child_c<6>) >()
+ >
+#endif
+ >
+ >
+{};
+
+template<>
+struct BuildActionsCases::case_<proto::tag::terminal>
+ : proto::or_<
+ proto::when<
+ proto::terminal<action_tag>,
+ get_action_name<proto::_ >()
+ >,
+ proto::when<
+ proto::terminal<state_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<flag_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<event_tag>,
+ proto::_
+ >,
+ proto::when<
+ proto::terminal<fsm_artefact_tag>,
+ get_fct<proto::_ >()
+ >,
+ proto::when<
+ proto::terminal<proto::_>,
+ proto::_value
+ >
+ >
+{};
+struct BuildActions
+ : proto::switch_<BuildActionsCases>
+{};
+
+// attributes building
+#define BOOST_MSM_EUML_DECLARE_ATTRIBUTE(attr_type,attr_name) \
+struct attr_name ## _ \
+ : proto::extends< proto::terminal<msm::front::action_tag>::type, attr_name ## _, sm_domain> \
+ {typedef attr_name ## _ action_name; \
+ typedef ::boost::fusion::pair<attr_name ## _,attr_type> attribute_type; \
+ attr_name ## _ (){} \
+ }; \
+attr_name ## _ const attr_name;
+
+struct make_attributes_tag
+{
+ typedef int attribute_tag;
+};
+
+template <class T>
+struct get_attribute_type
+{
+ typedef typename T::attribute_type type;
+};
+template <class Seq>
+struct transform_to_fusion_pair
+{
+ typedef typename ::boost::mpl::fold<
+ Seq,::boost::mpl::vector<>,
+ ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+ get_attribute_type< ::boost::mpl::placeholders::_2> >
+ >::type type;
+};
+
+template<class X = proto::is_proto_expr>
+struct attribute
+{
+ BOOST_PROTO_BASIC_EXTENDS(
+ proto::terminal<make_attributes_tag>::type
+ , attribute
+ , sm_domain
+ )
+ typedef ::boost::fusion::pair<int,int> attribute_type;
+};
+
+ attribute<> const attributes_ = {{}};
+ attribute<> const no_attributes_ = {{}};
+
+ struct BuildAttributesHelper
+ : proto::make<
+ ::boost::mpl::pop_front<
+ proto::fold_tree<
+ proto::_
+ , ::boost::fusion::vector<>()
+ , ::boost::mpl::push_back<proto::_state,
+ ::boost::mpl::if_< has_attribute_tag< proto::_value>,
+ proto::_value,
+ get_attribute_type<proto::_> >
+ >()
+ >
+ >
+ >
+ {};
+
+struct BuildAttributes
+ : proto::make<
+ ::boost::mpl::if_<
+ has_attribute_tag< ::boost::mpl::deref< ::boost::mpl::prior< ::boost::mpl::end< BuildAttributesHelper > > > >,
+ ::boost::fusion::result_of::as_map< ::boost::mpl::pop_back< BuildAttributesHelper > >,
+ ::boost::fusion::result_of::as_map< BuildAttributesHelper > >
+ >
+{};
+
+// helper to build a mpl::vector from a << list
+ struct BuildMplVectorHelper
+ : proto::make<
+ ::boost::mpl::pop_front<
+ proto::fold_tree<
+ proto::_
+ , ::boost::mpl::vector0<>()
+ , ::boost::mpl::push_back<proto::_state, proto::_>()
+ >
+ >
+ >
+ {};
+
+// flags building
+struct BuildFlags
+ : proto::make<
+ ::boost::mpl::remove_if<
+ BuildMplVectorHelper,
+ ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, flag_tag > >
+ >
+ >
+{};
+
+struct control_configure_tag {};
+
+// configuration building
+struct make_configure_tag
+{
+ typedef int control_configure_tag;
+};
+
+template<class X = proto::is_proto_expr>
+struct configure
+{
+ typedef not_euml_tag euml_tag_type;
+ BOOST_PROTO_BASIC_EXTENDS(
+ proto::terminal<make_configure_tag>::type
+ , configure
+ , sm_domain
+ )
+};
+
+ configure<> const configure_ = {{}};
+ configure<> const no_configure_ = {{}};
+
+struct BuildConfigure
+ : proto::make<
+ ::boost::mpl::remove_if<
+ BuildMplVectorHelper,
+ ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, config_tag > >
+ >
+ >
+{};
+
+struct BuildDeferred
+ : proto::make<
+ ::boost::mpl::remove_if<
+ BuildMplVectorHelper,
+ ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, event_tag > >
+ >
+ >
+{};
+
+template<class X = proto::is_proto_expr>
+struct define_init
+{
+ typedef int defer_create_tag;
+ BOOST_PROTO_BASIC_EXTENDS(
+ proto::terminal<state_tag>::type
+ , define_init
+ , sm_domain
+ )
+};
+
+define_init<> const init_ = {{}};
+struct BuildInit
+ : proto::make<
+ ::boost::mpl::pop_front<
+ proto::fold_tree<
+ proto::_
+ , ::boost::mpl::vector0<>()
+ , ::boost::mpl::push_back<proto::_state, proto::_>()
+ >
+ >
+ >
+ {};
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type
+>
+build_state(Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type
+>
+build_state(Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return func_state<StateNameTag,entry_action,exit_action>();
+}
+
+template <class StateNameTag,class Expr1>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction
+>
+build_state(Expr1 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return func_state<StateNameTag,entry_action,NoAction>();
+}
+template<class StateNameTag>
+inline
+func_state<
+StateNameTag,
+NoAction,
+NoAction
+>
+build_state()
+{
+ return func_state<StateNameTag,NoAction,NoAction>();
+}
+
+// provides the typedefs and interface. Concrete states derive from it.
+template<class StateNameTag,
+ class STT,
+ class Init,
+ class EntryFunctor=NoAction,
+ class ExitFunctor=NoAction,
+ class Attributes= ::boost::fusion::vector<>,
+ class Flags = ::boost::mpl::vector0<>,
+ class Defer = ::boost::mpl::vector0<>,
+ class Configuration = ::boost::mpl::vector0<>,
+ class NoTransitionFunctor = NoAction,
+ class OnExceptionFunctor = NoAction,
+ class BASE = ::boost::msm::front::default_base_state>
+struct func_state_machine : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
+ euml_state<func_state_machine<StateNameTag,STT,Init,EntryFunctor,ExitFunctor,Attributes,Flags,
+ Defer,NoTransitionFunctor,OnExceptionFunctor,BASE> >
+{
+ func_state_machine(){}
+ // grammar testing
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<NoTransitionFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<OnExceptionFunctor,invalid_type> ));
+ BOOST_MPL_ASSERT_NOT(( boost::is_same<STT,invalid_type> ));
+
+ // flags
+ typedef StateNameTag state_name_tag;
+ typedef Flags flag_list;
+ // deferred events
+ typedef Defer deferred_events;
+ // customization (message queue, exceptions)
+ typedef Configuration configuration;
+
+
+ typedef BASE BaseAllStates;
+ typedef STT transition_table;
+ // the initial state of the player SM. Must be defined
+ typedef Init initial_state;
+
+ template <class Event,class FSM>
+ void on_entry(Event const& evt,FSM& fsm)
+ {
+ EntryFunctor()(evt,fsm,*this);
+ }
+ template <class Event,class FSM>
+ void on_exit(Event const& evt,FSM& fsm)
+ {
+ ExitFunctor()(evt,fsm,*this);
+ }
+protected:
+ // Default no-transition handler. Can be replaced in the Derived SM class.
+ template <class FSM,class Event>
+ void no_transition(Event const& evt,FSM& fsm,int state)
+ {
+ NoTransitionFunctor()(evt,fsm,state);
+ }
+ // default exception handler. Can be replaced in the Derived SM class.
+ template <class FSM,class Event>
+ void exception_caught (Event const& evt,FSM& fsm,std::exception& e)
+ {
+ OnExceptionFunctor()(evt,fsm,e);
+ }
+};
+
+template <class StateNameTag,class STT,class Init>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type
+>
+build_sm(STT ,Init)
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ return func_state_machine<StateNameTag,STT,init_type>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type
+>
+build_sm(STT ,Init , Expr1 const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+typename boost::result_of<BuildConfigure(Configure)>::type
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const& )
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,
+ deferred_type,config_type>();
+
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+typename boost::result_of<BuildConfigure(Configure)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr3,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr3)>,
+ make_invalid_type>::type
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&, Configure const&, Expr3 const& )
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr3)>::type no_transition_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
+ config_type,no_transition_action>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+typename boost::result_of<BuildConfigure(Configure)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr3,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr3)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr4,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr4)>,
+ make_invalid_type>::type
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const&, Expr3 const&, Expr4 const& )
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr3)>::type no_transition_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr4)>::type on_exception_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
+ config_type,no_transition_action,on_exception_action>();
+}
+
+template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4,class BASE>
+inline
+func_state_machine<
+StateNameTag,
+STT,
+typename boost::result_of<BuildInit(Init)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+typename boost::result_of<BuildConfigure(Configure)>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr3,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr3)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr4,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr4)>,
+ make_invalid_type>::type,
+BASE
+>
+build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const& , Configure const&, Expr3 const&, Expr4 const& , BASE )
+{
+ typedef typename boost::result_of<BuildInit(Init)>::type init_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
+ typedef typename boost::result_of<BuildActionSequence(Expr3)>::type no_transition_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr4)>::type on_exception_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
+ config_type,no_transition_action,on_exception_action,BASE>();
+}
+
+template <class Expr>
+inline
+::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type>
+build_attributes (Expr const&)
+{
+ return ::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type> ();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::TerminateFlag>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_terminate_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename ::boost::mpl::push_back<
+ typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::TerminateFlag >::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::TerminateFlag>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename ::boost::mpl::push_back<
+ typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::TerminateFlag >::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+::boost::mpl::vector<boost::msm::TerminateFlag>
+>
+build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
+}
+
+template <class StateNameTag,class Expr1,class Expr2>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::TerminateFlag>
+>
+build_terminate_state(Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return func_state<StateNameTag,entry_action,exit_action,
+ ::boost::fusion::vector<>, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
+}
+
+template <class StateNameTag,class Expr1>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::TerminateFlag>
+>
+build_terminate_state(Expr1 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return func_state<StateNameTag,entry_action,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
+}
+template<class StateNameTag>
+inline
+func_state<
+StateNameTag,
+NoAction,
+NoAction,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::TerminateFlag>
+>
+build_terminate_state()
+{
+ return func_state<StateNameTag,NoAction,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename ::boost::mpl::push_back<
+ typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::InterruptedFlag>::type,
+ boost::msm::EndInterruptFlag<EndInterruptEvent>
+ >::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ typedef typename ::boost::mpl::push_back<
+ typename ::boost::mpl::push_back<
+ typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::InterruptedFlag>::type,
+ boost::msm::EndInterruptFlag<EndInterruptEvent>
+ >::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename ::boost::mpl::push_back<
+ typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::InterruptedFlag>::type,
+ boost::msm::EndInterruptFlag<EndInterruptEvent>
+ >::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+
+ typedef typename ::boost::mpl::push_back<
+ typename ::boost::mpl::push_back<
+ typename boost::result_of<BuildFlags(Configure)>::type,
+ ::boost::msm::InterruptedFlag>::type,
+ boost::msm::EndInterruptFlag<EndInterruptEvent>
+ >::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class Attr,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
+>
+build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return func_state<StateNameTag,entry_action,exit_action,attributes_type,
+ ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
+}
+
+template <class StateNameTag,class Expr1,class Expr2,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
+>
+build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return func_state<StateNameTag,entry_action,exit_action,
+ ::boost::fusion::vector<>,
+ ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
+}
+
+template <class StateNameTag,class Expr1,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
+>
+build_interrupt_state(EndInterruptEvent const&, Expr1 const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return func_state<StateNameTag,entry_action,NoAction, ::boost::fusion::vector<>,
+ ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
+}
+
+template <class StateNameTag,class EndInterruptEvent>
+inline
+func_state<
+StateNameTag,
+NoAction,
+NoAction,
+::boost::fusion::vector<>,
+::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
+>
+build_interrupt_state(EndInterruptEvent const&)
+{
+ return func_state<StateNameTag,NoAction,NoAction, ::boost::fusion::vector<>,
+ ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type
+>
+build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type
+>
+build_entry_state(Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction
+>
+build_entry_state(Expr1 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
+}
+
+template <class StateNameTag,int ZoneIndex>
+inline
+entry_func_state<
+StateNameTag,
+ZoneIndex,
+NoAction,
+NoAction
+>
+build_entry_state()
+{
+ return entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
+}
+
+template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_exit_state(Event const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type
+>
+build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type>();
+}
+
+template <class StateNameTag,class Event,class Expr1,class Expr2>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type
+>
+build_exit_state(Event const&,Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return exit_func_state<StateNameTag,Event,entry_action,exit_action>();
+}
+
+template <class StateNameTag,class Event,class Expr1>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction
+>
+build_exit_state(Event const&, Expr1 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return exit_func_state<StateNameTag,Event,entry_action,NoAction>();
+}
+
+template <class StateNameTag,class Event>
+inline
+exit_func_state<
+StateNameTag,
+Event,
+NoAction,
+NoAction
+>
+build_exit_state(Event const&)
+{
+ return exit_func_state<StateNameTag,Event,NoAction,NoAction>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type,
+BASE
+>
+build_explicit_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type,
+typename boost::result_of<BuildFlags(Configure)>::type,
+typename boost::result_of<BuildDeferred(Configure)>::type
+>
+build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
+ typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type,
+typename boost::result_of<BuildAttributes(Attr)>::type
+>
+build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr2,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr2)>,
+ make_invalid_type>::type
+>
+build_explicit_entry_state(Expr1 const& ,Expr2 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ typedef typename boost::result_of<BuildActionSequence(Expr2)>::type exit_action;
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
+}
+
+template <class StateNameTag,int ZoneIndex,class Expr1>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr1,BuildActionSequence>::type,
+ boost::result_of<BuildActionSequence(Expr1)>,
+ make_invalid_type>::type,
+NoAction
+>
+build_explicit_entry_state(Expr1 const& )
+{
+ typedef typename boost::result_of<BuildActionSequence(Expr1)>::type entry_action;
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
+}
+
+template <class StateNameTag,int ZoneIndex>
+inline
+explicit_entry_func_state<
+StateNameTag,
+ZoneIndex,
+NoAction,
+NoAction
+>
+build_explicit_entry_state()
+{
+ return explicit_entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
+}
+
+
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H
+

Added: branches/msm/msm_phoenix/boost/msm/front/euml/stl.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/stl.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,17 @@
+// 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_FRONT_EUML_STL_H
+#define BOOST_MSM_FRONT_EUML_STL_H
+
+#include <boost/msm/front/euml/container.hpp>
+#include <boost/msm/front/euml/algorithm.hpp>
+
+#endif //BOOST_MSM_FRONT_EUML_STL_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/stt_grammar.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/stt_grammar.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,279 @@
+// 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_FRONT_EUML_STT_GRAMMAR_H
+#define BOOST_MSM_FRONT_EUML_STT_GRAMMAR_H
+
+#include <boost/msm/front/euml/common.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/eval_if.hpp>
+
+#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/phoenix/phoenix.hpp>
+
+#include <boost/msm/front/euml/operator.hpp>
+#include <boost/msm/front/euml/guard_grammar.hpp>
+#include <boost/msm/front/euml/state_grammar.hpp>
+
+namespace proto = boost::proto;
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+
+template <class SOURCE,class EVENT,class TARGET,class ACTION=none,class GUARD=none>
+struct TempRow
+{
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef TARGET Target;
+ typedef ACTION Action;
+ typedef GUARD Guard;
+};
+
+template <class TEMP_ROW>
+struct convert_to_row
+{
+ typedef Row<typename TEMP_ROW::Source,typename TEMP_ROW::Evt,typename TEMP_ROW::Target,
+ typename TEMP_ROW::Action,typename TEMP_ROW::Guard> type;
+};
+template <class TEMP_ROW>
+struct convert_to_internal_row
+{
+ typedef Internal<typename TEMP_ROW::Evt,
+ typename TEMP_ROW::Action,typename TEMP_ROW::Guard> type;
+};
+// explicit + fork + entry point + exit point grammar
+struct BuildEntry
+ : proto::when<
+ proto::function<proto::terminal<proto::_>,proto::terminal<state_tag>,proto::terminal<state_tag> >,
+ get_fct<proto::_child_c<0>,proto::_child_c<1>,proto::_child_c<2> >()
+ >
+{};
+
+// row grammar
+struct BuildNextStates
+ : proto::or_<
+ proto::when<
+ proto::terminal<state_tag>,
+ proto::_
+ >,
+ proto::when<
+ BuildEntry,
+ BuildEntry
+ >,
+ proto::when<
+ proto::comma<BuildEntry,BuildEntry >,
+ ::boost::mpl::push_back<
+ make_vector_one_row<BuildEntry(proto::_left)>(),
+ BuildEntry(proto::_right)>()
+ >,
+ proto::when <
+ proto::comma<BuildNextStates,BuildEntry >,
+ ::boost::mpl::push_back<
+ BuildNextStates(proto::_left),
+ BuildEntry(proto::_right) >()
+ >
+ >
+{};
+
+template <class EventGuard,class ActionClass>
+struct fusion_event_action_guard
+{
+ typedef TempRow<none,typename EventGuard::Evt,none,typename ActionClass::Action,typename EventGuard::Guard> type;
+};
+
+template <class SourceGuard,class ActionClass>
+struct fusion_source_action_guard
+{
+ typedef TempRow<typename SourceGuard::Source,none,none,typename ActionClass::Action,typename SourceGuard::Guard> type;
+};
+
+template <class SourceClass,class EventClass>
+struct fusion_source_event_action_guard
+{
+ typedef TempRow<typename SourceClass::Source,typename EventClass::Evt,
+ none,typename EventClass::Action,typename EventClass::Guard> type;
+};
+template <class Left,class Right>
+struct fusion_left_right
+{
+ typedef TempRow<typename Right::Source,typename Right::Evt,typename Left::Target
+ ,typename Right::Action,typename Right::Guard> type;
+};
+
+struct BuildEventPlusGuard
+ : proto::when<
+ proto::subscript<proto::terminal<event_tag>, boost::phoenix::meta_grammar >,
+ TempRow<none,proto::_left,none,none, proto::_right>(proto::_right)
+ >
+ {};
+
+struct BuildSourceState
+ : proto::or_<
+ proto::when<
+ proto::terminal<state_tag>,
+ proto::_
+ >,
+ proto::when<
+ BuildEntry,
+ BuildEntry
+ >
+ >
+{};
+
+struct BuildSourcePlusGuard
+ : proto::when<
+ proto::subscript<BuildSourceState,boost::phoenix::meta_grammar >,
+ TempRow<BuildSourceState(proto::_left),none,none,none,proto::_right>(proto::_right)
+ >
+{};
+
+struct BuildEvent
+ : proto::or_<
+ // just event without guard/action
+ proto::when<
+ proto::terminal<event_tag>,
+ TempRow<none,proto::_,none>() >
+ // event / action
+ , proto::when<
+ proto::divides<proto::terminal<event_tag>,boost::phoenix::meta_grammar >,
+ TempRow<none,proto::_left,none,proto::_right >(proto::_right) >
+ // event [ guard ]
+ , proto::when<
+ proto::subscript<proto::terminal<event_tag>,boost::phoenix::meta_grammar >,
+ TempRow<none,proto::_left,none,none,proto::_right>(proto::_right) >
+ // event [ guard ] / action
+ , proto::when<
+ proto::divides<BuildEventPlusGuard, boost::phoenix::meta_grammar>,
+ fusion_event_action_guard<BuildEventPlusGuard(proto::_left),
+ TempRow<none,none,none,proto::_right>(proto::_right)
+ >()
+ >
+ >
+{};
+struct BuildSource
+ : proto::or_<
+ // after == if just state without event or guard/action
+ proto::when<
+ BuildSourceState,
+ TempRow<BuildSourceState(proto::_),none,none>() >
+ // == source / action
+ , proto::when<
+ proto::divides<BuildSourceState,boost::phoenix::meta_grammar >,
+ TempRow<BuildSourceState(proto::_left),none,none,proto::_right >(proto::_right) >
+ // == source [ guard ]
+ , proto::when<
+ proto::subscript<BuildSourceState,boost::phoenix::meta_grammar >,
+ TempRow<BuildSourceState(proto::_left),none,none,none,proto::_right>(proto::_right) >
+ // == source [ guard ] / action
+ , proto::when<
+ proto::divides<BuildSourcePlusGuard,
+ boost::phoenix::meta_grammar >,
+ fusion_source_action_guard<BuildSourcePlusGuard(proto::_left),
+ TempRow<none,none,none,proto::_right>(proto::_right)
+ >()
+ >
+ >
+{};
+
+struct BuildRight
+ : proto::or_<
+ proto::when<
+ proto::plus<BuildSource,BuildEvent >,
+ fusion_source_event_action_guard<BuildSource(proto::_left),BuildEvent(proto::_right)>()
+ >,
+ proto::when<
+ BuildSource,
+ BuildSource
+ >
+ >
+{};
+
+struct BuildRow
+ : proto::or_<
+ // grammar 1
+ proto::when<
+ proto::equal_to<BuildNextStates,BuildRight >,
+ convert_to_row<
+ fusion_left_right<TempRow<none,none,BuildNextStates(proto::_left)>,BuildRight(proto::_right)> >()
+ >,
+ // internal events
+ proto::when<
+ BuildRight,
+ convert_to_row<
+ fusion_left_right<TempRow<none,none,none>,BuildRight(proto::_)> >()
+ >,
+ // grammar 2
+ proto::when<
+ proto::equal_to<BuildRight,BuildNextStates>,
+ convert_to_row<
+ fusion_left_right<TempRow<none,none,BuildNextStates(proto::_right)>,BuildRight(proto::_left)> >()
+ >
+ >
+{};
+
+// stt grammar
+struct BuildStt
+ : proto::or_<
+ proto::when<
+ proto::comma<BuildStt,BuildStt>,
+ boost::mpl::push_back<BuildStt(proto::_left),BuildRow(proto::_right)>()
+ >,
+ proto::when <
+ BuildRow,
+ make_vector_one_row<BuildRow(proto::_)>()
+ >
+ >
+{};
+
+template <class Expr>
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr,BuildStt>::type,
+ boost::result_of<BuildStt(Expr)>,
+ make_invalid_type>::type
+build_stt(Expr const& expr)
+{
+ return typename boost::result_of<BuildStt(Expr)>::type();
+}
+
+// internal stt grammar
+struct BuildInternalRow
+ : proto::when<
+ BuildEvent,
+ convert_to_internal_row<
+ fusion_left_right<TempRow<none,none,none>,BuildEvent(proto::_)> >()
+ >
+{};
+struct BuildInternalStt
+ : proto::or_<
+ proto::when<
+ proto::comma<BuildInternalStt,BuildInternalStt>,
+ boost::mpl::push_back<BuildInternalStt(proto::_left),BuildInternalRow(proto::_right)>()
+ >,
+ proto::when <
+ BuildInternalRow,
+ make_vector_one_row<BuildInternalRow(proto::_)>()
+ >
+ >
+{};
+
+template <class Expr>
+typename ::boost::mpl::eval_if<
+ typename proto::matches<Expr,BuildInternalStt>::type,
+ boost::result_of<BuildInternalStt(Expr)>,
+ make_invalid_type>::type
+build_internal_stt(Expr const& expr)
+{
+ return typename boost::result_of<BuildInternalStt(Expr)>::type();
+}
+
+
+}}}}
+#endif //BOOST_MSM_FRONT_EUML_STT_GRAMMAR_H

Added: branches/msm/msm_phoenix/boost/msm/front/euml/transformation.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/euml/transformation.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,335 @@
+// 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_FRONT_EUML_TRANSFORMATION_H
+#define BOOST_MSM_FRONT_EUML_TRANSFORMATION_H
+
+#include <algorithm>
+#include <boost/msm/front/euml/common.hpp>
+
+namespace boost { namespace msm { namespace front { namespace euml
+{
+#ifdef __STL_CONFIG_H
+BOOST_MSM_EUML_FUNCTION(FillN_ , std::fill_n , fill_n_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Rotate_ , std::rotate , rotate_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(GenerateN_ , std::generate_n , generate_n_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+
+#else
+BOOST_MSM_EUML_FUNCTION(FillN_ , std::fill_n , fill_n_ , void , void )
+BOOST_MSM_EUML_FUNCTION(Rotate_ , std::rotate , rotate_ , void , void )
+BOOST_MSM_EUML_FUNCTION(GenerateN_ , std::generate_n , generate_n_ , void , void )
+#endif
+
+BOOST_MSM_EUML_FUNCTION(Copy_ , std::copy , copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(CopyBackward_ , std::copy_backward , copy_backward_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(Reverse_ , std::reverse , reverse_ , void , void )
+BOOST_MSM_EUML_FUNCTION(ReverseCopy_ , std::reverse_copy , reverse_copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(Remove_ , std::remove , remove_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(RemoveIf_ , std::remove_if , remove_if_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(RemoveCopy_ , std::remove_copy , remove_copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(RemoveCopyIf_ , std::remove_copy_if , remove_copy_if_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(Fill_ , std::fill , fill_ , void , void )
+BOOST_MSM_EUML_FUNCTION(Generate_ , std::generate , generate_ , void , void )
+BOOST_MSM_EUML_FUNCTION(Unique_ , std::unique , unique_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(UniqueCopy_ , std::unique_copy , unique_copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(RandomShuffle_ , std::random_shuffle , random_shuffle_ , void , void )
+BOOST_MSM_EUML_FUNCTION(RotateCopy_ , std::rotate_copy , rotate_copy_ , RESULT_TYPE_PARAM4 , RESULT_TYPE2_PARAM4 )
+BOOST_MSM_EUML_FUNCTION(Partition_ , std::partition , partition_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(StablePartition_ , std::stable_partition , stable_partition_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
+BOOST_MSM_EUML_FUNCTION(Sort_ , std::sort , sort_ , void , void )
+BOOST_MSM_EUML_FUNCTION(StableSort_ , std::stable_sort , stable_sort_ , void , void )
+BOOST_MSM_EUML_FUNCTION(PartialSort_ , std::partial_sort , partial_sort_ , void , void )
+BOOST_MSM_EUML_FUNCTION(PartialSortCopy_ , std::partial_sort_copy , partial_sort_copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(NthElement_ , std::nth_element , nth_element_ , void , void )
+BOOST_MSM_EUML_FUNCTION(Merge_ , std::merge , merge_ , RESULT_TYPE_PARAM5 , RESULT_TYPE2_PARAM5 )
+BOOST_MSM_EUML_FUNCTION(InplaceMerge_ , std::inplace_merge , inplace_merge_ , void , void )
+BOOST_MSM_EUML_FUNCTION(SetUnion_ , std::set_union , set_union_ , RESULT_TYPE_PARAM5 , RESULT_TYPE2_PARAM5 )
+BOOST_MSM_EUML_FUNCTION(PushHeap_ , std::push_heap , push_heap_ , void , void )
+BOOST_MSM_EUML_FUNCTION(PopHeap_ , std::pop_heap , pop_heap_ , void , void )
+BOOST_MSM_EUML_FUNCTION(MakeHeap_ , std::make_heap , make_heap_ , void , void )
+BOOST_MSM_EUML_FUNCTION(SortHeap_ , std::sort_heap , sort_heap_ , void , void )
+BOOST_MSM_EUML_FUNCTION(NextPermutation_ , std::next_permutation , next_permutation_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(PrevPermutation_ , std::prev_permutation , prev_permutation_ , bool , bool )
+BOOST_MSM_EUML_FUNCTION(InnerProduct_ , std::inner_product , inner_product_ , RESULT_TYPE_PARAM4 , RESULT_TYPE2_PARAM4 )
+BOOST_MSM_EUML_FUNCTION(PartialSum_ , std::partial_sum , partial_sum_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(AdjacentDifference_ , std::adjacent_difference , adjacent_difference_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(Replace_ , std::replace , replace_ , void , void )
+BOOST_MSM_EUML_FUNCTION(ReplaceIf_ , std::replace_if , replace_if_ , void , void )
+BOOST_MSM_EUML_FUNCTION(ReplaceCopy_ , std::replace_copy , replace_copy_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+BOOST_MSM_EUML_FUNCTION(ReplaceCopyIf_ , std::replace_copy_if , replace_copy_if_ , RESULT_TYPE_PARAM3 , RESULT_TYPE2_PARAM3 )
+
+
+
+template <class T>
+struct BackInserter_ : euml_action<BackInserter_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef std::back_insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type> type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef std::back_insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type> type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return std::back_inserter(T()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return std::back_inserter(T()(evt,fsm,state));
+ }
+};
+
+struct back_inserter_tag {};
+struct BackInserter_Helper: proto::extends< proto::terminal<back_inserter_tag>::type, BackInserter_Helper, sm_domain>
+{
+ BackInserter_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef BackInserter_<Arg1> type;
+ };
+};
+BackInserter_Helper const back_inserter_;
+
+template <class T>
+struct FrontInserter_ : euml_action<FrontInserter_<T> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef std::front_insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type> type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef std::front_insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type> type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return std::front_inserter(T()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return std::front_inserter(T()(evt,fsm,state));
+ }
+};
+
+struct front_inserter_tag {};
+struct FrontInserter_Helper: proto::extends< proto::terminal<front_inserter_tag>::type, FrontInserter_Helper, sm_domain>
+{
+ FrontInserter_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef FrontInserter_<Arg1> type;
+ };
+};
+FrontInserter_Helper const front_inserter_;
+
+template <class T,class Pos>
+struct Inserter_ : euml_action<Inserter_<T,Pos> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef std::insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type2<T,Event,FSM,STATE>::type>::type> type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef std::insert_iterator<
+ typename ::boost::remove_reference<
+ typename get_result_type<T,EVT,FSM,SourceState,TargetState>::type>::type> type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return std::inserter(T()(evt,fsm,src,tgt),Pos()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename T::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return std::inserter(T()(evt,fsm,state),Pos()(evt,fsm,state));
+ }
+};
+
+struct inserter_tag {};
+struct Inserter_Helper: proto::extends< proto::terminal<inserter_tag>::type, Inserter_Helper, sm_domain>
+{
+ Inserter_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Inserter_<Arg1,Arg2> type;
+ };
+};
+Inserter_Helper const inserter_;
+
+template <class Param1, class Param2, class Param3, class Param4, class Param5, class Enable=void >
+struct Transform_ : euml_action<Transform_<Param1,Param2,Param3,Param4,Param5,Enable> >
+{
+};
+
+template <class Param1, class Param2, class Param3, class Param4, class Param5>
+struct Transform_<Param1,Param2,Param3,Param4,Param5,
+ typename ::boost::enable_if<typename ::boost::is_same<Param5,void>::type >::type>
+ : euml_action<Transform_<Param1,Param2,Param3,Param4,Param5> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Param3,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Param3,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Param1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return std::transform(Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt),
+ Param4()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Param1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return std::transform(Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state),
+ Param4()(evt,fsm,state));
+ }
+};
+
+template <class Param1, class Param2, class Param3, class Param4, class Param5>
+struct Transform_<Param1,Param2,Param3,Param4,Param5,
+ typename ::boost::disable_if<typename ::boost::is_same<Param5,void>::type >::type>
+ : euml_action<Transform_<Param1,Param2,Param3,Param4,Param5> >
+{
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef typename get_result_type2<Param4,Event,FSM,STATE>::type type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef typename get_result_type<Param4,EVT,FSM,SourceState,TargetState>::type type;
+ };
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Param1::tag_type,action_tag>::type,
+ typename transition_action_result<EVT,FSM,SourceState,TargetState>::type >::type
+ operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
+ {
+ return std::transform (Param1()(evt,fsm,src,tgt),Param2()(evt,fsm,src,tgt),Param3()(evt,fsm,src,tgt),
+ Param4()(evt,fsm,src,tgt),Param5()(evt,fsm,src,tgt));
+ }
+ template <class Event,class FSM,class STATE>
+ typename ::boost::enable_if<
+ typename ::boost::mpl::has_key<
+ typename Param1::tag_type,state_action_tag>::type,
+ typename state_action_result<Event,FSM,STATE>::type >::type
+ operator()(Event const& evt,FSM& fsm,STATE& state )const
+ {
+ return std::transform (Param1()(evt,fsm,state),Param2()(evt,fsm,state),Param3()(evt,fsm,state),
+ Param4()(evt,fsm,state),Param5()(evt,fsm,state));
+ }
+};
+struct transform_tag {};
+struct Transform_Helper: proto::extends< proto::terminal<transform_tag>::type, Transform_Helper, sm_domain>
+{
+ Transform_Helper(){}
+ template <class Arg1,class Arg2,class Arg3,class Arg4,class Arg5
+#ifdef BOOST_MSVC
+ ,class Arg6
+#endif
+>
+ struct In
+ {
+ typedef Transform_<Arg1,Arg2,Arg3,Arg4,Arg5> type;
+ };
+};
+Transform_Helper const transform_;
+
+}}}}
+
+#endif //BOOST_MSM_FRONT_EUML_TRANSFORMATION_H

Added: branches/msm/msm_phoenix/boost/msm/front/functor_row.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/functor_row.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,341 @@
+// 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_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>
+#include <boost/mpl/has_xxx.hpp>
+
+#include <boost/typeof/typeof.hpp>
+
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/common.hpp>
+#include <boost/msm/front/completion_event.hpp>
+
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(deferring_action)
+
+namespace boost { namespace msm { namespace front
+{
+ template <class Func,class Enable=void>
+ struct get_functor_return_value
+ {
+ static const ::boost::msm::back::HandledEnum value = ::boost::msm::back::HANDLED_TRUE;
+ };
+ template <class Func>
+ struct get_functor_return_value<Func,
+ typename ::boost::enable_if<
+ typename has_deferring_action<Func>::type
+ >::type
+ >
+ {
+ static const ::boost::msm::back::HandledEnum value = ::boost::msm::back::HANDLED_DEFERRED;
+ };
+
+ template <class SOURCE,class EVENT,class TARGET,class ACTION=none,class GUARD=none>
+ struct Row
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef TARGET Target;
+ typedef ACTION Action;
+ typedef GUARD Guard;
+ // action plus guard
+ typedef row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt,AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+
+ template<class SOURCE,class EVENT,class TARGET>
+ struct Row<SOURCE,EVENT,TARGET,none,none>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef TARGET Target;
+ typedef none Action;
+ typedef none Guard;
+ // no action, no guard
+ typedef _row_tag row_type_tag;
+ };
+ template<class SOURCE,class EVENT,class TARGET,class ACTION>
+ struct Row<SOURCE,EVENT,TARGET,ACTION,none>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef TARGET Target;
+ typedef ACTION Action;
+ typedef none Guard;
+ // no guard
+ typedef a_row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ };
+ template<class SOURCE,class EVENT,class TARGET,class GUARD>
+ struct Row<SOURCE,EVENT,TARGET,none,GUARD>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef TARGET Target;
+ typedef none Action;
+ typedef GUARD Guard;
+ // no action
+ typedef g_row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+ // internal transitions
+ template<class SOURCE,class EVENT,class ACTION>
+ struct Row<SOURCE,EVENT,none,ACTION,none>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef ACTION Action;
+ typedef none Guard;
+ // no guard
+ typedef a_irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ };
+ template<class SOURCE,class EVENT,class GUARD>
+ struct Row<SOURCE,EVENT,none,none,GUARD>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef none Action;
+ typedef GUARD Guard;
+ // no action
+ typedef g_irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+ template<class SOURCE,class EVENT,class ACTION,class GUARD>
+ struct Row<SOURCE,EVENT,none,ACTION,GUARD>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef ACTION Action;
+ typedef GUARD Guard;
+ // action + guard
+ typedef irow_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+ template<class SOURCE,class EVENT>
+ struct Row<SOURCE,EVENT,none,none,none>
+ {
+ typedef SOURCE Source;
+ typedef EVENT Evt;
+ typedef Source Target;
+ typedef none Action;
+ typedef none Guard;
+ // no action, no guard
+ typedef _irow_tag row_type_tag;
+ };
+ template<class TGT>
+ struct get_row_target
+ {
+ typedef typename TGT::Target type;
+ };
+
+ template <class EVENT,class ACTION=none,class GUARD=none>
+ struct Internal
+ {
+ typedef EVENT Evt;
+ typedef ACTION Action;
+ typedef GUARD Guard;
+ // action plus guard
+ typedef sm_i_row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+
+ template<class EVENT,class ACTION>
+ struct Internal<EVENT,ACTION,none>
+ {
+ typedef EVENT Evt;
+ typedef ACTION Action;
+ typedef none Guard;
+ // no guard
+ typedef sm_a_i_row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ Action()(evt,fsm,src,tgt);
+ return get_functor_return_value<Action>::value;
+ }
+ };
+ template<class EVENT,class GUARD>
+ struct Internal<EVENT,none,GUARD>
+ {
+ typedef EVENT Evt;
+ typedef none Action;
+ typedef GUARD Guard;
+ // no action
+ typedef sm_g_i_row_tag row_type_tag;
+ template <class EVT,class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,EVT const& evt,SourceState& src,TargetState& tgt, AllStates&)
+ {
+ // create functor, call it
+ return Guard()(evt,fsm,src,tgt);
+ }
+ };
+ template<class EVENT>
+ struct Internal<EVENT,none,none>
+ {
+ typedef EVENT Evt;
+ typedef none Action;
+ typedef none Guard;
+ // no action, no guard
+ typedef sm__i_row_tag row_type_tag;
+ };
+ struct state_tag{};
+ struct event_tag{};
+ struct action_tag{};
+ struct state_action_tag{};
+ struct flag_tag{};
+ struct config_tag{};
+ struct not_euml_tag{};
+
+ template <class Sequence>
+ struct ActionSequence_
+ {
+ typedef Sequence sequence;
+ template <class Event,class FSM,class STATE >
+ struct state_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class STATE>
+ struct Call
+ {
+ Call(EVT const& evt,FSM& fsm,STATE& state):
+ evt_(evt),fsm_(fsm),state_(state){}
+ template <class FCT>
+ void operator()(::boost::msm::wrap<FCT> const& )
+ {
+ FCT()(evt_,fsm_,state_);
+ }
+ private:
+ EVT const& evt_;
+ FSM& fsm_;
+ STATE& state_;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct transition_action_result
+ {
+ typedef void type;
+ };
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ struct Call2
+ {
+ 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::wrap<FCT> const& )
+ {
+ FCT()(evt_,fsm_,src_,tgt_);
+ }
+ private:
+ EVT const & evt_;
+ FSM& fsm_;
+ SourceState& src_;
+ TargetState& tgt_;
+ };
+
+ typedef ::boost::mpl::set<state_action_tag,action_tag> tag_type;
+
+ template <class EVT,class FSM,class STATE>
+ void operator()(EVT const& evt,FSM& fsm,STATE& state)
+ {
+ 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::wrap< ::boost::mpl::placeholders::_1> >
+ (Call2<EVT,FSM,SourceState,TargetState>(evt,fsm,src,tgt));
+ }
+ };
+
+ // functor pre-defined for basic functionality
+ struct Defer
+ {
+ // mark as deferring to avoid stack overflows in certain conditions
+ typedef int deferring_action;
+ template <class EVT,class FSM,class SourceState,class TargetState>
+ void operator()(EVT const& evt,FSM& fsm,SourceState& ,TargetState& ) const
+ {
+ fsm.defer_event(evt);
+ }
+ };
+}}}
+#endif //BOOST_MSM_FRONT_FUNCTOR_ROW_H

Added: branches/msm/msm_phoenix/boost/msm/front/internal_row.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/internal_row.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,105 @@
+// 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_INTERNAL_ROW_HPP
+#define BOOST_MSM_INTERNAL_ROW_HPP
+
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/front/detail/row2_helper.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+ template<
+ class Event
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ >
+ struct a_internal
+ {
+ typedef sm_a_i_row_tag row_type_tag;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ };
+
+ template<
+ class Event
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct internal
+ {
+ typedef sm_i_row_tag row_type_tag;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+ template<
+ class Event
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct g_internal
+ {
+ typedef sm_g_i_row_tag row_type_tag;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+ template<
+ class Event
+ >
+ struct _internal
+ {
+ typedef sm__i_row_tag row_type_tag;
+ typedef Event Evt;
+ };
+}}}
+
+#endif //BOOST_MSM_INTERNAL_ROW_HPP
+

Added: branches/msm/msm_phoenix/boost/msm/front/row2.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/row2.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,204 @@
+// 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_ROW2_HPP
+#define BOOST_MSM_ROW2_HPP
+
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/front/detail/row2_helper.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ >
+ struct _row2
+ {
+ typedef _row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ };
+
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ >
+ struct a_row2
+ {
+ typedef a_row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::template call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ };
+
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct row2
+ {
+ typedef row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState, class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct g_row2
+ {
+ typedef g_row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+ // internal transitions
+ template<
+ typename T1
+ , class Event
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ >
+ struct a_irow2
+ {
+ typedef a_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ };
+
+ template<
+ typename T1
+ , class Event
+ , typename CalledForAction
+ , void (CalledForAction::*action)(Event const&)
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct irow2
+ {
+ typedef irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ ::boost::msm::front::detail::row2_action_helper<CalledForAction,Event,action>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForAction,FSM>::type::value>());
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+ template<
+ typename T1
+ , class Event
+ , typename CalledForGuard
+ , bool (CalledForGuard::*guard)(Event const&)
+ >
+ struct g_irow2
+ {
+ typedef g_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState& src,TargetState& tgt,
+ AllStates& all_states)
+ {
+ // in this front-end, we don't need to know source and target states
+ return ::boost::msm::front::detail::row2_guard_helper<CalledForGuard,Event,guard>::call_helper
+ (fsm,evt,src,tgt,all_states,
+ ::boost::mpl::bool_< ::boost::is_base_of<CalledForGuard,FSM>::type::value>());
+ }
+ };
+
+}}}
+
+#endif //BOOST_MSM_ROW2_HPP
+

Added: branches/msm/msm_phoenix/boost/msm/front/state_machine_def.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/state_machine_def.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,217 @@
+// 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_FRONT_STATEMACHINE_DEF_H
+#define BOOST_MSM_FRONT_STATEMACHINE_DEF_H
+
+#include <exception>
+#include <boost/assert.hpp>
+
+#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
+
+#include <boost/mpl/vector.hpp>
+
+#include <boost/msm/row_tags.hpp>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/front/states.hpp>
+#include <boost/msm/front/completion_event.hpp>
+#include <boost/msm/front/common_states.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+
+template<class Derived,class BaseState = default_base_state>
+struct state_machine_def : public boost::msm::front::detail::state_base<BaseState>
+{
+ // tags
+ // default: no flag
+ typedef ::boost::mpl::vector0<> flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+ // customization (message queue, exceptions)
+ typedef ::boost::mpl::vector0<> configuration;
+
+ typedef BaseState BaseAllStates;
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , void (Derived::*action)(Event const&)
+ >
+ struct a_row
+ {
+ typedef a_row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&, AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ };
+
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ >
+ struct _row
+ {
+ typedef _row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ };
+
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , void (Derived::*action)(Event const&)
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct row
+ {
+ typedef row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState, class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ template<
+ typename T1
+ , class Event
+ , typename T2
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct g_row
+ {
+ typedef g_row_tag row_type_tag;
+ typedef T1 Source;
+ typedef T2 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ // internal transitions
+ template<
+ typename T1
+ , class Event
+ , void (Derived::*action)(Event const&)
+ >
+ struct a_irow
+ {
+ typedef a_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ };
+
+ template<
+ typename T1
+ , class Event
+ , void (Derived::*action)(Event const&)
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct irow
+ {
+ typedef irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static ::boost::msm::back::HandledEnum action_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ (fsm.*action)(evt);
+ return ::boost::msm::back::HANDLED_TRUE;
+ }
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ template<
+ typename T1
+ , class Event
+ , bool (Derived::*guard)(Event const&)
+ >
+ struct g_irow
+ {
+ typedef g_irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ template <class FSM,class SourceState,class TargetState,class AllStates>
+ static bool guard_call(FSM& fsm,Event const& evt,SourceState&,TargetState&,AllStates&)
+ {
+ // in this front-end, we don't need to know source and target states
+ return (fsm.*guard)(evt);
+ }
+ };
+ // internal row withou action or guard. Does nothing except forcing the event to be ignored.
+ template<
+ typename T1
+ , class Event
+ >
+ struct _irow
+ {
+ typedef _irow_tag row_type_tag;
+ typedef T1 Source;
+ typedef T1 Target;
+ typedef Event Evt;
+ };
+protected:
+ // Default no-transition handler. Can be replaced in the Derived SM class.
+ template <class FSM,class Event>
+ void no_transition(Event const& ,FSM&, int state)
+ {
+ BOOST_ASSERT(false);
+ }
+ // default exception handler. Can be replaced in the Derived SM class.
+ template <class FSM,class Event>
+ void exception_caught (Event const&,FSM&,std::exception& )
+ {
+ BOOST_ASSERT(false);
+ }
+};
+
+
+} } }// boost::msm::front
+#endif //BOOST_MSM_FRONT_STATEMACHINE_DEF_H
+

Added: branches/msm/msm_phoenix/boost/msm/front/states.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/front/states.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,128 @@
+// 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_FRONT_STATES_H
+#define BOOST_MSM_FRONT_STATES_H
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/msm/front/common_states.hpp>
+#include <boost/msm/row_tags.hpp>
+
+namespace boost { namespace msm { namespace front
+{
+
+struct no_sm_ptr
+{
+ // tags
+ typedef ::boost::mpl::bool_<false> needs_sm;
+};
+struct sm_ptr
+{
+ // tags
+ typedef ::boost::mpl::bool_<true> needs_sm;
+};
+// kept for backward compatibility
+struct NoSMPtr
+{
+ // tags
+ typedef ::boost::mpl::bool_<false> needs_sm;
+};
+struct SMPtr
+{
+ // tags
+ typedef ::boost::mpl::bool_<true> needs_sm;
+};
+
+// provides the typedefs and interface. Concrete states derive from it.
+// template argument: pointer-to-fsm policy
+template<class BASE = default_base_state,class SMPtrPolicy = no_sm_ptr>
+struct state : public boost::msm::front::detail::state_base<BASE>, SMPtrPolicy
+{
+ // tags
+ // default: no flag
+ typedef ::boost::mpl::vector0<> flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+};
+
+// terminate state simply defines the TerminateFlag flag
+// template argument: pointer-to-fsm policy
+template<class BASE = default_base_state,class SMPtrPolicy = no_sm_ptr>
+struct terminate_state : public boost::msm::front::detail::state_base<BASE>, SMPtrPolicy
+{
+ // tags
+ typedef ::boost::mpl::vector<boost::msm::TerminateFlag> flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+};
+
+// terminate state simply defines the InterruptedFlag and EndInterruptFlag<EndInterruptEvent> flags
+// template argument: event which ends the interrupt
+// template argument: pointer-to-fsm policy
+template <class EndInterruptEvent,class BASE = default_base_state,class SMPtrPolicy = no_sm_ptr>
+struct interrupt_state : public boost::msm::front::detail::state_base<BASE>, SMPtrPolicy
+{
+ // tags
+ typedef ::boost::mpl::vector<boost::msm::InterruptedFlag,
+ boost::msm::EndInterruptFlag<EndInterruptEvent> >
+ flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+};
+
+// not a state but a bunch of extra typedefs to handle direct entry into a composite state. To be derived from
+// template argument: zone index of this state
+template <int ZoneIndex=-1>
+struct explicit_entry
+{
+ typedef int explicit_entry_state;
+ enum {zone_index=ZoneIndex};
+};
+
+// to be derived from. Makes a type an entry (pseudo) state. Actually an almost full-fledged state
+// template argument: containing composite
+// template argument: zone index of this state
+// template argument: pointer-to-fsm policy
+template<int ZoneIndex=-1,class BASE = default_base_state,class SMPtrPolicy = no_sm_ptr>
+struct entry_pseudo_state
+ : public boost::msm::front::detail::state_base<BASE>,SMPtrPolicy
+{
+ // tags
+ typedef int pseudo_entry;
+ enum {zone_index=ZoneIndex};
+ typedef int explicit_entry_state;
+ // default: no flag
+ typedef ::boost::mpl::vector0<> flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+};
+
+// to be derived from. Makes a state an exit (pseudo) state. Actually an almost full-fledged state
+// template argument: event to forward
+// template argument: pointer-to-fsm policy
+template<class Event,class BASE = default_base_state,class SMPtrPolicy = no_sm_ptr>
+struct exit_pseudo_state : public boost::msm::front::detail::state_base<BASE> , SMPtrPolicy
+{
+ typedef Event event;
+ typedef BASE Base;
+ typedef SMPtrPolicy PtrPolicy;
+ typedef int pseudo_exit;
+
+ // default: no flag
+ typedef ::boost::mpl::vector< > flag_list;
+ //default: no deferred events
+ typedef ::boost::mpl::vector0<> deferred_events;
+};
+
+}}}
+
+#endif //BOOST_MSM_FRONT_STATES_H
+

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/adjacency_list_graph.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/adjacency_list_graph.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,35 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_ADJACENCY_LIST_GRAPH_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_ADJACENCY_LIST_GRAPH_HPP_INCLUDED
+
+// graph implementation based on an adjacency list
+// sequence< pair< source_vertex, sequence< pair<edge, target_vertex> > > >
+
+// adjacency_list_graph labels such a sequence as manipulable by the metafunctions
+// in the corresponding implementation header detail/adjacency_list_graph.ipp
+// to produce the metadata structures needed by mpl_graph.hpp
+
+// the public interface
+#include <boost/msm/mpl_graph/mpl_graph.hpp>
+
+// the implementation
+#include <boost/msm/mpl_graph/detail/adjacency_list_graph.ipp>
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+template<typename AdjacencyList>
+struct adjacency_list_graph {
+ typedef detail::adjacency_list_tag representation;
+ typedef AdjacencyList data;
+};
+
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_ADJACENCY_LIST_GRAPH_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/breadth_first_search.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/breadth_first_search.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,167 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_BREADTH_FIRST_SEARCH_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_BREADTH_FIRST_SEARCH_HPP_INCLUDED
+
+#include <boost/msm/mpl_graph/mpl_graph.hpp>
+
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/empty.hpp>
+#include <boost/mpl/remove.hpp>
+
+#include "search_colors.hpp"
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+// bfs takes a visitor which has all the bgl-like metafunctions encapsulated in an
+// "operations" member class, and also a state. the operations are expected to return a new state
+struct bfs_default_visitor_operations {
+ template<typename Vertex, typename Graph, typename State>
+ struct initialize_vertex {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct discover_vertex {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct examine_vertex {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct examine_edge {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct tree_edge {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct non_tree_edge {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct gray_target {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct black_target {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct finish_vertex {
+ typedef State type;
+ };
+};
+
+namespace detail {
+
+template<typename Graph, typename VisitorOps, typename VCQState, typename Edge>
+struct bfs_run_queue_examine_edge {
+ typedef typename VisitorOps::template examine_edge<Edge, Graph, typename mpl::at_c<VCQState, 0>::type>::type visitor_state;
+ typedef typename mpl::at_c<VCQState, 1>::type color_state;
+ typedef typename mpl::at_c<VCQState, 2>::type vertex_queue;
+
+ typedef typename mpl::if_<typename boost::is_same<typename search_color_map_ops::template get_color<typename mpl_graph::target<Edge, Graph>::type, color_state>::type, search_colors::White>::type,
+ // unseen target: tree edge, discover target, paint it gray, and enqueue
+ mpl::vector<typename VisitorOps::template discover_vertex<typename mpl_graph::target<Edge, Graph>::type, Graph,
+ typename VisitorOps::template tree_edge<Edge, Graph, visitor_state>::type>::type,
+ typename search_color_map_ops::template set_color<typename mpl_graph::target<Edge, Graph>::type, search_colors::Gray, color_state>::type,
+ typename mpl::push_back<vertex_queue, typename mpl_graph::target<Edge, Graph>::type >::type >,
+ // seen
+ mpl::vector<typename mpl::if_<typename boost::is_same<typename search_color_map_ops::template get_color<mpl_graph::target<Edge, Graph>, color_state>,
+ search_colors::Gray>::type,
+ typename VisitorOps::template gray_target<Edge, Graph, visitor_state>::type,
+ typename VisitorOps::template black_target<Edge, Graph, visitor_state>::type>::type,
+ color_state,
+ vertex_queue>
+ >::type type;
+};
+
+// runs bfs on a queue, passing the new queue forward on recursion
+// returns pair<visitor_state, color_state>
+template<typename Graph, typename VertexQueue, typename VisitorOps, typename VisitorState, typename ColorMap>
+struct bfs_run_queue {
+ // enter vertex
+ typedef typename mpl::front<VertexQueue>::type Vertex;
+ typedef typename mpl::pop_front<VertexQueue>::type Tail;
+ typedef typename VisitorOps::template examine_vertex<Vertex, Graph, VisitorState>::type examined_state;
+
+ // loop over out edges
+ typedef typename mpl::template
+ fold<typename mpl_graph::out_edges<Vertex, Graph>::type,
+ mpl::vector<examined_state, ColorMap, Tail>,
+ bfs_run_queue_examine_edge<Graph, VisitorOps, mpl::_1, mpl::_2>
+ >::type did_edges;
+
+ typedef typename VisitorOps::template
+ finish_vertex<Vertex, Graph, typename mpl::at_c<did_edges, 0>::type>::type
+ finished_vertex;
+ // does map insert always overwrite? i seem to remember this not working on msvc once
+ typedef typename search_color_map_ops::template
+ set_color<Vertex, search_colors::Black, typename mpl::at_c<did_edges, 1>::type>::type
+ colored_vertex;
+ typedef typename mpl::at_c<did_edges, 2>::type queued_targets;
+
+ typedef typename
+ mpl::if_<typename mpl::empty<queued_targets>::type,
+ mpl::pair<finished_vertex, colored_vertex>,
+ bfs_run_queue<Graph, queued_targets,
+ VisitorOps, finished_vertex,
+ colored_vertex> >::type::type type;
+};
+
+} // namespace detail
+
+template<typename Graph, typename VisitorOps, typename VisitorState,
+ typename Vertex,
+ typename ColorMap = create_search_color_map::type >
+struct breadth_first_search {
+ typedef typename VisitorOps::template
+ discover_vertex<Vertex, Graph, VisitorState>::type
+ discovered_state;
+ typedef typename search_color_map_ops::template
+ set_color<Vertex, search_colors::Gray, ColorMap>::type
+ discovered_colors;
+ typedef typename detail::
+ bfs_run_queue<Graph, mpl::vector<Vertex>,
+ VisitorOps, discovered_state,
+ discovered_colors>::type type;
+};
+
+template<typename Graph, typename VisitorOps, typename VisitorState,
+ typename FirstVertex = typename mpl::front<typename mpl_graph::vertices<Graph>::type>::type,
+ typename ColorMap = create_search_color_map::type>
+struct breadth_first_search_all : // visit "first" first, then visit any still white
+ mpl::fold<typename mpl_graph::vertices<Graph>::type,
+ typename breadth_first_search<Graph, VisitorOps, VisitorState, FirstVertex, ColorMap>::type,
+ mpl::if_<boost::is_same<search_color_map_ops::template get_color<mpl::_2, mpl::second<mpl::_1> >,
+ search_colors::White>,
+ breadth_first_search<Graph, VisitorOps, mpl::first<mpl::_1>,
+ mpl::_2, mpl::second<mpl::_1> >,
+ mpl::_1> >
+{};
+
+} // namespace mpl_graph
+} // namespace msm
+} // namespace boost
+
+
+#endif // BOOST_MSM_MPL_GRAPH_BREADTH_FIRST_SEARCH_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/depth_first_search.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/depth_first_search.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,122 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_DEPTH_FIRST_SEARCH_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_DEPTH_FIRST_SEARCH_HPP_INCLUDED
+
+#include <boost/msm/mpl_graph/mpl_graph.hpp>
+
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/has_key.hpp>
+
+#include "search_colors.hpp"
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+// dfs takes a visitor which has all the bgl-like metafunctions encapsulated in an
+// "operations" member class, and also a state. the operations are expected to return a new state
+// in addition, the visitor operations are expected to update the colors of vertices
+// and need to support a new metafunction get_color<Vertex, State>
+
+struct dfs_default_visitor_operations {
+ template<typename Vertex, typename Graph, typename State>
+ struct initialize_vertex {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct discover_vertex {
+ typedef State type;
+ };
+
+ template<typename Vertex, typename Graph, typename State>
+ struct finish_vertex {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct tree_edge {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct back_edge {
+ typedef State type;
+ };
+
+ template<typename Edge, typename Graph, typename State>
+ struct forward_or_cross_edge {
+ typedef State type;
+ };
+};
+
+// requires IncidenceGraph
+// returns pair<VisitorState, ColorState>
+template<typename Graph, typename VisitorOps, typename VisitorState,
+ typename Vertex,
+ typename ColorState = create_search_color_map::type >
+struct depth_first_search {
+ // enter vertex
+ typedef typename VisitorOps::template
+ discover_vertex<Vertex, Graph, VisitorState>::type
+ discovered_state;
+ typedef typename search_color_map_ops::template
+ set_color<Vertex, search_colors::Gray, ColorState>::type
+ discovered_colors;
+
+ // loop over out edges
+ typedef typename
+ mpl::fold<typename mpl_graph::out_edges<Vertex, Graph>::type,
+ mpl::pair<discovered_state, discovered_colors>,
+ mpl::if_<boost::is_same<search_color_map_ops::get_color<mpl_graph::target<mpl::_2, Graph>, mpl::second<mpl::_1> >,
+ search_colors::White>,
+ // unseen target: recurse
+ depth_first_search<Graph,
+ VisitorOps, typename VisitorOps::template tree_edge<mpl::_2, Graph, mpl::first<mpl::_1> >,
+ mpl_graph::target<mpl::_2, Graph>,
+ mpl::second<mpl::_1> >,
+ // seen: back or forward edge
+ mpl::pair<mpl::if_<boost::is_same<typename search_color_map_ops::template
+ get_color<mpl_graph::target<mpl::_2, Graph>, mpl::second<mpl::_1 > >,
+ search_colors::Gray>,
+ typename VisitorOps::template back_edge<mpl::_2, Graph, mpl::first<mpl::_1> >,
+ typename VisitorOps::template forward_or_cross_edge<mpl::_2, Graph, mpl::first<mpl::_1> > >, // Black
+ mpl::second<mpl::_1> > >
+ >::type after_outedges;
+
+ // leave vertex, and done!
+ typedef mpl::pair<typename VisitorOps::template finish_vertex<Vertex, Graph, typename mpl::first<after_outedges>::type >::type,
+ typename search_color_map_ops::template set_color<Vertex, search_colors::Black, typename mpl::second<after_outedges>::type>::type> type;
+};
+
+// requires IncidenceGraph, VertexListGraph
+template<typename Graph, typename VisitorOps, typename VisitorState,
+ typename FirstVertex = typename mpl::front<typename mpl_graph::vertices<Graph>::type>::type,
+ typename ColorState = create_search_color_map::type>
+struct depth_first_search_all : // visit first then rest
+ mpl::fold<typename mpl_graph::vertices<Graph>::type,
+ typename depth_first_search<Graph,
+ VisitorOps, VisitorState,
+ FirstVertex,
+ ColorState>::type,
+ mpl::if_<boost::is_same<search_color_map_ops::get_color<mpl::_2, mpl::second<mpl::_1> >,
+ search_colors::White>, // visit any yet unvisited
+ depth_first_search<Graph,
+ VisitorOps, mpl::first<mpl::_1>,
+ mpl::_2,
+ mpl::second<mpl::_1> >,
+ mpl::_1> >
+{};
+
+} // namespace mpl_graph
+} // namespace msm
+} // namespace boost
+
+
+#endif // BOOST_MSM_MPL_GRAPH_DEPTH_FIRST_SEARCH_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,128 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
+
+// implementation of a graph declared in adjacency list format
+// sequence< pair< source_vertex, sequence< pair<edge, target_vertex> > > >
+
+#include <boost/msm/mpl_graph/mpl_utils.hpp>
+#include <boost/msm/mpl_graph/detail/incidence_list_graph.ipp>
+
+#include <boost/mpl/copy.hpp>
+#include <boost/mpl/inserter.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/push_back.hpp>
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+namespace detail {
+
+// tag identifying graph implementation as adjacency list (not defined)
+struct adjacency_list_tag;
+
+// outs map is really just the same data with the sequences turned into maps
+// it might make sense to make another adjacency_map implementation for that case
+template<typename AdjacencyList>
+struct produce_al_outs_map :
+ mpl::reverse_fold<AdjacencyList,
+ mpl::map<>,
+ mpl::insert<mpl::_1,
+ mpl::pair<mpl::first<mpl::_2>, mpl_utils::as_map<mpl::second<mpl::_2> > > > >
+{};
+
+// Edge->Target map for a Source for out_*, degree
+template<typename Source, typename GraphData>
+struct produce_out_map<adjacency_list_tag, Source, GraphData> :
+ mpl::at<typename produce_al_outs_map<GraphData>::type, Source>
+{};
+
+template<typename InsMap, typename Source, typename Adjacencies>
+struct produce_in_adjacencies :
+ mpl::reverse_fold<Adjacencies,
+ InsMap,
+ mpl::insert<mpl::_1,
+ mpl::pair<mpl::second<mpl::_2>,
+ mpl::insert<mpl_utils::at_or_default<mpl::_1, mpl::second<mpl::_2>, mpl::map<> >,
+ mpl::pair<mpl::first<mpl::_2>, Source> > > > >
+{};
+
+template<typename AdjacencyList>
+struct produce_al_ins_map :
+ mpl::reverse_fold<AdjacencyList,
+ mpl::map<>,
+ produce_in_adjacencies<mpl::_1, mpl::first<mpl::_2>, mpl::second<mpl::_2> > >
+{};
+
+// Edge->Source map for a Target for in_*, degree
+template<typename Target, typename GraphData>
+struct produce_in_map<adjacency_list_tag, Target, GraphData> :
+ mpl::at<typename produce_al_ins_map<GraphData>::type, Target>
+{};
+
+// for everything else to do with edges,
+// just produce an incidence list and forward to that graph implementation
+// (produce_out_map could, and produce_in_map probably should, be implemented this way too)
+template<typename Incidences, typename Source, typename Adjacencies>
+struct produce_adjacencies_incidences : // adjacencies'
+ mpl::reverse_fold<Adjacencies,
+ Incidences,
+ mpl::push_back<mpl::_1,
+ mpl::vector3<mpl::first<mpl::_2>, Source, mpl::second<mpl::_2> > > >
+{};
+
+template<typename AdjacencyList>
+struct produce_incidence_list_from_adjacency_list :
+ mpl::reverse_fold<AdjacencyList,
+ mpl::vector<>,
+ produce_adjacencies_incidences<mpl::_1, mpl::first<mpl::_2>, mpl::second<mpl::_2> > >
+{};
+
+
+// Edge->pair<Source,Target> map for source, target
+template<typename GraphData>
+struct produce_edge_st_map<adjacency_list_tag, GraphData> :
+ produce_edge_st_map<incidence_list_tag,
+ typename produce_incidence_list_from_adjacency_list<GraphData>::type>
+{};
+
+
+// adjacency list supports zero-degree vertices, which incidence list does not
+template<typename VertexSet, typename Adjacencies>
+struct insert_adjacencies_targets : // adjacencies'
+ mpl::reverse_fold<Adjacencies,
+ VertexSet,
+ mpl::insert<mpl::_1, mpl::second<mpl::_2> > >
+{};
+
+template<typename GraphData>
+struct produce_vertex_set<adjacency_list_tag, GraphData> :
+ mpl::reverse_fold<GraphData,
+ mpl::set<>,
+ insert_adjacencies_targets<mpl::insert<mpl::_1, mpl::first<mpl::_2> >,
+ mpl::second<mpl::_2> > >
+{};
+
+
+// Edge set for EdgeListGraph
+template<typename GraphData>
+struct produce_edge_set<adjacency_list_tag, GraphData> :
+ produce_edge_set<incidence_list_tag,
+ typename produce_incidence_list_from_adjacency_list<GraphData>::type>
+{};
+
+
+} // namespaces
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
+

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/as_mpl_map.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/as_mpl_map.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,100 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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)
+
+// this is an experiment at implementing a metafunction that's
+// present in fusion but not in mpl
+// based on fusion/container/map/detail/as_map.hpp
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+
+ 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_PP_IS_ITERATING
+#if !defined(AS_MPL_MAP_HPP)
+#define AS_MPL_MAP_HPP
+
+#define AS_MPL_MAP_SIZE 20
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/inc.hpp>
+#include <boost/preprocessor/dec.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/next.hpp>
+
+namespace boost { namespace mpl {
+
+ namespace detail {
+ template <int size>
+ struct as_map;
+
+ }
+ template<typename Seq>
+ struct as_map : detail::as_map<mpl::size<Seq>::value>::template
+ apply<typename mpl::begin<Seq>::type> {};
+
+ namespace detail
+{
+ template <int size>
+ struct as_map;
+
+ template <>
+ struct as_map<0>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef map<> type;
+ };
+
+ };
+
+#define BOOST_AS_MPL_MAP_NEXT_ITERATOR(z, n, data) \
+ typedef typename mpl::next<BOOST_PP_CAT(I, n)>::type \
+ BOOST_PP_CAT(I, BOOST_PP_INC(n));
+
+#define BOOST_AS_MPL_MAP_DEREF_ITERATOR(z, n, data) \
+ typedef typename mpl::deref<BOOST_PP_CAT(I, n)>::type \
+ BOOST_PP_CAT(T, n);
+
+#define BOOST_PP_FILENAME_1 <boost/msm/mpl_graph/detail/as_mpl_map.hpp>
+#define BOOST_PP_ITERATION_LIMITS (1, AS_MPL_MAP_SIZE)
+#include BOOST_PP_ITERATE()
+
+#undef BOOST_AS_MPL_MAP_NEXT_ITERATOR
+#undef BOOST_AS_MPL_MAP_DEREF_ITERATOR
+
+}}}
+
+#endif
+#else // defined(BOOST_PP_IS_ITERATING)
+///////////////////////////////////////////////////////////////////////////////
+//
+// Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#define N BOOST_PP_ITERATION()
+
+ template <>
+ struct as_map<N>
+ {
+ template <typename I0>
+ struct apply
+ {
+ BOOST_PP_REPEAT(N, BOOST_AS_MPL_MAP_NEXT_ITERATOR, _)
+ BOOST_PP_REPEAT(N, BOOST_AS_MPL_MAP_DEREF_ITERATOR, _)
+ typedef map<BOOST_PP_ENUM_PARAMS(N, T)> type;
+ };
+
+ };
+
+#undef N
+#endif // defined(BOOST_PP_IS_ITERATING)
+

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,42 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
+
+// forward definitions of the producer metafunctions that need to be specialized for
+// each graph representation
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+namespace detail {
+
+ // Edge->Target map for a Source for out_*, degree
+ template<typename RepresentationTag, typename Source, typename GraphData>
+ struct produce_out_map;
+
+ // Edge->Source map for a Target for in_*, degree
+ template<typename RepresentationTag, typename Target, typename GraphData>
+ struct produce_in_map;
+
+ // Edge->pair<Source,Target> map for source, target
+ template<typename RepresentationTag, typename GraphData>
+ struct produce_edge_st_map;
+
+ // Vertex set for VertexListGraph
+ template<typename RepresentationTag, typename GraphData>
+ struct produce_vertex_set;
+
+ // Edge set for EdgeListGraph
+ template<typename RepresentationTag, typename GraphData>
+ struct produce_edge_set;
+
+} // namespaces
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
+

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/incidence_list_graph.ipp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/detail/incidence_list_graph.ipp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,106 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
+
+#define BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
+
+// these metafunctions provide the metadata structures needed by the public interface
+// in mpl_graph.hpp
+
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/copy.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/void.hpp>
+#include <boost/mpl/erase_key.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/inserter.hpp>
+#include <boost/mpl/back_inserter.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/filter_view.hpp>
+#include <boost/mpl/transform_view.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/type_traits.hpp>
+
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+namespace detail {
+
+// tag to identify this graph implementation (not defined)
+struct incidence_list_tag;
+
+// clarifiers
+template<typename EST> struct fetch_edge :
+ mpl::front<EST> {};
+template<typename EST> struct fetch_source :
+ mpl::deref<typename mpl::next<typename mpl::begin<EST>::type>::type> {};
+template<typename EST> struct fetch_target :
+ mpl::back<EST> {};
+
+// Edge->Target map for an Source for out_*, adjacent_vertices
+template<typename Source, typename ESTSequence>
+struct produce_out_map<incidence_list_tag, Source, ESTSequence> :
+ mpl::fold<typename mpl::filter_view<ESTSequence, boost::is_same<fetch_source<mpl::_1>,Source> >::type,
+ mpl::map<>,
+ mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_target<mpl::_2> > > >
+{};
+
+// Edge->Source map for a Target for in_*, degree
+template<typename Target, typename ESTSequence>
+struct produce_in_map<incidence_list_tag, Target, ESTSequence> :
+ mpl::fold<typename mpl::filter_view<ESTSequence,
+ boost::is_same<fetch_target<mpl::_1>,Target> >::type,
+ mpl::map<>,
+ mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_source<mpl::_2> > > >
+
+{};
+// Edge->pair<Source,Target> map for source, target
+template<typename ESTSequence>
+struct produce_edge_st_map<incidence_list_tag, ESTSequence> :
+ mpl::fold<ESTSequence,
+ mpl::map<>,
+ mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,
+ mpl::pair<fetch_source<mpl::_2>,
+ fetch_target<mpl::_2> > > > >
+{};
+// Vertex set for VertexListGraph
+template<typename ESTSequence>
+struct produce_vertex_set<incidence_list_tag, ESTSequence> :
+ mpl::fold<ESTSequence,
+ typename mpl::fold<ESTSequence,
+ mpl::set<>,
+ mpl::insert<mpl::_1,fetch_target<mpl::_2> >
+ >::type,
+ mpl::insert<mpl::_1, fetch_source<mpl::_2> > >
+{};
+// Edge set for EdgeListGraph
+template<typename ESTSequence>
+struct produce_edge_set<incidence_list_tag, ESTSequence> :
+ mpl::fold<ESTSequence,
+ mpl::set<>,
+ mpl::insert<mpl::_1,fetch_edge<mpl::_2> > >
+{};
+}
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/incidence_list_graph.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/incidence_list_graph.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,34 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_INCIDENCE_LIST_GRAPH_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_INCIDENCE_LIST_GRAPH_HPP_INCLUDED
+
+// graph implementation based on a an mpl sequence of sequences <Edge,Source,Target>
+
+// incidence_list_graph labels such a sequence as manipulable by the metafunctions
+// in the corresponding implementation header detail/incidence_list_graph.ipp
+// to produce the metadata structures needed by mpl_graph.hpp
+
+// the public interface
+#include <boost/msm/mpl_graph/mpl_graph.hpp>
+
+// the implementation
+#include <boost/msm/mpl_graph/detail/incidence_list_graph.ipp>
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+template<typename EdgeSequence>
+struct incidence_list_graph {
+ typedef detail::incidence_list_tag representation;
+ typedef EdgeSequence data;
+};
+
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_INCIDENCE_LIST_GRAPH_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_graph.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_graph.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,114 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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)
+
+// mpl_graph - defines a metadata implementation of the BGL immutable graph concepts
+
+// (c) 2008 Gordon Woodhull
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSEmpl::_1_0.txt or copy at
+// http://www.boost.org/LICENSEmpl::_1_0.txt)
+
+#ifndef BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED
+
+#include <boost/msm/mpl_graph/detail/graph_implementation_interface.ipp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/back_inserter.hpp>
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+// Boost Graph concepts, MPL style
+
+// The metafunctions of the public interface rely
+// metafunctions in the graph implementation to transform the input
+// into the maps which are required to deliver results. Since the
+// maps are produced lazily and are memoized, all of the graph
+// concepts can be supported with no cost until they are actually
+// used.
+
+// Each of these dispatch to the correct producer metafunctions based
+// on the representation inner type tag
+
+
+
+// IncidenceGraph
+template<typename Edge, typename Graph>
+struct source :
+ mpl::first<typename mpl::at<typename detail::produce_edge_st_map<typename Graph::representation, typename Graph::data>::type,Edge>::type>
+{};
+template<typename Edge, typename Graph>
+struct target :
+ mpl::second<typename mpl::at<typename detail::produce_edge_st_map<typename Graph::representation, typename Graph::data>::type,Edge>::type>
+{};
+template<typename Vertex, typename Graph>
+struct out_edges :
+ mpl::fold<typename detail::produce_out_map<typename Graph::representation, Vertex, typename Graph::data>::type,
+ mpl::vector<>,
+ mpl::push_back<mpl::_1, mpl::first<mpl::_2> > >
+{};
+template<typename Vertex, typename Graph>
+struct out_degree :
+ mpl::size<typename out_edges<Vertex, Graph>::type>
+{};
+
+// BidirectionalGraph
+template<typename Vertex, typename Graph>
+struct in_edges :
+ mpl::fold<typename detail::produce_in_map<typename Graph::representation, Vertex, typename Graph::data>::type,
+ mpl::vector<>,
+ mpl::push_back<mpl::_1, mpl::first<mpl::_2> > >
+{};
+template<typename Vertex, typename Graph>
+struct in_degree :
+ mpl::size<typename in_edges<Vertex, Graph>::type>
+{};
+template<typename Vertex, typename Graph>
+struct degree :
+ mpl::plus<typename out_degree<Vertex, Graph>::type,typename in_degree<Vertex, Graph>::type>
+{};
+
+// AdjacencyGraph
+template<typename Vertex, typename Graph>
+struct adjacent_vertices :
+ mpl::transform<typename detail::produce_out_map<typename Graph::representation, Vertex, typename Graph::data>::type,
+ mpl::second<mpl::_1>,
+ mpl::back_inserter<mpl::vector<> > >
+{};
+
+// VertexListGraph
+template<typename Graph>
+struct vertices :
+ detail::produce_vertex_set<typename Graph::representation, typename Graph::data>
+{};
+template<typename Graph>
+struct num_vertices :
+ mpl::size<typename vertices<Graph>::type>
+{};
+
+// EdgeListGraph
+template<typename Graph>
+struct edges :
+ detail::produce_edge_set<typename Graph::representation, typename Graph::data>
+{};
+template<typename Graph>
+struct num_edges :
+ mpl::size<typename edges<Graph>::type>
+{};
+// source and target are defined in IncidenceGraph
+
+} // mpl_graph
+} // msm
+} // boost
+
+#endif // BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_utils.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/mpl_utils.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,62 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED
+
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/set.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/has_key.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/and.hpp>
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+namespace mpl_utils {
+
+// This is a grab bag of little metafunctions I expect already
+// exist under some name I haven't looked for
+
+// I figure there are probably better ways to do all of these things,
+// but for now I'll just write some utilities to isolate my ignorance
+
+template<typename Seq>
+struct as_map :
+ mpl::fold<Seq,
+ mpl::map<>,
+ mpl::insert<mpl::_1, mpl::_2> >
+{};
+template<typename Seq>
+struct as_set :
+ mpl::fold<Seq,
+ mpl::set<>,
+ mpl::insert<mpl::_1, mpl::_2> >
+{};
+
+template<typename AssocSeq, typename Key, typename Default>
+struct at_or_default :
+ mpl::if_<typename mpl::has_key<AssocSeq, Key>::type,
+ typename mpl::at<AssocSeq, Key>::type,
+ Default>
+{};
+
+template<typename Seq1, typename Seq2>
+struct set_equal :
+ mpl::fold<Seq2,
+ mpl::true_,
+ mpl::and_<mpl::_1,
+ mpl::has_key<typename as_set<Seq1>::type,
+ mpl::_2 > > >
+{};
+
+}
+}
+}
+}
+
+#endif // BOOST_MSM_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/mpl_graph/search_colors.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/mpl_graph/search_colors.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,39 @@
+// Copyright 2008-2010 Gordon Woodhull
+// 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_MPL_GRAPH_SEARCH_COLORS_HPP_INCLUDED
+#define BOOST_MSM_MPL_GRAPH_SEARCH_COLORS_HPP_INCLUDED
+
+namespace boost {
+namespace msm {
+namespace mpl_graph {
+
+namespace search_colors {
+ struct White {};
+ struct Gray {};
+ struct Black {};
+}
+
+struct create_search_color_map : mpl::map<> {};
+
+struct search_color_map_ops {
+ template<typename Node, typename Color, typename State>
+ struct set_color :
+ mpl::insert<State, mpl::pair<Node, Color> >
+ {};
+ template<typename Node, typename State>
+ struct get_color :
+ mpl::if_<mpl::has_key<State, Node>,
+ mpl::at<State, Node>,
+ search_colors::White>
+ {};
+};
+
+
+} // namespace mpl_graph
+} // namespace msm
+} // namespace boost
+
+
+#endif // BOOST_MSM_MPL_GRAPH_SEARCH_COLORS_HPP_INCLUDED

Added: branches/msm/msm_phoenix/boost/msm/proto_config.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/proto_config.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,34 @@
+// 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_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
+ #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
+ #endif
+ #define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 7
+ #define BOOST_PROTO_MAX_ARITY 7
+ #endif
+#else
+ #if BOOST_PROTO_MAX_ARITY <= 6
+ #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
+ #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY
+ #endif
+ #define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6
+ #define BOOST_PROTO_MAX_ARITY 6
+ #endif
+#endif
+
+#endif //BOOST_MSM_PROTO_CONFIG_H

Added: branches/msm/msm_phoenix/boost/msm/row_tags.hpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/boost/msm/row_tags.hpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,53 @@
+// 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_ROW_TAGS_H
+#define BOOST_MSM_ROW_TAGS_H
+
+
+
+namespace boost { namespace msm
+{
+//tags
+struct a_row_tag {};
+struct g_row_tag {};
+struct _row_tag {};
+struct row_tag {};
+// tags for internal transitions
+struct a_irow_tag {};
+struct g_irow_tag {};
+struct _irow_tag {};
+struct irow_tag {};
+// tags for transitions internal to state machines (not using any substate)
+struct sm_a_i_row_tag {};
+struct sm_g_i_row_tag {};
+struct sm__i_row_tag {};
+struct sm_i_row_tag {};
+
+// flags used internally to handle terminate / interrupt states
+struct TerminateFlag
+{
+ typedef int non_forwarding_flag;
+ typedef int event_blocking_flag;
+};
+struct InterruptedFlag
+{
+ typedef int non_forwarding_flag;
+ typedef int event_blocking_flag;
+};
+template <class EndEvent>
+struct EndInterruptFlag
+{
+ typedef int non_forwarding_flag;
+};
+
+} } // boost::msm
+#endif //BOOST_MSM_ROW_TAGS_H
+

Added: branches/msm/msm_phoenix/libs/example/SimplePhoenix.cpp
==============================================================================
--- (empty file)
+++ branches/msm/msm_phoenix/libs/example/SimplePhoenix.cpp 2011-05-02 17:48:36 EDT (Mon, 02 May 2011)
@@ -0,0 +1,149 @@
+// Copyright 2010 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)
+
+#include <vector>
+#include <iostream>
+
+#include <boost/phoenix/core.hpp>
+#include <boost/phoenix/function.hpp>
+#include <boost/phoenix/core/argument.hpp>
+
+
+#include <boost/msm/back/state_machine.hpp>
+#include <boost/msm/front/euml/euml.hpp>
+
+
+using namespace std;
+using namespace boost::msm::front::euml;
+namespace msm = boost::msm;
+using namespace boost::phoenix;
+
+using boost::phoenix::arg_names::arg1;
+using boost::phoenix::arg_names::arg2;
+using boost::phoenix::arg_names::arg3;
+using boost::phoenix::arg_names::arg4;
+//namespace boost { namespace phoenix { namespace arg_names
+//{
+// expression::argument<3>::type const arg4 = {};
+//
+//}} }
+using boost::phoenix::arg_names::arg4;
+// entry/exit/action/guard logging functors
+#include "logging_functors.h"
+
+namespace // Concrete FSM implementation
+{
+ // events
+ BOOST_MSM_EUML_EVENT(open_close)
+
+ // Concrete FSM implementation
+ // The list of FSM states
+
+ struct Empty_impl : public msm::front::state<> , public euml_state<Empty_impl>
+ {
+ // this allows us to add some functions
+ void activate_empty() {std::cout << "switching to Empty " << std::endl;}
+ // standard entry behavior
+ template <class Event,class FSM>
+ void on_entry(Event const& evt,FSM& fsm)
+ {
+ std::cout << "entering: Empty" << std::endl;
+ }
+ template <class Event,class FSM>
+ void on_exit(Event const& evt,FSM& fsm)
+ {
+ std::cout << "leaving: Empty" << std::endl;
+ }
+ };
+ //instance for use in the transition table
+ Empty_impl const Empty;
+
+ // define more states
+ BOOST_MSM_EUML_STATE(( Open_Entry,Open_Exit ),Open)
+
+ struct some_guard_impl
+ {
+ typedef bool result_type;
+
+ bool operator()()
+ {
+ cout << "calling: some_guard" << endl;
+ return true;
+ }
+ };
+ boost::phoenix::function<some_guard_impl> some_guard;
+
+ struct some_action_impl
+ {
+ typedef void result_type;
+
+ void operator()()
+ {
+ cout << "calling: some_action" << endl;
+ }
+ };
+ boost::phoenix::function<some_action_impl> some_action;
+
+ // replaces the old transition table
+ BOOST_MSM_EUML_TRANSITION_TABLE((
+ Open == Empty + open_close [some_guard()&&some_guard()] / (some_action(),some_action())
+
+ // these ones are also ok
+ //Open == Empty + open_close / some_action()
+ //Empty + open_close [some_guard()] / some_action()
+ //Open == Empty / some_action()
+ // +------------------------------------------------------------------------------+
+ ),transition_table)
+
+ // create a state machine "on the fly"
+ BOOST_MSM_EUML_DECLARE_STATE_MACHINE(( transition_table, //STT
+ init_ << Empty, // Init State
+ no_action, // Entry
+ no_action, // Exit
+ attributes_ << no_attributes_, // Attributes
+ configure_ << no_configure_, // configuration
+ Log_No_Transition // no_transition handler
+ ),
+ player_) //fsm name
+
+ // or simply, if no no_transition handler needed:
+ //BOOST_MSM_EUML_DECLARE_STATE_MACHINE(( transition_table, //STT
+ // Empty // Init State
+ // ),player_)
+
+ // choice of back-end
+ typedef msm::back::state_machine<player_> player;
+
+ //
+ // Testing utilities.
+ //
+ static char const* const state_names[] = { "Stopped", "Paused", "Open", "Empty", "Playing" };
+ void pstate(player const& p)
+ {
+ std::cout << " -> " << state_names[p.current_state()[0]] << std::endl;
+ }
+
+ void test()
+ {
+ player p;
+ // needed to start the highest-level SM. This will call on_entry and mark the start of the SM
+ p.start();
+ // note that we write open_close and not open_close(), like usual. Both are possible with eUML, but
+ // you now have less to type.
+ // go to Open, call on_exit on Empty, then action, then on_entry on Open
+ p.process_event(open_close); pstate(p);
+ }
+}
+
+int main()
+{
+ test();
+ return 0;
+}


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