Extract the FSM before beginning to use it.

This commit is contained in:
Zed A. Shaw 2024-09-10 00:32:15 -04:00
parent b9025be45b
commit dcf1a4020d
2 changed files with 20 additions and 18 deletions

16
fsm.hpp Normal file
View file

@ -0,0 +1,16 @@
#pragma once
template<typename S, typename E>
class DeadSimpleFSM {
protected:
S _state = S::START;
public:
virtual void event(E event) = 0;
void state(S next_state) {
_state = next_state;
}
};
#define FSM_T(S, F) case S: F(); break