qpcpp/doxygen/snippets/qep_qfsm_use.cpp

20 lines
462 B
C++
Raw Normal View History

2015-12-31 14:56:37 -05:00
#include "qep.h" // QEP public interface
#include "bomb.h" // Bomb FSM derived from QFsm
2012-08-14 18:00:48 -04:00
2015-12-31 14:56:37 -05:00
static Bomb l_bomb; // an instance of QBomb FSM
2012-08-14 18:00:48 -04:00
int main() {
2015-12-31 14:56:37 -05:00
BombInitEvt ie;
2012-08-14 18:00:48 -04:00
2013-10-10 20:01:51 -04:00
l_qbomb.init(&ie); // trigger initial transition
for (;;) { // event loop
QEvt e;
2012-08-14 18:00:48 -04:00
. . .
// wait for the next event and assign it to the event object e
. . .
2015-12-31 14:56:37 -05:00
l_bomb.dispatch(&e); // dispatch the event
2012-08-14 18:00:48 -04:00
}
return 0;
}