Provide a possibility to configure an observer for a state_machine back-end's activities, which can be used for logging.
Separate callbacks for actions, guards and state entries/exits would induce high compilation times and provide cluttered logs for lengthy transitions. Such callbacks could also be implemented with base classes for actions, guards and states.
An observer API with transition row callbacks enables state machine activities to be reported in a concise way. Exemplary output:
SmWithObserver starting with event starting
Activated state MyState
SmWithObserver processing event TriggerTransitionWithGuard
Processed transition "MyState + TriggerTransitionWithGuard [ MyGuard ] / MyAction = MyOtherState" (rejected)
SmWithObserver processing event TriggerTransitionWithGuard
Processed transition "MyState + TriggerTransitionWithGuard [ MyGuard ] / MyAction = MyOtherState" (handled)
SmWithObserver processing event TriggerInternalTransition
Processed transition "MyOtherState + TriggerInternalTransition / MyAction" (handled)
SmWithObserver processing event TriggerTransition
Processed transition "MyOtherState + TriggerTransition = MyState" (handled)
SmWithObserver processing event TriggerSmInternalTransition
Processed transition "SmWithObserver + TriggerSmInternalTransition / MyAction" (handled)
SmWithObserver stopping with event stopping
Open points:
- Lifetime management of the observer instance: Inside or outside of the state machine or support both?
- How/if to define initial pseudostate transitions in the API (they are not modeled)?
Provide a possibility to configure an observer for a
state_machineback-end's activities, which can be used for logging.Separate callbacks for actions, guards and state entries/exits would induce high compilation times and provide cluttered logs for lengthy transitions. Such callbacks could also be implemented with base classes for actions, guards and states.
An observer API with transition row callbacks enables state machine activities to be reported in a concise way. Exemplary output:
Open points: