Here is a cheatsheet summing up all functions that take part to the public interface of instantFSM
.
You can also find it at the top of the instantFSM
header file.
StateMachine myMachine( parallelTag
|State
|OnEntry
|OnExit
|OnEvent
|Transition )
: instantiate the FSM
myMachine.enter()
: enter the root state
myMachine.pushEvent(std::string("myEvent"))
: push an event
myMachine.inState(std::string("stateName"))
: returns true of the named state is active
myMachine.leave()
: quit all active states
State(std::string("stateName"), parallelTag
|initialTag
|State
|OnEntry
|OnExit
|OnEvent
|Transition)
: create a state
->
OnEntry( void(void)
|void(StateMachine&) )
: callback triggered when parent state is entered
->OnExit( void(void)
|void(StateMachine&) )
: callback triggered when parent state is exited
->OnEvent( std::string("myEvent"), void(void)
|void(StateMachine&) )
: callback triggered when the event "myEvent" is pushed while the parent state is active.
Transition( OnEvent
|Target
|Action
|Condition )
: add a transition
->
OnEvent( std::string("myEvent") )
: event triggering the transition
->Target( std::string("stateName") )
: state to activate when the transition is realised
->Action( void(void)
|void(StateMachine&) )
: callback triggered after leaving the parent state and before the target state is entered.
->Condition( bool(void)
|bool(StateMachine&) )
: callback preventing the transition from executing when it returns false