state-handler: #6 add state controller functions

- HandleState to set an event of the state
- SetState to update current state to new
This commit is contained in:
Vasily Davydov
2022-10-05 15:02:02 +03:00
parent 955a9750b3
commit 2b2ffb6dcf
2 changed files with 25 additions and 0 deletions

View File

@@ -25,3 +25,14 @@ int StateHandler::getSetSpeed(){
// TODO
return 0;
}
void StateHandler::HandleState(const Event &event){
(this->*current)(event);
}
void StateHandler::SetState(state_pointer newstate){
(this->*current)(Event(Event::eExit));
current = newstate;
(this->*current)(Event(Event::eEnter));
}