Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lfr_state_machine.h 494B

1234567891011121314151617181920
  1. #pragma once
  2. #include "lfr_state_interface.h"
  3. class LFR_StateMachine
  4. {
  5. LFR_IState* currentState;
  6. LFR_StateMachine() = delete;
  7. public:
  8. LFR_StateMachine(LFR_IState& startState){
  9. currentState = &startState;
  10. currentState->enter(this);
  11. }
  12. inline LFR_IState* getCurrentState() const {return currentState;}
  13. void setState(LFR_IState& newState)
  14. {
  15. currentState->exit(this);
  16. currentState = &newState;
  17. currentState->enter(this);
  18. }
  19. };