The rfsm::StateMachine class. More...
#include <rfsm.h>
 Inheritance diagram for rfsm::StateMachine:Public Member Functions | |
| StateMachine (bool verbose=false) | |
| StateMachine load and execute a rFSM state machine written in LUA.  More... | |
| virtual | ~StateMachine () | 
| ~StateMachine  More... | |
| const std::string | getFileName () | 
| getFileName  More... | |
| bool | load (const std::string &filename) | 
| loads and initializes a rFSM state machine  More... | |
| bool | run () | 
| run calls rfsm.run()  More... | |
| bool | step (unsigned int n=1) | 
| step calls rfs.step(n)  More... | |
| bool | sendEvent (const std::string &event) | 
| sendEvent calls rfsm.send_events(event)  More... | |
| bool | sendEvents (unsigned int n,...) | 
| sendEvents calls rfsm.send_events(...)  More... | |
| bool | doString (const std::string &command) | 
| doString execute a generic lua command  More... | |
| bool | doFile (const std::string &filename) | 
| doFile execute a lua file  More... | |
| void | addLuaPackagePath (const std::string &path) | 
| addLuaPackagePath add a new path to lua package.path  More... | |
| void | close () | 
| closes the state machine if it is already loaded  More... | |
| bool | setStateCallback (const std::string &state, rfsm::StateCallback &callback) | 
| setStateCallback set an StateCallback object for a given state  More... | |
| const std::string | getCurrentState () | 
| getCurrentState returns the current activated state  More... | |
| const std::vector< std::string > & | getEventsList () | 
| getEventsList retrieves all available events in the state machine  More... | |
| bool | getEventQueue (std::vector< std::string > &equeue) | 
| getEventQueue gets the current events in the rFSM event queue  More... | |
| const rfsm::StateGraph & | getStateGraph () | 
| getStateGraph return the rFSM state graph  More... | |
| bool | enablePreStepHook () | 
| enablePreStepHook enables the pre-step hook function of the rFSM.  More... | |
| bool | enablePostStepHook () | 
| enablePostStepHook enables the post-step hook function of the rFSM.  More... | |
| bool | catchPrintOutput () | 
| catchPrintOutput redirect the output of the lua 'print()' function to rfsm::StateMachine::onInfo()  More... | |
| virtual void | onPreStep () | 
| if pre-step hook function of rFSM is enabled this callback is called before stepping the state machine.  More... | |
| virtual void | onPostStep () | 
| if post-step hook function of rFSM is enabled this callback is called after stepping the state machine.  More... | |
| virtual void | onWarning (const std::string message) | 
| this is called on every warning message generated from rFSM in verbose mode (i.e.  More... | |
| virtual void | onError (const std::string message) | 
| this is called on every error message generated from rFSM  More... | |
| virtual void | onInfo (const std::string message) | 
| this is called on every info message generated from rFSM in verbose mode (i.e.  More... | |
Private Member Functions | |
| virtual void | onTrace (const std::string &message) | 
| onTrace is called on lua traceback  More... | |
Private Attributes | |
| Private *const | mPriv | 
| bool | verbose | 
The rfsm::StateMachine class.
| rfsm::StateMachine::StateMachine | ( | bool | verbose = false | ) | 
StateMachine load and execute a rFSM state machine written in LUA.
| verbose | enable verbosity if it is true. | 
      
  | 
  virtual | 
~StateMachine
| void rfsm::StateMachine::addLuaPackagePath | ( | const std::string & | path | ) | 
addLuaPackagePath add a new path to lua package.path
| path | to a folder containg lua packages | 
| bool rfsm::StateMachine::catchPrintOutput | ( | ) | 
catchPrintOutput redirect the output of the lua 'print()' function to rfsm::StateMachine::onInfo()
| void rfsm::StateMachine::close | ( | ) | 
closes the state machine if it is already loaded
| bool rfsm::StateMachine::doFile | ( | const std::string & | filename | ) | 
doFile execute a lua file
| filename | lua file name to execute | 
| bool rfsm::StateMachine::doString | ( | const std::string & | command | ) | 
doString execute a generic lua command
| command | a string containg a valid lua command | 
| bool rfsm::StateMachine::enablePostStepHook | ( | ) | 
enablePostStepHook enables the post-step hook function of the rFSM.
If it is enabled, then onPostStep() callback will be called after stepping the state machine.
| bool rfsm::StateMachine::enablePreStepHook | ( | ) | 
enablePreStepHook enables the pre-step hook function of the rFSM.
If it is enabled, then onPreStep() callback will be called before stepping the state machine.
| const std::string rfsm::StateMachine::getCurrentState | ( | ) | 
getCurrentState returns the current activated state
| bool rfsm::StateMachine::getEventQueue | ( | std::vector< std::string > & | equeue | ) | 
getEventQueue gets the current events in the rFSM event queue
| equeue | a vector of string to be filled with the current events | 
| const std::vector<std::string>& rfsm::StateMachine::getEventsList | ( | ) | 
getEventsList retrieves all available events in the state machine
| const std::string rfsm::StateMachine::getFileName | ( | ) | 
getFileName
| const rfsm::StateGraph& rfsm::StateMachine::getStateGraph | ( | ) | 
getStateGraph return the rFSM state graph
| bool rfsm::StateMachine::load | ( | const std::string & | filename | ) | 
loads and initializes a rFSM state machine
| filename | rFSM state machine file name | 
      
  | 
  virtual | 
this is called on every error message generated from rFSM
| message | the error message | 
      
  | 
  virtual | 
this is called on every info message generated from rFSM in verbose mode (i.e.
StateMachine(bool verbose=true) )
| message | the info message | 
      
  | 
  virtual | 
if post-step hook function of rFSM is enabled this callback is called after stepping the state machine.
      
  | 
  virtual | 
if pre-step hook function of rFSM is enabled this callback is called before stepping the state machine.
      
  | 
  privatevirtual | 
onTrace is called on lua traceback
| message | the trace message | 
Reimplemented from rfsm::LuaTraceCallback.
      
  | 
  virtual | 
this is called on every warning message generated from rFSM in verbose mode (i.e.
StateMachine(bool verbose=true) )
| message | the warning message | 
| bool rfsm::StateMachine::run | ( | ) | 
run calls rfsm.run()
| bool rfsm::StateMachine::sendEvent | ( | const std::string & | event | ) | 
sendEvent calls rfsm.send_events(event)
| event | a single event to be send to the state machine | 
| bool rfsm::StateMachine::sendEvents | ( | unsigned int | n, | 
| ... | |||
| ) | 
sendEvents calls rfsm.send_events(...)
| n | number of events to be send | 
| ...the | n events given as separate params (e.g. sendEvents(2, "e1", "e2")) | 
| bool rfsm::StateMachine::setStateCallback | ( | const std::string & | state, | 
| rfsm::StateCallback & | callback | ||
| ) | 
setStateCallback set an StateCallback object for a given state
| state | the name of the state (should corespond the state name in rFSM) | 
| callback | an object of StateCallback class | 
| bool rfsm::StateMachine::step | ( | unsigned int | n = 1 | ) | 
step calls rfs.step(n)
| n | number the steps to taken (defaule is 1) | 
 1.8.8