Make the FSM_STATE work better with optional loggins set by a define and standardize on using enum class by default.
This commit is contained in:
parent
8df6898d0b
commit
0aeb5b4ceb
8 changed files with 49 additions and 42 deletions
7
fsm.hpp
7
fsm.hpp
|
@ -2,10 +2,11 @@
|
|||
|
||||
#include <fmt/core.h>
|
||||
|
||||
#define FSM_EV(S, F) case S: F(); break
|
||||
#define FSM_STATE(S, F, E) case S: F(E); break
|
||||
|
||||
#ifndef FSM_DEBUG
|
||||
#define FSM_STATE(C, S, F, E) case C::S: F(E); break
|
||||
#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
|
||||
#endif
|
||||
|
||||
template<typename S, typename E>
|
||||
class DeadSimpleFSM {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue