Chris@16
|
1 // Copyright 2008 Christophe Henry
|
Chris@16
|
2 // henry UNDERSCORE christophe AT hotmail DOT com
|
Chris@16
|
3 // This is an extended version of the state machine available in the boost::mpl library
|
Chris@16
|
4 // Distributed under the same license as the original.
|
Chris@16
|
5 // Copyright for the original version:
|
Chris@16
|
6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
|
Chris@16
|
7 // under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
8 // file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
|
Chris@16
|
12 #define BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/mpl/assert.hpp>
|
Chris@16
|
15
|
Chris@16
|
16 #include <boost/msm/back/metafunctions.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost { namespace msm { namespace back
|
Chris@16
|
19 {
|
Chris@16
|
20 struct mpl_graph_fsm_check
|
Chris@16
|
21 {
|
Chris@16
|
22 typedef int fsm_check;
|
Chris@16
|
23 // checks that regions are truly orthogonal (one state belongs to 1 region)
|
Chris@16
|
24 // using the mpl_graph library (part of metagraph)
|
Chris@16
|
25 template <class Fsm>
|
Chris@16
|
26 static void check_orthogonality()
|
Chris@16
|
27 {
|
Chris@16
|
28 BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_regions_orthogonality<Fsm>::states_in_regions_raw,
|
Chris@16
|
29 ==,
|
Chris@16
|
30 ::boost::msm::back::check_regions_orthogonality<Fsm>::cumulated_states_in_regions_raw );
|
Chris@16
|
31
|
Chris@16
|
32 }
|
Chris@16
|
33 // checks that all states are reachable or created using the explicit_creation typedef
|
Chris@16
|
34 // using the mpl_graph library (part of metagraph)
|
Chris@16
|
35 template <class Fsm>
|
Chris@16
|
36 static void check_unreachable_states()
|
Chris@16
|
37 {
|
Chris@16
|
38 BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_no_unreachable_state<Fsm>::states_in_fsm,
|
Chris@16
|
39 ==,
|
Chris@16
|
40 ::boost::msm::back::check_no_unreachable_state<Fsm>::cumulated_states_in_regions );
|
Chris@16
|
41
|
Chris@16
|
42 }
|
Chris@16
|
43 };
|
Chris@16
|
44
|
Chris@16
|
45 } } }//boost::msm::back
|
Chris@16
|
46
|
Chris@16
|
47
|
Chris@16
|
48 #endif //BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
|