qpcpp/doxygen/snippets/qep_qhsm_use.cpp

19 lines
434 B
C++
Raw Normal View History

2019-10-27 12:26:31 -04:00
#include "qep.hpp" // QEP public interface
2015-12-31 14:56:37 -05:00
#include "calc.h" // Calc HSM derived from QHsm
2012-08-14 18:00:48 -04:00
2015-12-31 14:56:37 -05:00
static Calc l_calc; // an instance of Calc HSM
2012-08-14 18:00:48 -04:00
int main() {
2015-12-31 14:56:37 -05:00
l_calc.init(); // trigger initial transition
2012-08-14 18:00:48 -04:00
2015-12-31 14:56:37 -05:00
for (;;) { // event loop
2013-10-10 20:01:51 -04:00
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_calc.dispatch(&e); // dispatch the event
2012-08-14 18:00:48 -04:00
}
return 0;
}