Public Member Functions | Private Member Functions | Private Attributes | List of all members
StateMachine Class Reference

State Machine Class using Boost::Graph. More...

#include <state_machine.h>

Public Member Functions

void drawStateMachine (std::string dot_filename)
 Function saving state machine in .dot format. More...
 
std::string getCurrentState ()
 Function getting current state name. More...
 
std::string getDotString ()
 Function getting dot string which describe state machine in std::string format. More...
 
std::string getName ()
 get name of the state machine More...
 
std::vector< std::string > getPossibeTransitions ()
 Function for getting possible transition trigger event. More...
 
std::vector< std::string > getPossibeTransitionStates ()
 Function for getting possible transition states. More...
 
StateInfo getStateInfo ()
 Function getting current state info. More...
 
bool setCurrentState (std::string current_state)
 Function for setting Current State Infomation. More...
 
 StateMachine (std::string xml_string)
 Construct a new State Machine:: State Machine object. More...
 
bool tryTransition (std::string trigger_event_name)
 Try transition from trigger event. More...
 
 ~StateMachine ()
 Destroy the State Machine:: State Machine object. More...
 

Private Member Functions

void addTransition (std::string from_state_name, std::string to_state_name, std::string trigger_event_name)
 add Transition function for the State Machine More...
 
template<typename Map >
EdgeWriter< Map > edge_writer_ (Map &map)
 
template<typename Map >
NodeWriter< Map > node_writer_ (Map &map, std::string current_state)
 

Private Attributes

vertex_t current_state_
 
GraphWriter graph_writer_
 
std::mutex mtx_
 
std::string name_
 
graph_t state_graph_
 

Detailed Description

State Machine Class using Boost::Graph.

Definition at line 104 of file state_machine.h.

Constructor & Destructor Documentation

StateMachine::StateMachine ( std::string  xml_string)

Construct a new State Machine:: State Machine object.

Parameters
xml_stringXML string for the RostateMachine Definition

Definition at line 21 of file state_machine.cpp.

StateMachine::~StateMachine ( )

Destroy the State Machine:: State Machine object.

Definition at line 57 of file state_machine.cpp.

Member Function Documentation

void StateMachine::addTransition ( std::string  from_state_name,
std::string  to_state_name,
std::string  trigger_event_name 
)
private

add Transition function for the State Machine

Parameters
from_state_namestate transition from
to_state_namestate transition to
trigger_event_nametrigger event

Definition at line 101 of file state_machine.cpp.

void StateMachine::drawStateMachine ( std::string  dot_filename)

Function saving state machine in .dot format.

Parameters
dot_filenamefilename of the .dot file (saved in rostate_machine/data/<dot_filename>.dot)

Definition at line 297 of file state_machine.cpp.

template<typename Map >
EdgeWriter<Map> StateMachine::edge_writer_ ( Map &  map)
inlineprivate

Definition at line 127 of file state_machine.h.

std::string StateMachine::getCurrentState ( )

Function getting current state name.

Returns
std::string current state name

Definition at line 273 of file state_machine.cpp.

std::string StateMachine::getDotString ( )

Function getting dot string which describe state machine in std::string format.

Returns
std::string dot string which describe state machine in std::string format

Definition at line 283 of file state_machine.cpp.

std::string StateMachine::getName ( )

get name of the state machine

Returns
std::string name of the state machine

Definition at line 66 of file state_machine.cpp.

std::vector< std::string > StateMachine::getPossibeTransitions ( )

Function for getting possible transition trigger event.

Returns
std::vector<std::string> get possible trigger event

Definition at line 196 of file state_machine.cpp.

std::vector< std::string > StateMachine::getPossibeTransitionStates ( )

Function for getting possible transition states.

Returns
std::vector<std::string> possible transition states

Definition at line 178 of file state_machine.cpp.

StateInfo StateMachine::getStateInfo ( )

Function getting current state info.

Returns
StateInfo current state info

Definition at line 246 of file state_machine.cpp.

template<typename Map >
NodeWriter<Map> StateMachine::node_writer_ ( Map &  map,
std::string  current_state 
)
inlineprivate

Definition at line 125 of file state_machine.h.

bool StateMachine::setCurrentState ( std::string  current_state)

Function for setting Current State Infomation.

Parameters
current_statetarget state
Returns
true Succeed to set state
false Failed to set state

Definition at line 78 of file state_machine.cpp.

bool StateMachine::tryTransition ( std::string  trigger_event_name)

Try transition from trigger event.

Parameters
trigger_event_nametrigger event name
Returns
true Succeed to transition
false Failed to transition

Definition at line 216 of file state_machine.cpp.

Member Data Documentation

vertex_t StateMachine::current_state_
private

Definition at line 122 of file state_machine.h.

GraphWriter StateMachine::graph_writer_
private

Definition at line 128 of file state_machine.h.

std::mutex StateMachine::mtx_
private

Definition at line 120 of file state_machine.h.

std::string StateMachine::name_
private

Definition at line 123 of file state_machine.h.

graph_t StateMachine::state_graph_
private

Definition at line 121 of file state_machine.h.


The documentation for this class was generated from the following files:


rostate_machine
Author(s):
autogenerated on Wed Sep 4 2019 05:19:52