25 #define luaL_reg luaL_Reg
61 virtual void onTrace(
const std::string& message ) { }
85 return (s.
name == name);
147 bool load(
const std::string& filename);
160 bool step(
unsigned int n=1);
167 bool sendEvent(
const std::string& event);
182 bool doString(
const std::string& command);
189 bool doFile(
const std::string& filename);
282 virtual void onWarning(
const std::string message);
288 virtual void onError(
const std::string message);
295 virtual void onInfo(
const std::string message);
302 virtual void onTrace(
const std::string& message );
306 Private *
const mPriv;
bool doString(const std::string &command)
doString execute a generic lua command
The StateGraph class represents the rFSM state graph in term of states and the transitions among them...
std::vector< State > states
states is a list of all states
StateMachine(bool verbose=false)
StateMachine load and execute a rFSM state machine written in LUA.
const std::vector< std::string > & getEventsList()
getEventsList retrieves all available events in the state machine
const rfsm::StateGraph & getStateGraph()
getStateGraph return the rFSM state graph
virtual void onPreStep()
if pre-step hook function of rFSM is enabled this callback is called before stepping the state machin...
bool operator==(const State &s) const
void addLuaPackagePath(const std::string &path)
addLuaPackagePath add a new path to lua package.path
std::vector< State >::iterator StateItr
virtual void onError(const std::string message)
this is called on every error message generated from rFSM
std::vector< std::string > events
virtual void onTrace(const std::string &message)
onTrace is called on lua traceback
The rfsm::StateMachine class.
virtual void entry()
entry is called on rFSM state.entry
bool operator==(const Transition &s) const
The rfsm::StateCallback class can be used to implement the rFSM state callbacs in c++...
The LuaTraceCallback class.
virtual void exit()
exit is called on rFSM state.exit
void close()
closes the state machine if it is already loaded
virtual void doo()
doo is called on rFSM state.doo
bool setStateCallback(const std::string &state, rfsm::StateCallback &callback)
setStateCallback set an StateCallback object for a given state
std::vector< Transition > transitions
transitions is a list of all transitions
virtual void onWarning(const std::string message)
this is called on every warning message generated from rFSM in verbose mode (i.e. ...
bool getEventQueue(std::vector< std::string > &equeue)
getEventQueue gets the current events in the rFSM event queue
bool catchPrintOutput()
catchPrintOutput redirect the output of the lua 'print()' function to rfsm::StateMachine::onInfo() ...
bool step(unsigned int n=1)
step calls rfs.step(n)
bool sendEvents(unsigned int n,...)
sendEvents calls rfsm.send_events(...)
std::vector< Transition >::iterator TransitionItr
bool doFile(const std::string &filename)
doFile execute a lua file
bool enablePostStepHook()
enablePostStepHook enables the post-step hook function of the rFSM.
const std::string getCurrentState()
getCurrentState returns the current activated state
bool load(const std::string &filename)
loads and initializes a rFSM state machine
virtual ~StateMachine()
~StateMachine
bool sendEvent(const std::string &event)
sendEvent calls rfsm.send_events(event)
const std::string getFileName()
getFileName
bool run()
run calls rfsm.run()
virtual void onInfo(const std::string message)
this is called on every info message generated from rFSM in verbose mode (i.e.
virtual void onTrace(const std::string &message)
onTrace is called on lua traceback
virtual void onPostStep()
if post-step hook function of rFSM is enabled this callback is called after stepping the state machin...
bool enablePreStepHook()
enablePreStepHook enables the pre-step hook function of the rFSM.