qpcpp/doxygen/snippets/qf_qmactive.cpp
MMS 34cdcc7929 7.0.0rc1
major release 7.0.0 release candidate 1
2022-04-19 19:23:30 -04:00

21 lines
641 B
C++

class Philo : public QP::QMActive { // inherits QP::QMActive
private:
QTimeEvt m_timeEvt; // to timeout thining or eating
std::uint8_t m_num; // number of this philosopher
public:
Philo::Philo() // constructor
: QMActive(&initial), // superclass' constructor
m_timeEvt(TIMEOUT_SIG, this, 0U)
{}
protected:
// NOTE: QMsm state machine code is not intended for manual
// coding but rather needs to be generated automatically by
// the QM modeling tool
QM_STATE_DECL(initial);
QM_STATE_DECL(thinking);
QM_STATE_DECL(hungry);
QM_STATE_DECL(eating);
};