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 f95c15e13c
commit 69d767a73e
2 changed files with 74 additions and 60 deletions

View File

@@ -61,3 +61,14 @@ StateHandler::SetState (state_pointer newstate)
current = newstate;
(this->*current) (Event (Event::eEnter));
}
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));
}