1 #ifndef StateMachine_H_INCLUDED 2 #define StateMachine_H_INCLUDED 16 #include <boost/graph/adjacency_list.hpp> 17 #include <boost/graph/graph_utility.hpp> 18 #include <boost/property_tree/ptree.hpp> 19 #include <boost/property_tree/xml_parser.hpp> 20 #include <boost/foreach.hpp> 21 #include <boost/lexical_cast.hpp> 22 #include <boost/graph/graphviz.hpp> 54 typedef boost::adjacency_list<boost::listS, boost::vecS, boost::bidirectionalS, StateProperty, TransitionProperty>
graph_t;
64 typedef graph_t::edge_descriptor
edge_t;
90 std::vector<std::string> possibe_transition_states_,
91 std::vector<std::string> possibe_transitions_)
92 : current_state(current_state_),
93 possibe_transition_states(possibe_transition_states_),
94 possibe_transitions(possibe_transitions_)
109 bool tryTransition(std::string trigger_event_name);
110 bool setCurrentState(std::string current_state);
111 std::vector<std::string> getPossibeTransitionStates();
112 std::vector<std::string> getPossibeTransitions();
113 std::string getCurrentState();
115 void drawStateMachine(std::string dot_filename);
116 std::string getDotString();
119 void addTransition(std::string from_state_name, std::string to_state_name, std::string trigger_event_name);
124 template <
typename Map>
126 template <
typename Map>
130 #endif //StateMachine_H_INCLUDED
State Machine Class using Boost::Graph.
EdgeWriter< Map > edge_writer_(Map &map)
boost::graph_traits< graph_t >::out_edge_iterator out_edge_iterator_t
std::string getName(void *handle)
boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, StateProperty, TransitionProperty > graph_t
Boost::Graph type for State Machine Class.
const std::vector< std::string > possibe_transition_states
Possibe Transition States from the Current State.
std::string trigger_event
State Transition Property for State Machine Class.
StateInfo(std::string current_state_, std::vector< std::string > possibe_transition_states_, std::vector< std::string > possibe_transitions_)
NodeWriter< Map > node_writer_(Map &map, std::string current_state)
const std::vector< std::string > possibe_transitions
Possibe Transitions from the Current State.
GraphWriter graph_writer_
Struct for State Infomation.
graph_t::vertex_descriptor vertex_t
vertex type for State Machine Class (State)
const std::string current_state
Current State.
graph_t::edge_descriptor edge_t
edge type for State Machine Class (State Transition)
State Property for State Machine Class.
boost::graph_traits< graph_t >::adjacency_iterator adjacency_iterator_t