1 // Copyright 2008 Christophe Henry
2 // henry UNDERSCORE christophe AT hotmail DOT com
3 // This is an extended version of the state machine available in the boost::mpl library
4 // Distributed under the same license as the original.
5 // Copyright for the original version:
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
7 // under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H
12 #define BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H
14 #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
15 #include <boost/phoenix/core/meta_grammar.hpp>
18 #include <boost/msm/front/euml/common.hpp>
19 #include <boost/fusion/container/vector.hpp>
20 #include <boost/fusion/include/pair.hpp>
21 #include <boost/fusion/include/as_map.hpp>
23 #include <boost/mpl/remove_if.hpp>
24 #include <boost/mpl/eval_if.hpp>
25 #include <boost/mpl/assert.hpp>
27 #include <boost/msm/row_tags.hpp>
28 #include <boost/msm/front/common_states.hpp>
29 #include <boost/msm/front/state_machine_def.hpp>
30 #include <boost/msm/front/euml/operator.hpp>
31 #include <boost/msm/front/euml/guard_grammar.hpp>
33 BOOST_MPL_HAS_XXX_TRAIT_DEF(attribute_tag)
34 BOOST_MPL_HAS_XXX_TRAIT_DEF(flag_create_tag)
35 BOOST_MPL_HAS_XXX_TRAIT_DEF(defer_create_tag)
36 BOOST_MPL_HAS_XXX_TRAIT_DEF(control_configure_tag)
38 namespace proto = boost::proto;
40 namespace boost { namespace msm { namespace front { namespace euml
43 // provides the typedefs and interface. Concrete states derive from it.
44 template<class StateNameTag,
45 class EntryFunctor=NoAction,
46 class ExitFunctor=NoAction,
47 class Attributes= ::boost::fusion::vector<>,
48 class Flags = ::boost::mpl::vector0<>,
49 class Defer = ::boost::mpl::vector0<>,
50 class BASE = ::boost::msm::front::default_base_state>
51 struct func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
52 euml_state_intern<func_state<StateNameTag,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
56 BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
57 BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
59 typedef StateNameTag state_name_tag;
61 typedef Flags flag_list;
62 typedef ::boost::mpl::vector0<> internal_flag_list;
64 typedef Defer deferred_events;
66 template <class Event,class FSM>
67 void on_entry(Event const& evt,FSM& fsm)
69 EntryFunctor()(evt,fsm,*this);
71 template <class Event,class FSM>
72 void on_exit(Event const& evt,FSM& fsm)
74 ExitFunctor()(evt,fsm,*this);
78 // provides the typedefs and interface. Concrete states derive from it.
79 template<class StateNameTag,
81 class EntryFunctor=NoAction,
82 class ExitFunctor=NoAction,
83 class Attributes= ::boost::fusion::vector<>,
84 class Flags = ::boost::mpl::vector0<>,
85 class Defer = ::boost::mpl::vector0<>,
86 class BASE = default_base_state>
87 struct entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
88 euml_state_intern<entry_func_state<StateNameTag,ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
92 BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
93 BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
95 typedef StateNameTag state_name_tag;
97 typedef int pseudo_entry;
98 enum {zone_index=ZoneIndex};
99 typedef int explicit_entry_state;
102 typedef Flags flag_list;
103 typedef ::boost::mpl::vector0<> internal_flag_list;
105 typedef Defer deferred_events;
107 template <class Event,class FSM>
108 void on_entry(Event const& evt,FSM& fsm)
110 EntryFunctor()(evt,fsm,*this);
112 template <class Event,class FSM>
113 void on_exit(Event const& evt,FSM& fsm)
115 ExitFunctor()(evt,fsm,*this);
118 // provides the typedefs and interface. Concrete states derive from it.
119 template<class StateNameTag,
121 class EntryFunctor=NoAction,
122 class ExitFunctor=NoAction,
123 class Attributes= ::boost::fusion::vector<>,
124 class Flags = ::boost::mpl::vector0<>,
125 class Defer = ::boost::mpl::vector0<>,
126 class BASE = default_base_state>
127 struct explicit_entry_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
128 public ::boost::msm::front::explicit_entry<ZoneIndex>,
129 euml_state_intern<explicit_entry_func_state<StateNameTag,
130 ZoneIndex,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
132 explicit_entry_func_state(){}
134 BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
135 BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
137 typedef StateNameTag state_name_tag;
139 typedef Flags flag_list;
140 typedef ::boost::mpl::vector0<> internal_flag_list;
142 typedef Defer deferred_events;
144 template <class Event,class FSM>
145 void on_entry(Event const& evt,FSM& fsm)
147 EntryFunctor()(evt,fsm,*this);
149 template <class Event,class FSM>
150 void on_exit(Event const& evt,FSM& fsm)
152 ExitFunctor()(evt,fsm,*this);
156 // provides the typedefs and interface. Concrete states derive from it.
157 template<class StateNameTag,
159 class EntryFunctor=NoAction,
160 class ExitFunctor=NoAction,
161 class Attributes= ::boost::fusion::vector<>,
162 class Flags = ::boost::mpl::vector0<>,
163 class Defer = ::boost::mpl::vector0<>,
164 class BASE = default_base_state>
165 struct exit_func_state : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
166 euml_state_intern<exit_func_state<StateNameTag,Event,EntryFunctor,ExitFunctor,Attributes,Flags,Defer,BASE> >
170 BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
171 BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
173 typedef StateNameTag state_name_tag;
177 typedef int pseudo_exit;
180 typedef Flags flag_list;
181 typedef ::boost::mpl::vector0<> internal_flag_list;
183 typedef Defer deferred_events;
185 template <class Evt,class FSM>
186 void on_entry(Evt const& evt,FSM& fsm)
188 EntryFunctor()(evt,fsm,*this);
190 template <class Evt,class FSM>
191 void on_exit(Evt const& evt,FSM& fsm)
193 ExitFunctor()(evt,fsm,*this);
200 struct BuildActionSequence
204 ActionSequence_<make_vector_one_row<BuildActions(proto::_)>()>()
207 proto::comma<BuildActions,BuildActions >,
208 ActionSequence_<boost::mpl::push_back<
209 make_vector_one_row<BuildActions(proto::_left)>(),
210 BuildActions(proto::_right)>()>()
213 proto::comma<BuildActionSequence,BuildActions >,
214 ActionSequence_<boost::mpl::push_back<
215 get_sequence<BuildActionSequence(proto::_left) >(),
216 BuildActions(proto::_right) >() >()
221 #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
222 struct CustomPhoenixGrammar
223 : proto::switch_<CustomPhoenixGrammar>
225 template <typename Tag, typename Dummy = void>
228 proto::not_<BuildGuards> ,
229 proto::not_<BuildActionSequence>,
230 boost::phoenix::meta_grammar::case_<Tag>
238 #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
240 CustomPhoenixGrammar ,
253 #ifdef BOOST_MSM_EUML_PHOENIX_SUPPORT
255 CustomPhoenixGrammar ,
260 BuildActionSequence ,
266 struct BuildActionsCases
268 // The primary template matches nothing:
269 template<typename Tag>
271 : proto::not_<proto::_>
276 struct BuildActionsCases::case_<proto::tag::pre_inc>
278 proto::pre_inc<BuildActions >,
279 Pre_inc_< BuildActions(proto::_child)>()
283 struct BuildActionsCases::case_<proto::tag::pre_dec>
285 proto::pre_dec<BuildActions >,
286 Pre_dec_< BuildActions(proto::_child)>()
290 struct BuildActionsCases::case_<proto::tag::post_inc>
292 proto::post_inc<BuildActions >,
293 Post_inc_< BuildActions(proto::_child)>()
297 struct BuildActionsCases::case_<proto::tag::post_dec>
299 proto::post_dec<BuildActions >,
300 Post_dec_< BuildActions(proto::_child)>()
304 struct BuildActionsCases::case_<proto::tag::dereference>
306 proto::dereference<BuildActions >,
307 Deref_< BuildActions(proto::_child)>()
311 struct BuildActionsCases::case_<proto::tag::plus>
313 proto::plus<BuildActions,BuildActions >,
314 Plus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
318 struct BuildActionsCases::case_<proto::tag::minus>
320 proto::minus<BuildActions,BuildActions >,
321 Minus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
325 struct BuildActionsCases::case_<proto::tag::multiplies>
327 proto::multiplies<BuildActions,BuildActions >,
328 Multiplies_<BuildActions(proto::_left),BuildActions(proto::_right)>()
332 struct BuildActionsCases::case_<proto::tag::divides>
334 proto::divides<BuildActions,BuildActions >,
335 Divides_<BuildActions(proto::_left),BuildActions(proto::_right)>()
339 struct BuildActionsCases::case_<proto::tag::modulus>
341 proto::modulus<BuildActions,BuildActions >,
342 Modulus_<BuildActions(proto::_left),BuildActions(proto::_right)>()
346 struct BuildActionsCases::case_<proto::tag::bitwise_and>
348 proto::bitwise_and<BuildActions,BuildActions >,
349 Bitwise_And_<BuildActions(proto::_left),BuildActions(proto::_right)>()
353 struct BuildActionsCases::case_<proto::tag::bitwise_or>
355 proto::bitwise_or<BuildActions,BuildActions >,
356 Bitwise_Or_<BuildActions(proto::_left),BuildActions(proto::_right)>()
360 struct BuildActionsCases::case_<proto::tag::bitwise_xor>
362 proto::bitwise_xor<BuildActions,BuildActions >,
363 Bitwise_Xor_<BuildActions(proto::_left),BuildActions(proto::_right)>()
368 struct BuildActionsCases::case_<proto::tag::plus_assign>
370 proto::plus_assign<BuildActions,BuildActions >,
371 Plus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
375 struct BuildActionsCases::case_<proto::tag::minus_assign>
377 proto::minus_assign<BuildActions,BuildActions >,
378 Minus_Assign_<BuildActions(proto::_left),BuildActions(proto::_right)>()
382 struct BuildActionsCases::case_<proto::tag::multiplies_assign>
384 proto::multiplies_assign<BuildActions,BuildActions >,
385 Multiplies_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
389 struct BuildActionsCases::case_<proto::tag::divides_assign>
391 proto::divides_assign<BuildActions,BuildActions >,
392 Divides_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
396 struct BuildActionsCases::case_<proto::tag::modulus_assign>
398 proto::modulus_assign<BuildActions,BuildActions >,
399 Modulus_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
403 struct BuildActionsCases::case_<proto::tag::shift_left_assign>
405 proto::shift_left_assign<BuildActions,BuildActions >,
406 ShiftLeft_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
410 struct BuildActionsCases::case_<proto::tag::shift_right_assign>
412 proto::shift_right_assign<BuildActions,BuildActions >,
413 ShiftRight_Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
417 struct BuildActionsCases::case_<proto::tag::shift_left>
419 proto::shift_left<BuildActions,BuildActions >,
420 ShiftLeft_< BuildActions(proto::_left),BuildActions(proto::_right)>()
424 struct BuildActionsCases::case_<proto::tag::shift_right>
426 proto::shift_right<BuildActions,BuildActions >,
427 ShiftRight_< BuildActions(proto::_left),BuildActions(proto::_right)>()
431 struct BuildActionsCases::case_<proto::tag::assign>
433 proto::assign<BuildActions,BuildActions >,
434 Assign_< BuildActions(proto::_left),BuildActions(proto::_right)>()
438 struct BuildActionsCases::case_<proto::tag::subscript>
440 proto::subscript<BuildActions,BuildActions >,
441 Subscript_< BuildActions(proto::_left),BuildActions(proto::_right)>()
445 struct BuildActionsCases::case_<proto::tag::unary_plus>
447 proto::unary_plus<BuildActions >,
448 Unary_Plus_< BuildActions(proto::_child)>()
452 struct BuildActionsCases::case_<proto::tag::negate>
454 proto::negate<BuildActions >,
455 Unary_Minus_< BuildActions(proto::_child)>()
460 struct BuildActionsCases::case_<proto::tag::function>
463 proto::function<proto::terminal<if_tag>,BuildGuards,BuildActionSequence,BuildActionSequence >,
464 If_Else_<BuildGuards(proto::_child_c<1>),
465 BuildActionSequence(proto::_child_c<2>),
466 BuildActionSequence(proto::_child_c<3>) >()
469 proto::function<proto::terminal<if_then_tag>,BuildGuards,BuildActionSequence >,
470 If_Then_<BuildGuards(proto::_child_c<1>),
471 BuildActionSequence(proto::_child_c<2>)>()
474 proto::function<proto::terminal<while_do_tag>,BuildGuards,BuildActionSequence >,
475 While_Do_<BuildGuards(proto::_child_c<1>),
476 BuildActionSequence(proto::_child_c<2>) >()
479 proto::function<proto::terminal<do_while_tag>,BuildGuards,BuildActionSequence >,
480 Do_While_<BuildGuards(proto::_child_c<1>),
481 BuildActionSequence(proto::_child_c<2>) >()
484 proto::function<proto::terminal<for_loop_tag>,
485 BuildActionSequence,BuildGuards,BuildActionSequence,BuildActionSequence>,
486 For_Loop_<BuildActionSequence(proto::_child_c<1>),
487 BuildGuards(proto::_child_c<2>),
488 BuildActionSequence(proto::_child_c<3>),
489 BuildActionSequence(proto::_child_c<4>) >()
493 proto::function<proto::terminal<proto::_>,BuildActions >,
494 get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>) >()
497 proto::function<proto::terminal<proto::_> >,
498 get_fct<proto::_child_c<0> >()
501 proto::function<proto::terminal<proto::_>,BuildActions,BuildActions >,
502 get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>) >()
505 proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions >,
506 get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>)
507 ,BuildActions(proto::_child_c<2>),BuildActions(proto::_child_c<3>) >()
510 proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions >,
511 get_fct<proto::_child_c<0>
512 ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
513 ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>) >()
516 proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
517 get_fct<proto::_child_c<0>
518 ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
519 ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
520 ,BuildActions(proto::_child_c<5>) >()
524 proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
525 get_fct<proto::_child_c<0>
526 ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
527 ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
528 ,BuildActions(proto::_child_c<5>),BuildActions(proto::_child_c<6>) >()
536 struct BuildActionsCases::case_<proto::tag::terminal>
539 proto::terminal<action_tag>,
540 get_action_name<proto::_ >()
543 proto::terminal<state_tag>,
544 get_state_name<proto::_>()
547 proto::terminal<flag_tag>,
551 proto::terminal<event_tag>,
555 proto::terminal<fsm_artefact_tag>,
559 proto::terminal<proto::_>,
565 : proto::switch_<BuildActionsCases>
568 // attributes building
569 #define BOOST_MSM_EUML_DECLARE_ATTRIBUTE(attr_type,attr_name) \
570 struct attr_name ## _ \
571 : proto::extends< proto::terminal< ::boost::msm::front::action_tag>::type, attr_name ## _, boost::msm::sm_domain> \
572 {typedef attr_name ## _ action_name; \
573 typedef ::boost::fusion::pair<attr_name ## _,attr_type> attribute_type; \
574 attr_name ## _ (){} \
576 attr_name ## _ const attr_name = attr_name ## _();
578 struct make_attributes_tag
580 typedef int attribute_tag;
584 struct get_attribute_type
586 typedef typename T::attribute_type type;
589 struct transform_to_fusion_pair
591 typedef typename ::boost::mpl::fold<
592 Seq,::boost::mpl::vector<>,
593 ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
594 get_attribute_type< ::boost::mpl::placeholders::_2> >
598 template<class X = proto::is_proto_expr>
601 BOOST_PROTO_BASIC_EXTENDS(
602 proto::terminal<make_attributes_tag>::type
604 , boost::msm::sm_domain
606 typedef ::boost::fusion::pair<int,int> attribute_type;
609 attribute<> const attributes_ = {{{}}};
610 attribute<> const no_attributes_ = {{{}}};
612 struct BuildAttributesHelper
614 ::boost::mpl::pop_front<
617 , ::boost::fusion::vector<>()
618 , ::boost::mpl::push_back<proto::_state,
619 ::boost::mpl::if_< has_attribute_tag< proto::_value>,
621 get_attribute_type<proto::_> >
628 struct BuildAttributes
631 has_attribute_tag< ::boost::mpl::deref< ::boost::mpl::prior< ::boost::mpl::end< BuildAttributesHelper > > > >,
632 ::boost::fusion::result_of::as_map< ::boost::mpl::pop_back< BuildAttributesHelper > >,
633 ::boost::fusion::result_of::as_map< BuildAttributesHelper > >
637 // helper to build a mpl::vector from a << list
638 struct BuildMplVectorHelper
640 ::boost::mpl::pop_front<
643 , ::boost::mpl::vector0<>()
644 , ::boost::mpl::push_back<proto::_state, proto::_>()
653 ::boost::mpl::remove_if<
654 BuildMplVectorHelper,
655 ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, flag_tag > >
660 struct control_configure_tag {};
662 // configuration building
663 struct make_configure_tag
665 typedef int control_configure_tag;
668 template<class X = proto::is_proto_expr>
671 typedef not_euml_tag euml_tag_type;
672 BOOST_PROTO_BASIC_EXTENDS(
673 proto::terminal<make_configure_tag>::type
675 , boost::msm::sm_domain
679 configure<> const configure_ = {{{}}};
680 configure<> const no_configure_ = {{{}}};
682 struct BuildConfigure
684 ::boost::mpl::remove_if<
685 BuildMplVectorHelper,
686 ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, config_tag > >
693 ::boost::mpl::remove_if<
694 BuildMplVectorHelper,
695 ::boost::mpl::not_< ::boost::is_same<get_euml_tag_type< ::boost::mpl::placeholders::_ >, event_tag > >
700 template<class X = proto::is_proto_expr>
703 typedef int defer_create_tag;
704 BOOST_PROTO_BASIC_EXTENDS(
705 proto::terminal<state_tag>::type
707 , boost::msm::sm_domain
711 define_init<> const init_ = {{{}}};
714 ::boost::mpl::pop_front<
717 , ::boost::mpl::vector0<>()
718 , ::boost::mpl::push_back<proto::_state, proto::_>()
724 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
728 typename ::boost::mpl::eval_if<
729 typename proto::matches<Expr1,ActionGrammar>::type,
730 boost::result_of<ActionGrammar(Expr1)>,
731 make_invalid_type>::type,
732 typename ::boost::mpl::eval_if<
733 typename proto::matches<Expr2,ActionGrammar>::type,
734 boost::result_of<ActionGrammar(Expr2)>,
735 make_invalid_type>::type,
736 typename boost::result_of<BuildAttributes(Attr)>::type,
737 typename boost::result_of<BuildFlags(Configure)>::type,
738 typename boost::result_of<BuildDeferred(Configure)>::type,
741 build_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
743 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
744 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
745 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
746 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
747 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
748 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
751 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
755 typename ::boost::mpl::eval_if<
756 typename proto::matches<Expr1,ActionGrammar>::type,
757 boost::result_of<ActionGrammar(Expr1)>,
758 make_invalid_type>::type,
759 typename ::boost::mpl::eval_if<
760 typename proto::matches<Expr2,ActionGrammar>::type,
761 boost::result_of<ActionGrammar(Expr2)>,
762 make_invalid_type>::type,
763 typename boost::result_of<BuildAttributes(Attr)>::type,
764 typename boost::result_of<BuildFlags(Configure)>::type,
765 typename boost::result_of<BuildDeferred(Configure)>::type
767 build_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
769 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
770 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
771 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
772 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
773 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
774 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
777 template <class StateNameTag,class Expr1,class Expr2,class Attr>
781 typename ::boost::mpl::eval_if<
782 typename proto::matches<Expr1,ActionGrammar>::type,
783 boost::result_of<ActionGrammar(Expr1)>,
784 make_invalid_type>::type,
785 typename ::boost::mpl::eval_if<
786 typename proto::matches<Expr2,ActionGrammar>::type,
787 boost::result_of<ActionGrammar(Expr2)>,
788 make_invalid_type>::type,
789 typename boost::result_of<BuildAttributes(Attr)>::type
791 build_state(Expr1 const& ,Expr2 const& ,Attr const&)
793 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
794 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
795 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
796 return func_state<StateNameTag,entry_action,exit_action,attributes_type>();
799 template <class StateNameTag,class Expr1,class Expr2>
803 typename ::boost::mpl::eval_if<
804 typename proto::matches<Expr1,ActionGrammar>::type,
805 boost::result_of<ActionGrammar(Expr1)>,
806 make_invalid_type>::type,
807 typename ::boost::mpl::eval_if<
808 typename proto::matches<Expr2,ActionGrammar>::type,
809 boost::result_of<ActionGrammar(Expr2)>,
810 make_invalid_type>::type
812 build_state(Expr1 const& ,Expr2 const& )
814 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
815 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
816 return func_state<StateNameTag,entry_action,exit_action>();
819 template <class StateNameTag,class Expr1>
823 typename ::boost::mpl::eval_if<
824 typename proto::matches<Expr1,ActionGrammar>::type,
825 boost::result_of<ActionGrammar(Expr1)>,
826 make_invalid_type>::type,
829 build_state(Expr1 const& )
831 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
832 return func_state<StateNameTag,entry_action,NoAction>();
834 template<class StateNameTag>
843 return func_state<StateNameTag,NoAction,NoAction>();
846 // provides the typedefs and interface. Concrete states derive from it.
847 template<class StateNameTag,
850 class EntryFunctor=NoAction,
851 class ExitFunctor=NoAction,
852 class Attributes= ::boost::fusion::vector<>,
853 class Flags = ::boost::mpl::vector0<>,
854 class Defer = ::boost::mpl::vector0<>,
855 class Configuration = ::boost::mpl::vector0<>,
856 class NoTransitionFunctor = NoAction,
857 class OnExceptionFunctor = NoAction,
858 class BASE = ::boost::msm::front::default_base_state>
859 struct func_state_machine : public ::boost::msm::front::detail::state_base<BASE,Attributes>,
860 euml_state_intern<func_state_machine<StateNameTag,STT,Init,EntryFunctor,ExitFunctor,Attributes,Flags,
861 Defer,NoTransitionFunctor,OnExceptionFunctor,BASE> >
863 func_state_machine(){}
865 BOOST_MPL_ASSERT_NOT(( boost::is_same<EntryFunctor,invalid_type> ));
866 BOOST_MPL_ASSERT_NOT(( boost::is_same<ExitFunctor,invalid_type> ));
867 BOOST_MPL_ASSERT_NOT(( boost::is_same<NoTransitionFunctor,invalid_type> ));
868 BOOST_MPL_ASSERT_NOT(( boost::is_same<OnExceptionFunctor,invalid_type> ));
869 BOOST_MPL_ASSERT_NOT(( boost::is_same<STT,invalid_type> ));
872 typedef StateNameTag state_name_tag;
873 typedef Flags flag_list;
874 typedef ::boost::mpl::vector0<> internal_flag_list;
876 typedef Defer deferred_events;
877 // customization (message queue, exceptions)
878 typedef Configuration configuration;
881 typedef BASE BaseAllStates;
882 typedef STT transition_table;
883 // the initial state of the player SM. Must be defined
884 typedef Init initial_state;
886 template <class Event,class FSM>
887 void on_entry(Event const& evt,FSM& fsm)
889 EntryFunctor()(evt,fsm,*this);
891 template <class Event,class FSM>
892 void on_exit(Event const& evt,FSM& fsm)
894 ExitFunctor()(evt,fsm,*this);
897 // Default no-transition handler. Can be replaced in the Derived SM class.
898 template <class FSM,class Event>
899 void no_transition(Event const& evt,FSM& fsm,int state)
901 NoTransitionFunctor()(evt,fsm,state);
903 // default exception handler. Can be replaced in the Derived SM class.
904 template <class FSM,class Event>
905 void exception_caught (Event const& evt,FSM& fsm,std::exception& e)
907 OnExceptionFunctor()(evt,fsm,e);
911 template <class StateNameTag,class STT,class Init>
916 typename boost::result_of<BuildInit(Init)>::type
920 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
921 return func_state_machine<StateNameTag,STT,init_type>();
924 template <class StateNameTag,class STT,class Init,class Expr1>
929 typename boost::result_of<BuildInit(Init)>::type,
930 typename ::boost::mpl::eval_if<
931 typename proto::matches<Expr1,ActionGrammar>::type,
932 boost::result_of<ActionGrammar(Expr1)>,
933 make_invalid_type>::type
935 build_sm(STT ,Init , Expr1 const&)
937 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
938 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
939 return func_state_machine<StateNameTag,STT,init_type,entry_action>();
942 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2>
947 typename boost::result_of<BuildInit(Init)>::type,
948 typename ::boost::mpl::eval_if<
949 typename proto::matches<Expr1,ActionGrammar>::type,
950 boost::result_of<ActionGrammar(Expr1)>,
951 make_invalid_type>::type,
952 typename ::boost::mpl::eval_if<
953 typename proto::matches<Expr2,ActionGrammar>::type,
954 boost::result_of<ActionGrammar(Expr2)>,
955 make_invalid_type>::type
957 build_sm(STT ,Init , Expr1 const& ,Expr2 const& )
959 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
960 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
961 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
962 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action>();
965 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr>
970 typename boost::result_of<BuildInit(Init)>::type,
971 typename ::boost::mpl::eval_if<
972 typename proto::matches<Expr1,ActionGrammar>::type,
973 boost::result_of<ActionGrammar(Expr1)>,
974 make_invalid_type>::type,
975 typename ::boost::mpl::eval_if<
976 typename proto::matches<Expr2,ActionGrammar>::type,
977 boost::result_of<ActionGrammar(Expr2)>,
978 make_invalid_type>::type,
979 typename boost::result_of<BuildAttributes(Attr)>::type
981 build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&)
983 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
984 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
985 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
986 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
987 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type>();
990 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure>
995 typename boost::result_of<BuildInit(Init)>::type,
996 typename ::boost::mpl::eval_if<
997 typename proto::matches<Expr1,ActionGrammar>::type,
998 boost::result_of<ActionGrammar(Expr1)>,
999 make_invalid_type>::type,
1000 typename ::boost::mpl::eval_if<
1001 typename proto::matches<Expr2,ActionGrammar>::type,
1002 boost::result_of<ActionGrammar(Expr2)>,
1003 make_invalid_type>::type,
1004 typename boost::result_of<BuildAttributes(Attr)>::type,
1005 typename boost::result_of<BuildFlags(Configure)>::type,
1006 typename boost::result_of<BuildDeferred(Configure)>::type,
1007 typename boost::result_of<BuildConfigure(Configure)>::type
1009 build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const& )
1011 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
1012 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1013 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1014 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1015 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1016 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1017 typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
1018 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,
1019 deferred_type,config_type>();
1023 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3>
1028 typename boost::result_of<BuildInit(Init)>::type,
1029 typename ::boost::mpl::eval_if<
1030 typename proto::matches<Expr1,ActionGrammar>::type,
1031 boost::result_of<ActionGrammar(Expr1)>,
1032 make_invalid_type>::type,
1033 typename ::boost::mpl::eval_if<
1034 typename proto::matches<Expr2,ActionGrammar>::type,
1035 boost::result_of<ActionGrammar(Expr2)>,
1036 make_invalid_type>::type,
1037 typename boost::result_of<BuildAttributes(Attr)>::type,
1038 typename boost::result_of<BuildFlags(Configure)>::type,
1039 typename boost::result_of<BuildDeferred(Configure)>::type,
1040 typename boost::result_of<BuildConfigure(Configure)>::type,
1041 typename ::boost::mpl::eval_if<
1042 typename proto::matches<Expr3,ActionGrammar>::type,
1043 boost::result_of<ActionGrammar(Expr3)>,
1044 make_invalid_type>::type
1046 build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const&, Configure const&, Expr3 const& )
1048 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
1049 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1050 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1051 typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
1052 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1053 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1054 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1055 typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
1056 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
1057 config_type,no_transition_action>();
1060 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4>
1065 typename boost::result_of<BuildInit(Init)>::type,
1066 typename ::boost::mpl::eval_if<
1067 typename proto::matches<Expr1,ActionGrammar>::type,
1068 boost::result_of<ActionGrammar(Expr1)>,
1069 make_invalid_type>::type,
1070 typename ::boost::mpl::eval_if<
1071 typename proto::matches<Expr2,ActionGrammar>::type,
1072 boost::result_of<ActionGrammar(Expr2)>,
1073 make_invalid_type>::type,
1074 typename boost::result_of<BuildAttributes(Attr)>::type,
1075 typename boost::result_of<BuildFlags(Configure)>::type,
1076 typename boost::result_of<BuildDeferred(Configure)>::type,
1077 typename boost::result_of<BuildConfigure(Configure)>::type,
1078 typename ::boost::mpl::eval_if<
1079 typename proto::matches<Expr3,ActionGrammar>::type,
1080 boost::result_of<ActionGrammar(Expr3)>,
1081 make_invalid_type>::type,
1082 typename ::boost::mpl::eval_if<
1083 typename proto::matches<Expr4,ActionGrammar>::type,
1084 boost::result_of<ActionGrammar(Expr4)>,
1085 make_invalid_type>::type
1087 build_sm(STT ,Init , Expr1 const& ,Expr2 const& , Attr const&, Configure const&, Expr3 const&, Expr4 const& )
1089 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
1090 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1091 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1092 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1093 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1094 typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
1095 typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
1096 typedef typename boost::result_of<ActionGrammar(Expr4)>::type on_exception_action;
1097 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1098 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
1099 config_type,no_transition_action,on_exception_action>();
1102 template <class StateNameTag,class STT,class Init,class Expr1,class Expr2,class Attr,class Configure,class Expr3,class Expr4,class BASE>
1107 typename boost::result_of<BuildInit(Init)>::type,
1108 typename ::boost::mpl::eval_if<
1109 typename proto::matches<Expr1,ActionGrammar>::type,
1110 boost::result_of<ActionGrammar(Expr1)>,
1111 make_invalid_type>::type,
1112 typename ::boost::mpl::eval_if<
1113 typename proto::matches<Expr2,ActionGrammar>::type,
1114 boost::result_of<ActionGrammar(Expr2)>,
1115 make_invalid_type>::type,
1116 typename boost::result_of<BuildAttributes(Attr)>::type,
1117 typename boost::result_of<BuildFlags(Configure)>::type,
1118 typename boost::result_of<BuildDeferred(Configure)>::type,
1119 typename boost::result_of<BuildConfigure(Configure)>::type,
1120 typename ::boost::mpl::eval_if<
1121 typename proto::matches<Expr3,ActionGrammar>::type,
1122 boost::result_of<ActionGrammar(Expr3)>,
1123 make_invalid_type>::type,
1124 typename ::boost::mpl::eval_if<
1125 typename proto::matches<Expr4,ActionGrammar>::type,
1126 boost::result_of<ActionGrammar(Expr4)>,
1127 make_invalid_type>::type,
1130 build_sm(STT ,Init , Expr1 const& ,Expr2 const& ,Attr const& , Configure const&, Expr3 const&, Expr4 const& , BASE )
1132 typedef typename boost::result_of<BuildInit(Init)>::type init_type;
1133 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1134 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1135 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1136 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1137 typedef typename boost::result_of<BuildConfigure(Configure)>::type config_type;
1138 typedef typename boost::result_of<ActionGrammar(Expr3)>::type no_transition_action;
1139 typedef typename boost::result_of<ActionGrammar(Expr4)>::type on_exception_action;
1140 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1141 return func_state_machine<StateNameTag,STT,init_type,entry_action,exit_action,attributes_type,flags_type,deferred_type,
1142 config_type,no_transition_action,on_exception_action,BASE>();
1145 template <class Expr>
1147 ::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type>
1148 build_attributes (Expr const&)
1150 return ::boost::msm::front::detail::inherit_attributes<typename boost::result_of<BuildAttributes(Expr)>::type> ();
1153 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE>
1157 typename ::boost::mpl::eval_if<
1158 typename proto::matches<Expr1,ActionGrammar>::type,
1159 boost::result_of<ActionGrammar(Expr1)>,
1160 make_invalid_type>::type,
1161 typename ::boost::mpl::eval_if<
1162 typename proto::matches<Expr2,ActionGrammar>::type,
1163 boost::result_of<ActionGrammar(Expr2)>,
1164 make_invalid_type>::type,
1165 typename boost::result_of<BuildAttributes(Attr)>::type,
1166 typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
1167 ::boost::msm::TerminateFlag>::type,
1168 typename boost::result_of<BuildDeferred(Configure)>::type,
1171 build_terminate_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
1173 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1174 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1175 typedef typename ::boost::mpl::push_back<
1176 typename boost::result_of<BuildFlags(Configure)>::type,
1177 ::boost::msm::TerminateFlag >::type flags_type;
1178 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1179 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1180 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
1183 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure>
1187 typename ::boost::mpl::eval_if<
1188 typename proto::matches<Expr1,ActionGrammar>::type,
1189 boost::result_of<ActionGrammar(Expr1)>,
1190 make_invalid_type>::type,
1191 typename ::boost::mpl::eval_if<
1192 typename proto::matches<Expr2,ActionGrammar>::type,
1193 boost::result_of<ActionGrammar(Expr2)>,
1194 make_invalid_type>::type,
1195 typename boost::result_of<BuildAttributes(Attr)>::type,
1196 typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
1197 ::boost::msm::TerminateFlag>::type,
1198 typename boost::result_of<BuildDeferred(Configure)>::type
1200 build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
1202 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1203 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1204 typedef typename ::boost::mpl::push_back<
1205 typename boost::result_of<BuildFlags(Configure)>::type,
1206 ::boost::msm::TerminateFlag >::type flags_type;
1207 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1208 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1210 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
1213 template <class StateNameTag,class Expr1,class Expr2,class Attr>
1217 typename ::boost::mpl::eval_if<
1218 typename proto::matches<Expr1,ActionGrammar>::type,
1219 boost::result_of<ActionGrammar(Expr1)>,
1220 make_invalid_type>::type,
1221 typename ::boost::mpl::eval_if<
1222 typename proto::matches<Expr2,ActionGrammar>::type,
1223 boost::result_of<ActionGrammar(Expr2)>,
1224 make_invalid_type>::type,
1225 typename boost::result_of<BuildAttributes(Attr)>::type,
1226 ::boost::mpl::vector<boost::msm::TerminateFlag>
1228 build_terminate_state(Expr1 const& ,Expr2 const& ,Attr const&)
1230 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1231 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1232 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1233 return func_state<StateNameTag,entry_action,exit_action,attributes_type, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
1236 template <class StateNameTag,class Expr1,class Expr2>
1240 typename ::boost::mpl::eval_if<
1241 typename proto::matches<Expr1,ActionGrammar>::type,
1242 boost::result_of<ActionGrammar(Expr1)>,
1243 make_invalid_type>::type,
1244 typename ::boost::mpl::eval_if<
1245 typename proto::matches<Expr2,ActionGrammar>::type,
1246 boost::result_of<ActionGrammar(Expr2)>,
1247 make_invalid_type>::type,
1248 ::boost::fusion::vector<>,
1249 ::boost::mpl::vector<boost::msm::TerminateFlag>
1251 build_terminate_state(Expr1 const& ,Expr2 const& )
1253 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1254 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1255 return func_state<StateNameTag,entry_action,exit_action,
1256 ::boost::fusion::vector<>, ::boost::mpl::vector< ::boost::msm::TerminateFlag> >();
1259 template <class StateNameTag,class Expr1>
1263 typename ::boost::mpl::eval_if<
1264 typename proto::matches<Expr1,ActionGrammar>::type,
1265 boost::result_of<ActionGrammar(Expr1)>,
1266 make_invalid_type>::type,
1268 ::boost::fusion::vector<>,
1269 ::boost::mpl::vector<boost::msm::TerminateFlag>
1271 build_terminate_state(Expr1 const& )
1273 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1274 return func_state<StateNameTag,entry_action,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
1276 template<class StateNameTag>
1282 ::boost::fusion::vector<>,
1283 ::boost::mpl::vector<boost::msm::TerminateFlag>
1285 build_terminate_state()
1287 return func_state<StateNameTag,NoAction,NoAction,::boost::fusion::vector<>,::boost::mpl::vector<boost::msm::TerminateFlag> >();
1290 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class BASE,class EndInterruptEvent>
1294 typename ::boost::mpl::eval_if<
1295 typename proto::matches<Expr1,ActionGrammar>::type,
1296 boost::result_of<ActionGrammar(Expr1)>,
1297 make_invalid_type>::type,
1298 typename ::boost::mpl::eval_if<
1299 typename proto::matches<Expr2,ActionGrammar>::type,
1300 boost::result_of<ActionGrammar(Expr2)>,
1301 make_invalid_type>::type,
1302 typename boost::result_of<BuildAttributes(Attr)>::type,
1303 typename ::boost::mpl::push_back<
1304 typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
1305 ::boost::msm::InterruptedFlag>::type,
1306 boost::msm::EndInterruptFlag<EndInterruptEvent>
1308 typename boost::result_of<BuildDeferred(Configure)>::type,
1311 build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
1313 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1314 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1315 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1316 typedef typename ::boost::mpl::push_back<
1317 typename ::boost::mpl::push_back<
1318 typename boost::result_of<BuildFlags(Configure)>::type,
1319 ::boost::msm::InterruptedFlag>::type,
1320 boost::msm::EndInterruptFlag<EndInterruptEvent>
1322 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1323 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
1326 template <class StateNameTag,class Expr1,class Expr2,class Attr,class Configure,class EndInterruptEvent>
1330 typename ::boost::mpl::eval_if<
1331 typename proto::matches<Expr1,ActionGrammar>::type,
1332 boost::result_of<ActionGrammar(Expr1)>,
1333 make_invalid_type>::type,
1334 typename ::boost::mpl::eval_if<
1335 typename proto::matches<Expr2,ActionGrammar>::type,
1336 boost::result_of<ActionGrammar(Expr2)>,
1337 make_invalid_type>::type,
1338 typename boost::result_of<BuildAttributes(Attr)>::type,
1339 typename ::boost::mpl::push_back<
1340 typename ::boost::mpl::push_back< typename boost::result_of<BuildFlags(Configure)>::type,
1341 ::boost::msm::InterruptedFlag>::type,
1342 boost::msm::EndInterruptFlag<EndInterruptEvent>
1344 typename boost::result_of<BuildDeferred(Configure)>::type
1346 build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
1348 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1349 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1350 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1352 typedef typename ::boost::mpl::push_back<
1353 typename ::boost::mpl::push_back<
1354 typename boost::result_of<BuildFlags(Configure)>::type,
1355 ::boost::msm::InterruptedFlag>::type,
1356 boost::msm::EndInterruptFlag<EndInterruptEvent>
1358 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1360 return func_state<StateNameTag,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
1363 template <class StateNameTag,class Expr1,class Expr2,class Attr,class EndInterruptEvent>
1367 typename ::boost::mpl::eval_if<
1368 typename proto::matches<Expr1,ActionGrammar>::type,
1369 boost::result_of<ActionGrammar(Expr1)>,
1370 make_invalid_type>::type,
1371 typename ::boost::mpl::eval_if<
1372 typename proto::matches<Expr2,ActionGrammar>::type,
1373 boost::result_of<ActionGrammar(Expr2)>,
1374 make_invalid_type>::type,
1375 typename boost::result_of<BuildAttributes(Attr)>::type,
1376 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
1378 build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& ,Attr const&)
1380 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1381 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1382 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1383 return func_state<StateNameTag,entry_action,exit_action,attributes_type,
1384 ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
1387 template <class StateNameTag,class Expr1,class Expr2,class EndInterruptEvent>
1391 typename ::boost::mpl::eval_if<
1392 typename proto::matches<Expr1,ActionGrammar>::type,
1393 boost::result_of<ActionGrammar(Expr1)>,
1394 make_invalid_type>::type,
1395 typename ::boost::mpl::eval_if<
1396 typename proto::matches<Expr2,ActionGrammar>::type,
1397 boost::result_of<ActionGrammar(Expr2)>,
1398 make_invalid_type>::type,
1399 ::boost::fusion::vector<>,
1400 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
1402 build_interrupt_state(EndInterruptEvent const&,Expr1 const& ,Expr2 const& )
1404 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1405 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1406 return func_state<StateNameTag,entry_action,exit_action,
1407 ::boost::fusion::vector<>,
1408 ::boost::mpl::vector< boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
1411 template <class StateNameTag,class Expr1,class EndInterruptEvent>
1415 typename ::boost::mpl::eval_if<
1416 typename proto::matches<Expr1,ActionGrammar>::type,
1417 boost::result_of<ActionGrammar(Expr1)>,
1418 make_invalid_type>::type,
1420 ::boost::fusion::vector<>,
1421 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
1423 build_interrupt_state(EndInterruptEvent const&, Expr1 const&)
1425 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1426 return func_state<StateNameTag,entry_action,NoAction, ::boost::fusion::vector<>,
1427 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
1430 template <class StateNameTag,class EndInterruptEvent>
1436 ::boost::fusion::vector<>,
1437 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> >
1439 build_interrupt_state(EndInterruptEvent const&)
1441 return func_state<StateNameTag,NoAction,NoAction, ::boost::fusion::vector<>,
1442 ::boost::mpl::vector<boost::msm::InterruptedFlag, boost::msm::EndInterruptFlag<EndInterruptEvent> > >();
1445 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
1450 typename ::boost::mpl::eval_if<
1451 typename proto::matches<Expr1,ActionGrammar>::type,
1452 boost::result_of<ActionGrammar(Expr1)>,
1453 make_invalid_type>::type,
1454 typename ::boost::mpl::eval_if<
1455 typename proto::matches<Expr2,ActionGrammar>::type,
1456 boost::result_of<ActionGrammar(Expr2)>,
1457 make_invalid_type>::type,
1458 typename boost::result_of<BuildAttributes(Attr)>::type,
1459 typename boost::result_of<BuildFlags(Configure)>::type,
1460 typename boost::result_of<BuildDeferred(Configure)>::type,
1463 build_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
1465 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1466 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1467 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1468 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1469 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1470 return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
1473 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
1478 typename ::boost::mpl::eval_if<
1479 typename proto::matches<Expr1,ActionGrammar>::type,
1480 boost::result_of<ActionGrammar(Expr1)>,
1481 make_invalid_type>::type,
1482 typename ::boost::mpl::eval_if<
1483 typename proto::matches<Expr2,ActionGrammar>::type,
1484 boost::result_of<ActionGrammar(Expr2)>,
1485 make_invalid_type>::type,
1486 typename boost::result_of<BuildAttributes(Attr)>::type,
1487 typename boost::result_of<BuildFlags(Configure)>::type,
1488 typename boost::result_of<BuildDeferred(Configure)>::type
1490 build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
1492 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1493 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1494 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1495 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1496 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1497 return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
1500 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
1505 typename ::boost::mpl::eval_if<
1506 typename proto::matches<Expr1,ActionGrammar>::type,
1507 boost::result_of<ActionGrammar(Expr1)>,
1508 make_invalid_type>::type,
1509 typename ::boost::mpl::eval_if<
1510 typename proto::matches<Expr2,ActionGrammar>::type,
1511 boost::result_of<ActionGrammar(Expr2)>,
1512 make_invalid_type>::type,
1513 typename boost::result_of<BuildAttributes(Attr)>::type
1515 build_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
1517 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1518 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1519 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1520 return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
1523 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
1528 typename ::boost::mpl::eval_if<
1529 typename proto::matches<Expr1,ActionGrammar>::type,
1530 boost::result_of<ActionGrammar(Expr1)>,
1531 make_invalid_type>::type,
1532 typename ::boost::mpl::eval_if<
1533 typename proto::matches<Expr2,ActionGrammar>::type,
1534 boost::result_of<ActionGrammar(Expr2)>,
1535 make_invalid_type>::type
1537 build_entry_state(Expr1 const& ,Expr2 const& )
1539 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1540 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1541 return entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
1544 template <class StateNameTag,int ZoneIndex,class Expr1>
1549 typename ::boost::mpl::eval_if<
1550 typename proto::matches<Expr1,ActionGrammar>::type,
1551 boost::result_of<ActionGrammar(Expr1)>,
1552 make_invalid_type>::type,
1555 build_entry_state(Expr1 const& )
1557 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1558 return entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
1561 template <class StateNameTag,int ZoneIndex>
1571 return entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
1574 template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure,class BASE>
1579 typename ::boost::mpl::eval_if<
1580 typename proto::matches<Expr1,ActionGrammar>::type,
1581 boost::result_of<ActionGrammar(Expr1)>,
1582 make_invalid_type>::type,
1583 typename ::boost::mpl::eval_if<
1584 typename proto::matches<Expr2,ActionGrammar>::type,
1585 boost::result_of<ActionGrammar(Expr2)>,
1586 make_invalid_type>::type,
1587 typename boost::result_of<BuildAttributes(Attr)>::type,
1588 typename boost::result_of<BuildFlags(Configure)>::type,
1589 typename boost::result_of<BuildDeferred(Configure)>::type,
1592 build_exit_state(Event const&,Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
1594 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1595 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1596 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1597 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1598 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1599 return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
1602 template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr,class Configure>
1607 typename ::boost::mpl::eval_if<
1608 typename proto::matches<Expr1,ActionGrammar>::type,
1609 boost::result_of<ActionGrammar(Expr1)>,
1610 make_invalid_type>::type,
1611 typename ::boost::mpl::eval_if<
1612 typename proto::matches<Expr2,ActionGrammar>::type,
1613 boost::result_of<ActionGrammar(Expr2)>,
1614 make_invalid_type>::type,
1615 typename boost::result_of<BuildAttributes(Attr)>::type,
1616 typename boost::result_of<BuildFlags(Configure)>::type,
1617 typename boost::result_of<BuildDeferred(Configure)>::type
1619 build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
1621 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1622 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1623 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1624 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1625 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1626 return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
1629 template <class StateNameTag,class Event,class Expr1,class Expr2,class Attr>
1634 typename ::boost::mpl::eval_if<
1635 typename proto::matches<Expr1,ActionGrammar>::type,
1636 boost::result_of<ActionGrammar(Expr1)>,
1637 make_invalid_type>::type,
1638 typename ::boost::mpl::eval_if<
1639 typename proto::matches<Expr2,ActionGrammar>::type,
1640 boost::result_of<ActionGrammar(Expr2)>,
1641 make_invalid_type>::type,
1642 typename boost::result_of<BuildAttributes(Attr)>::type
1644 build_exit_state(Event const&,Expr1 const& ,Expr2 const& ,Attr const&)
1646 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1647 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1648 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1649 return exit_func_state<StateNameTag,Event,entry_action,exit_action,attributes_type>();
1652 template <class StateNameTag,class Event,class Expr1,class Expr2>
1657 typename ::boost::mpl::eval_if<
1658 typename proto::matches<Expr1,ActionGrammar>::type,
1659 boost::result_of<ActionGrammar(Expr1)>,
1660 make_invalid_type>::type,
1661 typename ::boost::mpl::eval_if<
1662 typename proto::matches<Expr2,ActionGrammar>::type,
1663 boost::result_of<ActionGrammar(Expr2)>,
1664 make_invalid_type>::type
1666 build_exit_state(Event const&,Expr1 const& ,Expr2 const& )
1668 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1669 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1670 return exit_func_state<StateNameTag,Event,entry_action,exit_action>();
1673 template <class StateNameTag,class Event,class Expr1>
1678 typename ::boost::mpl::eval_if<
1679 typename proto::matches<Expr1,ActionGrammar>::type,
1680 boost::result_of<ActionGrammar(Expr1)>,
1681 make_invalid_type>::type,
1684 build_exit_state(Event const&, Expr1 const& )
1686 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1687 return exit_func_state<StateNameTag,Event,entry_action,NoAction>();
1690 template <class StateNameTag,class Event>
1698 build_exit_state(Event const&)
1700 return exit_func_state<StateNameTag,Event,NoAction,NoAction>();
1703 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure,class BASE>
1705 explicit_entry_func_state<
1708 typename ::boost::mpl::eval_if<
1709 typename proto::matches<Expr1,ActionGrammar>::type,
1710 boost::result_of<ActionGrammar(Expr1)>,
1711 make_invalid_type>::type,
1712 typename ::boost::mpl::eval_if<
1713 typename proto::matches<Expr2,ActionGrammar>::type,
1714 boost::result_of<ActionGrammar(Expr2)>,
1715 make_invalid_type>::type,
1716 typename boost::result_of<BuildAttributes(Attr)>::type,
1717 typename boost::result_of<BuildFlags(Configure)>::type,
1718 typename boost::result_of<BuildDeferred(Configure)>::type,
1721 build_explicit_entry_state(Expr1 const& ,Expr2 const& , Attr const&, Configure const&, BASE )
1723 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1724 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1725 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1726 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1727 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1728 return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type,BASE>();
1731 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr,class Configure>
1733 explicit_entry_func_state<
1736 typename ::boost::mpl::eval_if<
1737 typename proto::matches<Expr1,ActionGrammar>::type,
1738 boost::result_of<ActionGrammar(Expr1)>,
1739 make_invalid_type>::type,
1740 typename ::boost::mpl::eval_if<
1741 typename proto::matches<Expr2,ActionGrammar>::type,
1742 boost::result_of<ActionGrammar(Expr2)>,
1743 make_invalid_type>::type,
1744 typename boost::result_of<BuildAttributes(Attr)>::type,
1745 typename boost::result_of<BuildFlags(Configure)>::type,
1746 typename boost::result_of<BuildDeferred(Configure)>::type
1748 build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&, Configure const&)
1750 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1751 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1752 typedef typename boost::result_of<BuildFlags(Configure)>::type flags_type;
1753 typedef typename boost::result_of<BuildDeferred(Configure)>::type deferred_type;
1754 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1755 return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type,flags_type,deferred_type>();
1758 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2,class Attr>
1760 explicit_entry_func_state<
1763 typename ::boost::mpl::eval_if<
1764 typename proto::matches<Expr1,ActionGrammar>::type,
1765 boost::result_of<ActionGrammar(Expr1)>,
1766 make_invalid_type>::type,
1767 typename ::boost::mpl::eval_if<
1768 typename proto::matches<Expr2,ActionGrammar>::type,
1769 boost::result_of<ActionGrammar(Expr2)>,
1770 make_invalid_type>::type,
1771 typename boost::result_of<BuildAttributes(Attr)>::type
1773 build_explicit_entry_state(Expr1 const& ,Expr2 const& ,Attr const&)
1775 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1776 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1777 typedef typename boost::result_of<BuildAttributes(Attr)>::type attributes_type;
1778 return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action,attributes_type>();
1781 template <class StateNameTag,int ZoneIndex,class Expr1,class Expr2>
1783 explicit_entry_func_state<
1786 typename ::boost::mpl::eval_if<
1787 typename proto::matches<Expr1,ActionGrammar>::type,
1788 boost::result_of<ActionGrammar(Expr1)>,
1789 make_invalid_type>::type,
1790 typename ::boost::mpl::eval_if<
1791 typename proto::matches<Expr2,ActionGrammar>::type,
1792 boost::result_of<ActionGrammar(Expr2)>,
1793 make_invalid_type>::type
1795 build_explicit_entry_state(Expr1 const& ,Expr2 const& )
1797 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1798 typedef typename boost::result_of<ActionGrammar(Expr2)>::type exit_action;
1799 return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,exit_action>();
1802 template <class StateNameTag,int ZoneIndex,class Expr1>
1804 explicit_entry_func_state<
1807 typename ::boost::mpl::eval_if<
1808 typename proto::matches<Expr1,ActionGrammar>::type,
1809 boost::result_of<ActionGrammar(Expr1)>,
1810 make_invalid_type>::type,
1813 build_explicit_entry_state(Expr1 const& )
1815 typedef typename boost::result_of<ActionGrammar(Expr1)>::type entry_action;
1816 return explicit_entry_func_state<StateNameTag,ZoneIndex,entry_action,NoAction>();
1819 template <class StateNameTag,int ZoneIndex>
1821 explicit_entry_func_state<
1827 build_explicit_entry_state()
1829 return explicit_entry_func_state<StateNameTag,ZoneIndex,NoAction,NoAction>();
1836 #endif //BOOST_MSM_FRONT_EUML_STATE_GRAMMAR_H