[Qt-interest] Resolving nearly orthogonal paralle states
Neil Eccles
neil.eccles at cambridgeflowsolutions.com
Wed May 19 14:44:30 CEST 2010
Can anyone help a state machine user newbie.
I have an app that needs to enable a widget depending on the current state
of two orthogonal states:-
i.e. I have two parallel states each with a true false states in side them
Qstate *top = new QState(::ParallelStates);
Qstate *a = new QState(top);
QState *b = newQState(top);
Qstate *aTrue = new QState(a);
Qstate *aFalse = new QState(a);
Qstate *bTrue = new QState(b);
Qstate *bFalse = new QState(b);
Also the intial states are
a->intialState(aFalse);
b->initialState(bFalse);
The truth table for the widget to be enabled is
B:True B:False
A:True enabled false
A:False false false
I am trying to work out how to use the state machine to look after setting
the enable/disabled for this widget.
Ideas I have had so far include:-
1.Having one state engine with the combinations of a and b as unique states
ie aTrue and bTrue; aFalse and bTrue but this seems bad coding from a
scaling up principle
2 Creating two properties inside the widget and setting these when the
states transition and letting the widget decide if it is enabled or disabled
(this seems to be moving the state engine mechanics into the widget and
hiding it, however it could be argued that it is encapsulating it exactly
where it is needed).
3. put a third parallel state with widgetEnabled and WidgetDisabled and
trying to use guarded transitions. However, I believe that the transition
guard will be dependent on the other parallel state for example going from
state aFalse to aTrue should only cause a transition to widgetEnabled if
bTrue is also set.
Or am I just missing the point and going around in circles?
Finally, I suspect that I am not looking at the state diagram from the
right angle and will become very clear if the diagram is massaged.
Thanks
Neil Eccles
--
Dr. Neil C. Eccles
Senior Product Engineer
CFS is Exhibiting at ASME Turbo Expo in Glasgow, 15-17 June 2010 on Booth
346.
Cambridge Flow Solutions is the power behind Boxer, the revolutionary mesh
generation system designed for today's most challenging CAE applications to
deliver results fast and automated within your workflow.
Come and see what Boxer can do for you! Email
<mailto:Mary.Aldridge at CambridgeFlowSolutions.com>
Mary.Aldridge at CambridgeFlowSolutions.com and pre-book a private Boxer
demonstration during the conference, or visit our Booth during the Expo,
where we would be pleased to discuss your requirements.
This communication contains information which is confidential and which may
also be privileged. It is for the exclusive use and attention of the
intended addressee. If you are not the intended addressee then please note
that any distribution reproduction copying publication or other use of this
communication or the information contained within it is prohibited.
If you have received this communication in error then please accept our
apology.
webmaster at cambridgeflowsolutions.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100519/39966188/attachment.html
More information about the Qt-interest-old
mailing list