|
|
@ -5,7 +5,7 @@ |
|
|
|
#ifndef FSM_DEBUG |
|
|
|
#ifndef FSM_DEBUG |
|
|
|
#define FSM_STATE(C, S, F, E) case C::S: F(E); break |
|
|
|
#define FSM_STATE(C, S, F, E) case C::S: F(E); break |
|
|
|
#else |
|
|
|
#else |
|
|
|
#define FSM_STATE_LOG(C, S, F, E) case C::S: fmt::println(">> " #C " " #S ":" #F " event={}, state={}", int(E), int(_state)); F(E); fmt::println("<< " #C " state={}", int(_state)); break |
|
|
|
#define FSM_STATE(C, S, F, E) case C::S: fmt::println(">> " #C " " #S ":" #F " event={}, state={}", int(E), int(_state)); F(E); fmt::println("<< " #C " state={}", int(_state)); break |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
template<typename S, typename E> |
|
|
|
template<typename S, typename E> |
|
|
@ -18,7 +18,6 @@ public: |
|
|
|
virtual void event(E event) = 0; |
|
|
|
virtual void event(E event) = 0; |
|
|
|
|
|
|
|
|
|
|
|
void state(S next_state) { |
|
|
|
void state(S next_state) { |
|
|
|
// fmt::println("STATE {}->{}", int(_state), int(next_state));
|
|
|
|
|
|
|
|
_state = next_state; |
|
|
|
_state = next_state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|