|
QP/C
|
QFsm_init() implementation. More...
Go to the source code of this file.
Functions | |
| void | QFsm_init (QFsm *me, QEvent const *e) |
| Performs the second step of FSM initialization by triggering the top-most initial transition. | |
QFsm_init() implementation.
Definition in file qfsm_ini.c.
Performs the second step of FSM initialization by triggering the top-most initial transition.
| me | pointer the state machine structure derived from QFsm |
| e | constant pointer the QEvent or a structure derived from QEvent |
The following example illustrates how to initialize a FSM, and dispatch events to it:
#include "qep.h" /* QEP/C public interface */ #include "qbomb.h" /* QBomb FSM derived from QFsm */ static QBomb l_qbomb; /* an instance of QBomb FSM */ int main() { QBombInitEvt ie; /* initialization event for QBomb FSM */ QBomb_ctor(&l_qbomb); /* QBomb FSM "constructor" invokes QFsm_ctor_() */ /* set the initialization event ie */ QFsm_init((QFsm *)&l_qbomb, &ie); /* trigger initial transition */ for (;;) { /* event loop */ QEvent e; . . . /* wait for the next event and assign it to the event object e */ . . . QFsm_dispatch((QFsm *)&l_qbomb, &e); /* dispatch e to l_qbomb */ } return 0; }
Definition at line 40 of file qfsm_ini.c.
References Q_ALLEGE, Q_ENTRY_SIG, Q_RET_TRAN, Q_STATE_CAST, QEP_TRIG_, QS_BEGIN_, QS_CRIT_STAT_, QS_END_, QS_FUN_, QS_OBJ_, QS_QEP_INIT_TRAN, QS_QEP_STATE_INIT, QS_smObj_, and QS_TIME_.
1.7.6.1