|
fsm 0.4.1
Header-only C++20 hierarchical table-driven FSM
|
One transition-table row: {from, on, when, then, to}. More...
#include <fsm.hpp>

Public Types | |
| using | payload_type = Payload |
| using | reason_type = Reason |
| using | guard_fn = typename detail::fn_sigs< Context, Payload >::guard |
| using | action_fn = typename detail::fn_sigs< Context, Payload >::action |
Public Attributes | |
| from_spec< State > | from |
| Source state or fsm::any (mandatory). | |
| on_spec< Event > | on |
| Trigger event (mandatory). | |
| guard_fn | when = nullptr |
| Optional guard. | |
| action_fn | then = nullptr |
| Optional action. | |
| target< State, Reason > | to |
| Transition/internal/refuse (mandatory). | |
| const char * | label = nullptr |
One transition-table row: {from, on, when, then, to}.
Rows are plain constexpr data: enumerable, dumpable, diagrammable. Matching walks the active state chain leaf → ancestors → fsm::any rows; within a level, table order, first row whose guard passes wins.
| State | state enum (dense, Count sentinel) |
| Event | event enum (dense, Count sentinel) |
| Context | user context passed to guards/actions by reference |
| Payload | optional event payload type (void = none) |
| Reason | refusal reason type |
| using fsm::row< State, Event, Context, Payload, Reason >::action_fn = typename detail::fn_sigs<Context, Payload>::action |
Transition/internal action. nullptr = none.
| using fsm::row< State, Event, Context, Payload, Reason >::guard_fn = typename detail::fn_sigs<Context, Payload>::guard |
Guard: arbitrary predicate over context (+ payload). nullptr = always pass.
| using fsm::row< State, Event, Context, Payload, Reason >::payload_type = Payload |
| using fsm::row< State, Event, Context, Payload, Reason >::reason_type = Reason |
| from_spec<State> fsm::row< State, Event, Context, Payload, Reason >::from |
Source state or fsm::any (mandatory).
| const char* fsm::row< State, Event, Context, Payload, Reason >::label = nullptr |
Optional human-readable note ("why this row exists"), shown by dump() and fsm::write_dot(). Guards/actions are bare function pointers, so this is the only place introspection can find intent.
| on_spec<Event> fsm::row< State, Event, Context, Payload, Reason >::on |
Trigger event (mandatory).
| action_fn fsm::row< State, Event, Context, Payload, Reason >::then = nullptr |
Optional action.
| target<State, Reason> fsm::row< State, Event, Context, Payload, Reason >::to |
Transition/internal/refuse (mandatory).
| guard_fn fsm::row< State, Event, Context, Payload, Reason >::when = nullptr |
Optional guard.