1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef BOOST_MSM_BACK_TOOLS_H
- #define BOOST_MSM_BACK_TOOLS_H
- #include <string>
- #include <iostream>
- #include <boost/msm/back/common_types.hpp>
- #include <boost/msm/back/metafunctions.hpp>
- namespace boost { namespace msm { namespace back
- {
- template <class stt>
- struct fill_state_names
- {
- fill_state_names(char const** names):m_names(names){}
- template <class StateType>
- void operator()(boost::msm::wrap<StateType> const&)
- {
- m_names[get_state_id<stt,StateType>::value]= typeid(StateType).name();
- }
- private:
- char const** m_names;
- };
- template <class stt>
- struct get_state_name
- {
- get_state_name(std::string& name_to_fill, int state_id):m_name(name_to_fill),m_state_id(state_id){}
- template <class StateType>
- void operator()(boost::msm::wrap<StateType> const&)
- {
- if (get_state_id<stt,StateType>::value == m_state_id)
- {
- m_name = typeid(StateType).name();
- }
- }
- private:
- std::string& m_name;
- int m_state_id;
- };
- struct display_type
- {
- template <class Type>
- void operator()(boost::msm::wrap<Type> const&)
- {
- std::cout << typeid(Type).name() << std::endl;
- }
- };
- } } }
- #endif
|