Return to Website   
Quantum Leaps Discussion Forum

Search the Forum for answers or post your questions to the
Quantum Leaps community



Return to Website

  Reply
  Forum

Subject:   History pattern without QHsm_getState in QP 4.0 ?
Name:   Anders Eriksson
Date Posted:   Jun 10, 08 - 5:49 AM
Email:   anders.eriksson@alps.se
Message:   Hi Miro,
I am preparing a workshop for my colleagues, where I will go through the 5 design pattern, then I saw that from version 3.5 -> 4.0 the QHsm_getState function has been eliminated, why ?

Now the history pattern in 4.0 is not so nice any more, when one has to repeat setting the doorClosed_history in all the substates


/* start of 3.5 history pattern */
QState ToasterOven_doorClosed(ToasterOven *me, QEvent const *e) {
switch (e->sig) {
case Q_EXIT_SIG: {
/* store the deep history of this state */
me->doorClosed_history = QHsm_getState((QHsm *)me);
return (QState)0;
}

/* start of 4.0 history pattern */
case Q_ENTRY_SIG: {
printf("toasting;");
me->doorClosed_history = (QStateHandler)&ToasterOven_toasting;
return Q_HANDLED();
}

case Q_ENTRY_SIG: {
printf("baking;");
me->doorClosed_history = (QStateHandler)&ToasterOven_baking;
return Q_HANDLED();
}
Replies:    
Re: History pattern without QHsm_getState in QP 4.0 ? by Miro Samek · Jun 10, 08 - 6:30 AM


  Reply
  Forum


powered by Powered by Bravenet bravenet.com