Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.7.0
-
None
Description
A state machine based component should be able to catch external events or signals which trigger no transitions (i.e. no micro steps, empty macro step).
For example, a signal-based command interface might demand a negative acknowledgement, if the state machine is not in the expected configuration.
One way would be to add target-less transitions to the top state, so they can trigger the negative acknowledgement as a fallback. But if parallel children are present (orthogonal regions in XML jargon), all of them inherit the target-less transition and it doesn't work like this anymore.
Using a combination of existing internal and private interfaces is also ruled out for obvious reasons:
void QStateMachine::beginSelectTransitions(QEvent *event)
void QStateMachinePrivate::processedPendingEvents(bool didChange)
I suggest an appropriate method which can be adapted in a subclass, e.g.:
QStateMachine::processUnconsumedEvent( QEvent *event )
See also:
http://www.boost.org/doc/libs/1_46_1/libs/statechart/doc/reference.html#unconsumed_event
http://stackoverflow.com/questions/8327906/catching-discarded-events-in-boost-statechart-library