Extract the FSM before beginning to use it.
This commit is contained in:
parent
b9025be45b
commit
dcf1a4020d
2 changed files with 20 additions and 18 deletions
16
fsm.hpp
Normal file
16
fsm.hpp
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue