File indexing completed on 2025-01-18 09:41:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_MSM_BACK_TOOLS_H
0012 #define BOOST_MSM_BACK_TOOLS_H
0013
0014
0015 #include <string>
0016 #include <iostream>
0017 #include <boost/msm/back/common_types.hpp>
0018 #include <boost/msm/back/metafunctions.hpp>
0019
0020 namespace boost { namespace msm { namespace back
0021 {
0022
0023
0024
0025
0026 template <class stt>
0027 struct fill_state_names
0028 {
0029 fill_state_names(char const** names):m_names(names){}
0030 template <class StateType>
0031 void operator()(boost::msm::wrap<StateType> const&)
0032 {
0033 m_names[get_state_id<stt,StateType>::value]= typeid(StateType).name();
0034 }
0035 private:
0036 char const** m_names;
0037 };
0038
0039
0040 template <class stt>
0041 struct get_state_name
0042 {
0043 get_state_name(std::string& name_to_fill, int state_id):m_name(name_to_fill),m_state_id(state_id){}
0044 template <class StateType>
0045 void operator()(boost::msm::wrap<StateType> const&)
0046 {
0047 if (get_state_id<stt,StateType>::value == m_state_id)
0048 {
0049 m_name = typeid(StateType).name();
0050 }
0051 }
0052 private:
0053 std::string& m_name;
0054 int m_state_id;
0055 };
0056
0057
0058 struct display_type
0059 {
0060 template <class Type>
0061 void operator()(boost::msm::wrap<Type> const&)
0062 {
0063 std::cout << typeid(Type).name() << std::endl;
0064 }
0065 };
0066
0067 } } }
0068 #endif