mpl_graph_fsm_check.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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)
  10. #ifndef BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
  11. #define BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H
  12. #include <boost/mpl/assert.hpp>
  13. #include <boost/msm/back/metafunctions.hpp>
  14. namespace boost { namespace msm { namespace back
  15. {
  16. struct mpl_graph_fsm_check
  17. {
  18. typedef int fsm_check;
  19. // checks that regions are truly orthogonal (one state belongs to 1 region)
  20. // using the mpl_graph library (part of metagraph)
  21. template <class Fsm>
  22. static void check_orthogonality()
  23. {
  24. BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_regions_orthogonality<Fsm>::states_in_regions_raw,
  25. ==,
  26. ::boost::msm::back::check_regions_orthogonality<Fsm>::cumulated_states_in_regions_raw );
  27. }
  28. // checks that all states are reachable or created using the explicit_creation typedef
  29. // using the mpl_graph library (part of metagraph)
  30. template <class Fsm>
  31. static void check_unreachable_states()
  32. {
  33. BOOST_MPL_ASSERT_RELATION( ::boost::msm::back::check_no_unreachable_state<Fsm>::states_in_fsm,
  34. ==,
  35. ::boost::msm::back::check_no_unreachable_state<Fsm>::cumulated_states_in_regions );
  36. }
  37. };
  38. } } }//boost::msm::back
  39. #endif //BOOST_MSM_BACK_MPL_GRAPH_FSM_CHECK_H