Guards, builders and hooks
Callbacks stored in fixed inline buffers, and the order dispatch runs them in.
The table declares which transitions have guards or builders and which states have entry or exit hooks. You register the callbacks with calls such as guard<from, event>() and on_transition<from, event>(), and each call checks that the transition exists and the signature matches.
Dispatch order
- Look up the transition.
- Check that a builder is available.
- Run the guard.
- Run the exit hook.
- Build the target state.
- Replace the current state.
- Run the entry hook.
A guard that rejects an event returns guard_rejected, and the builder doesn't run. A target state with no default constructor and no builder returns no_builder.
Storing callbacks
Callbacks are stored in inline_callable_t, which holds a callable in a fixed buffer of SMALLSM_CALLBACK_CAPACITY bytes (32 by default) with one invoke pointer and one copy, move and destroy pointer. It never allocates. A callable that is too large, over-aligned or non-copyable is a compile error.