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.
17 lines
249 B
17 lines
249 B
4 weeks ago
|
#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
|