diff options
Diffstat (limited to 'boost/msm/back/metafunctions.hpp')
-rw-r--r-- | boost/msm/back/metafunctions.hpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/boost/msm/back/metafunctions.hpp b/boost/msm/back/metafunctions.hpp index a1ffc35616..ae06b08ff5 100644 --- a/boost/msm/back/metafunctions.hpp +++ b/boost/msm/back/metafunctions.hpp @@ -46,6 +46,8 @@ #include <boost/type_traits/is_same.hpp> #include <boost/utility/enable_if.hpp> +#include <boost/msm/row_tags.hpp> + // mpl_graph graph implementation and depth first search #include <boost/msm/mpl_graph/incidence_list_graph.hpp> #include <boost/msm/mpl_graph/depth_first_search.hpp> @@ -202,7 +204,6 @@ struct get_initial_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 @@ -935,6 +936,41 @@ is_exit_state_active(FSM&) return false; } +// transformation metafunction to end interrupt flags +template <class Event> +struct transform_to_end_interrupt +{ + typedef boost::msm::EndInterruptFlag<Event> type; +}; +// transform a sequence of events into another one of EndInterruptFlag<Event> +template <class Events> +struct apply_end_interrupt_flag +{ + typedef typename + ::boost::mpl::transform< + Events,transform_to_end_interrupt< ::boost::mpl::placeholders::_1> >::type type; +}; +// returns a mpl vector containing all end interrupt events if sequence, otherwise the same event +template <class Event> +struct get_interrupt_events +{ + typedef typename ::boost::mpl::eval_if< + ::boost::mpl::is_sequence<Event>, + boost::msm::back::apply_end_interrupt_flag<Event>, + boost::mpl::vector1<boost::msm::EndInterruptFlag<Event> > >::type type; +}; + +template <class Events> +struct build_interrupt_state_flag_list +{ + typedef ::boost::mpl::vector<boost::msm::InterruptedFlag> first_part; + typedef typename ::boost::mpl::insert_range< + first_part, + typename ::boost::mpl::end< first_part >::type, + Events + >::type type; +}; + } } }//boost::msm::back #endif // BOOST_MSM_BACK_METAFUNCTIONS_H |