112 lines
3.5 KiB
C++
Raw Normal View History

2022-08-11 15:36:19 -04:00
//$file${.::dpp.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2019-06-18 16:56:56 -04:00
//
// Model: dpp.qm
2019-10-27 12:26:31 -04:00
// File: ${.::dpp.hpp}
2019-06-18 16:56:56 -04:00
//
// This code has been generated by QM 5.3.0 <www.state-machine.com/qm>.
2019-06-18 16:56:56 -04:00
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
//
2022-08-11 15:36:19 -04:00
// SPDX-License-Identifier: GPL-3.0-or-later
2019-06-18 16:56:56 -04:00
//
2022-08-11 15:36:19 -04:00
// This generated code is open source software: you can redistribute it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation.
2019-06-18 16:56:56 -04:00
//
2022-08-11 15:36:19 -04:00
// This code is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// NOTE:
// Alternatively, this generated code may be distributed under the terms
// of Quantum Leaps commercial licenses, which expressly supersede the GNU
// General Public License and are specifically designed for licensees
// interested in retaining the proprietary status of their code.
//
// Contact information:
// <www.state-machine.com/licensing>
// <info@state-machine.com>
//
//$endhead${.::dpp.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#ifndef DPP_HPP_
#define DPP_HPP_
2019-06-18 16:56:56 -04:00
//$declare${Shared} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
namespace APP {
2019-06-18 16:56:56 -04:00
//${Shared::AppSignals} ......................................................
enum AppSignals : QP::QSignal {
EAT_SIG = QP::Q_USER_SIG, // published by Table to let a Philo eat
DONE_SIG, // published by Philo when done eating
2019-06-18 16:56:56 -04:00
PAUSE_SIG, // published by BSP to pause the application
SERVE_SIG, // published by BSP to serve re-start serving forks
TEST_SIG, // published by BSP to test the application
MAX_PUB_SIG, // the last published signal
TIMEOUT_SIG, // posted by time event to Philo
HUNGRY_SIG, // posted by hungry Philo to Table
2019-06-18 16:56:56 -04:00
MAX_SIG // the last signal
};
//${Shared::produce_sig_dict} ................................................
#ifdef Q_SPY
inline void produce_sig_dict() {
QS_SIG_DICTIONARY(EAT_SIG, nullptr);
QS_SIG_DICTIONARY(DONE_SIG, nullptr);
QS_SIG_DICTIONARY(PAUSE_SIG, nullptr);
QS_SIG_DICTIONARY(SERVE_SIG, nullptr);
QS_SIG_DICTIONARY(TEST_SIG, nullptr);
2019-06-18 16:56:56 -04:00
QS_SIG_DICTIONARY(TIMEOUT_SIG, nullptr);
QS_SIG_DICTIONARY(HUNGRY_SIG, nullptr);
}
#endif // def Q_SPY
2019-06-18 16:56:56 -04:00
//${Shared::N_PHILO} .........................................................
constexpr std::uint8_t N_PHILO {5};
//${Shared::TableEvt} ........................................................
2019-06-18 16:56:56 -04:00
class TableEvt : public QP::QEvt {
public:
std::uint8_t philoId;
2019-06-18 16:56:56 -04:00
public:
constexpr TableEvt(
QP::QSignal sig,
std::uint8_t id)
: QEvt(sig),
philoId(id)
{}
#ifdef QEVT_DYN_CTOR
TableEvt(std::uint8_t id)
: QEvt(QP::QEvt::DYNAMIC),
philoId(id)
{}
#endif // def QEVT_DYN_CTOR
}; // class TableEvt
2019-06-18 16:56:56 -04:00
//${Shared::AO_Philo[N_PHILO]} ...............................................
2019-06-18 16:56:56 -04:00
extern QP::QActive * const AO_Philo[N_PHILO];
//${Shared::AO_Table} ........................................................
2019-06-18 16:56:56 -04:00
extern QP::QActive * const AO_Table;
} // namespace APP
//$enddecl${Shared} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2019-06-18 16:56:56 -04:00
#ifdef QXK_HPP_
2019-06-18 16:56:56 -04:00
namespace APP {
2019-06-18 16:56:56 -04:00
extern QP::QXThread * const TH_XThread1;
extern QP::QXThread * const TH_XThread2;
extern QP::QXSemaphore TH_sema;
extern QP::QXMutex TH_mutex;
2019-06-18 16:56:56 -04:00
} // namespace APP
2019-06-18 16:56:56 -04:00
#endif // QXK_HPP_
2022-09-22 11:13:20 -04:00
#endif // DPP_HPP_