tinyfsm
tinyfsm copied to clipboard
How do you pass a SM to a function?
main()
{
MyStateMachine::start();
gatherInformation();
dispatcherAndDecisionMakingFunction(MyStateMachine );
}
Something like this is what I'd like to accomplish.
TinyFSM state machines are not instances, you can't "pass" them to a function. What you can do is create a function template, something like this:
// declare function
template<typename F>
dispatcherAndDecisionMakingFunction(void) {
F::staticStateMachineFunction(void);
}
// call function
dispatcherAndDecisionMakingFunction<MyStateMachine>();