2022-08-11 15:36:19 -04:00
|
|
|
//$file${include::qpcpp.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
|
|
//
|
|
|
|
// Model: qpcpp.qm
|
|
|
|
// File: ${include::qpcpp.hpp}
|
|
|
|
//
|
|
|
|
// This code has been generated by QM 5.2.1 <www.state-machine.com/qm>.
|
|
|
|
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
|
|
|
|
//
|
|
|
|
// This code is covered by the following QP license:
|
|
|
|
// License # : LicenseRef-QL-dual
|
|
|
|
// Issued to : Any user of the QP/C++ real-time embedded framework
|
|
|
|
// Framework(s) : qpcpp
|
|
|
|
// Support ends : 2023-12-31
|
|
|
|
// License scope:
|
|
|
|
//
|
|
|
|
// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
|
2022-04-19 19:23:30 -04:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
|
|
|
|
//
|
|
|
|
// This software is dual-licensed under the terms of the open source GNU
|
|
|
|
// General Public License version 3 (or any later version), or alternatively,
|
|
|
|
// under the terms of one of the closed source Quantum Leaps commercial
|
|
|
|
// licenses.
|
|
|
|
//
|
|
|
|
// The terms of the open source GNU General Public License version 3
|
|
|
|
// can be found at: <www.gnu.org/licenses/gpl-3.0>
|
|
|
|
//
|
|
|
|
// The terms of the closed source Quantum Leaps commercial licenses
|
|
|
|
// can be found at: <www.state-machine.com/licensing>
|
|
|
|
//
|
|
|
|
// Redistributions in source code must retain this top-level comment block.
|
|
|
|
// Plagiarizing this software to sidestep the license obligations is illegal.
|
|
|
|
//
|
|
|
|
// Contact information:
|
2022-08-11 15:36:19 -04:00
|
|
|
// <www.state-machine.com/licensing>
|
2022-04-19 19:23:30 -04:00
|
|
|
// <info@state-machine.com>
|
2022-08-11 15:36:19 -04:00
|
|
|
//
|
|
|
|
//$endhead${include::qpcpp.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
//! @date Last updated on: 2022-07-09
|
|
|
|
//! @version Last updated for: @ref qpcpp_7_0_1
|
2022-04-19 19:23:30 -04:00
|
|
|
//!
|
|
|
|
//! @file
|
|
|
|
//! @brief QP/C++ public interface including backwards-compatibility layer
|
2022-08-11 15:36:19 -04:00
|
|
|
//! @details
|
2022-04-19 19:23:30 -04:00
|
|
|
//! This header file must be included directly or indirectly
|
|
|
|
//! in all application modules (*.cpp files) that use QP/C++.
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2022-08-11 15:36:19 -04:00
|
|
|
#ifndef QPCPP_HPP
|
|
|
|
#define QPCPP_HPP
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
//============================================================================
|
2020-03-17 21:33:58 -04:00
|
|
|
#include "qf_port.hpp" // QF/C++ port from the port directory
|
|
|
|
#include "qassert.h" // QP assertions
|
|
|
|
#ifdef Q_SPY // software tracing enabled?
|
|
|
|
#include "qs_port.hpp" // QS/C++ port from the port directory
|
|
|
|
#else
|
|
|
|
#include "qs_dummy.hpp" // QS/C++ dummy (inactive) interface
|
|
|
|
#endif
|
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
//============================================================================
|
2019-10-27 12:26:31 -04:00
|
|
|
#ifndef QP_API_VERSION
|
|
|
|
|
|
|
|
//! Macro that specifies the backwards compatibility with the
|
|
|
|
//! QP/C++ API version.
|
2022-08-11 15:36:19 -04:00
|
|
|
//!
|
|
|
|
//! @details
|
2022-04-19 19:23:30 -04:00
|
|
|
//! For example, QP_API_VERSION=540 will cause generating the compatibility
|
|
|
|
//! layer with QP/C++ version 5.4.0 and newer, but not older than 5.4.0.
|
|
|
|
//! QP_API_VERSION=0 causes generation of the compatibility layer "from the
|
|
|
|
//! begining of time", which is the maximum backwards compatibilty. This is
|
2022-08-11 15:36:19 -04:00
|
|
|
//! the default.<br>
|
|
|
|
//!
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Conversely, QP_API_VERSION=9999 means that no compatibility layer should
|
|
|
|
//! be generated. This setting is useful for checking if an application
|
|
|
|
//! complies with the latest QP/C++ API.
|
2019-10-27 12:26:31 -04:00
|
|
|
#define QP_API_VERSION 0
|
|
|
|
|
|
|
|
#endif // QP_API_VERSION
|
|
|
|
|
2020-03-17 21:33:58 -04:00
|
|
|
// QP/C++ API compatibility layer...
|
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
#if (QP_API_VERSION < 700)
|
|
|
|
|
|
|
|
//! @deprecated plain 'char' is no longer forbidden in MISRA/AUTOSAR-C++
|
|
|
|
using char_t = char;
|
|
|
|
|
|
|
|
//============================================================================
|
2020-10-01 12:50:17 -04:00
|
|
|
#if (QP_API_VERSION < 691)
|
|
|
|
|
|
|
|
//! @deprecated enable the QS global filter
|
|
|
|
#define QS_FILTER_ON(rec_) QS_GLB_FILTER((rec_))
|
|
|
|
|
|
|
|
//! @deprecated disable the QS global filter
|
|
|
|
#define QS_FILTER_OFF(rec_) QS_GLB_FILTER(-(rec_))
|
|
|
|
|
|
|
|
//! @deprecated enable the QS local filter for SM (state machine) object
|
|
|
|
#define QS_FILTER_SM_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
|
|
|
|
//! @deprecated enable the QS local filter for AO (active objects)
|
|
|
|
#define QS_FILTER_AO_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
|
|
|
|
//! @deprecated enable the QS local filter for MP (memory pool) object
|
|
|
|
#define QS_FILTER_MP_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
|
|
|
|
//! @deprecated enable the QS local filter for EQ (event queue) object
|
|
|
|
#define QS_FILTER_EQ_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
|
|
|
|
//! @deprecated enable the QS local filter for TE (time event) object
|
|
|
|
#define QS_FILTER_TE_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
|
|
|
|
#ifdef Q_SPY
|
|
|
|
|
2022-08-11 15:36:19 -04:00
|
|
|
//! @deprecated local Filter for a generic application object `obj_`.
|
2020-10-01 12:50:17 -04:00
|
|
|
#define QS_FILTER_AP_OBJ(obj_) \
|
|
|
|
(QP::QS::priv_.locFilter_AP = (obj_))
|
|
|
|
|
|
|
|
//! @deprecated begin of a user QS record, instead use QS_BEGIN_ID()
|
|
|
|
#define QS_BEGIN(rec_, obj_) \
|
|
|
|
if (QS_GLB_FILTER_(rec_) && \
|
|
|
|
((QP::QS::priv_.locFilter[QP::QS::AP_OBJ] == nullptr) \
|
|
|
|
|| (QP::QS::priv_.locFilter_AP == (obj_)))) \
|
|
|
|
{ \
|
|
|
|
QS_CRIT_STAT_ \
|
|
|
|
QS_CRIT_E_(); \
|
|
|
|
QP::QS::beginRec_(static_cast<std::uint_fast8_t>(rec_)); \
|
|
|
|
QS_TIME_PRE_();
|
|
|
|
|
|
|
|
//! @deprecated output hex-formatted std::uint32_t to the QS record
|
|
|
|
#define QS_U32_HEX(width_, data_) \
|
|
|
|
(QP::QS::u32_fmt_(static_cast<std::uint8_t>( \
|
|
|
|
(static_cast<std::uint8_t>((width_) << 4)) \
|
|
|
|
| static_cast<std::uint8_t>(0xFU)), (data_)))
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define QS_FILTER_AP_OBJ(obj_) (static_cast<void>(0))
|
|
|
|
#define QS_BEGIN(rec_, obj_) if (false) {
|
2022-08-11 15:36:19 -04:00
|
|
|
#define QS_U32_HEX(width_, data_) (Q_UNUSED_PAR(0))
|
2020-10-01 12:50:17 -04:00
|
|
|
|
2022-08-11 15:36:19 -04:00
|
|
|
#endif // def Q_SPY
|
2020-10-01 12:50:17 -04:00
|
|
|
|
2022-04-19 19:23:30 -04:00
|
|
|
//============================================================================
|
2020-03-17 21:33:58 -04:00
|
|
|
#if (QP_API_VERSION < 680)
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to specify a transition in the "me->" impl-strategy.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! you call tran(Q_STATE_CAST(target_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define Q_TRAN(target_) (me->tran(Q_STATE_CAST(target_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to specify a tran-to-history in the "me->" impl-strategy.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! you call tran_hist(Q_STATE_CAST(hist_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define Q_TRAN_HIST(hist_) (me->tran_hist((hist_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to specify the superstate in the "me->" impl-strategy.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! you call super(state_)).
|
|
|
|
#define Q_SUPER(state_) (me->super(Q_STATE_CAST(state_)))
|
2020-03-17 21:33:58 -04:00
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state entry-handler. Applicable only to QMSMs.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_entry(Q_STATE_CAST(state_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_ENTRY(state_) (me->qm_entry((state_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state exit-handler. Applicable only to QMSMs.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_exit(Q_STATE_CAST(state_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_EXIT(state_) (me->qm_exit((state_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM submachine exit-handler. Applicable only to QMSMs.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_sm_exit(Q_STATE_CAST(state_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_SM_EXIT(state_) (me->qm_sm_exit((state_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state-handler when it executes a transition.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_tran((tatbl_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_TRAN(tatbl_) (me->qm_tran((tatbl_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state-handler when it executes an initial tran.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_tran_init((tatbl_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_TRAN_INIT(tatbl_) (me->qm_tran_init((tatbl_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state-handler when it executes a tran-to-history.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_tran_hist((history_), (tatbl_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_TRAN_HIST(history_, tatbl_) \
|
|
|
|
(me->qm_tran_hist((history_), (tatbl_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state-handler when it executes an initial tran.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_tran_ep((tatbl_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_TRAN_EP(tatbl_) (me->qm_tran_ep((tatbl_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Macro to call in a QM state-handler when it executes a tran-to-exit-point.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_tran_xp((xp_), (tatbl_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_TRAN_XP(xp_, tatbl_) (me->qm_tran_xp((xp_), (tatbl_)))
|
|
|
|
|
|
|
|
//! @deprecated
|
|
|
|
//! Designates the superstate of a given state in a subclass of QP::QMsm.
|
2022-04-19 19:23:30 -04:00
|
|
|
//! Instead use the new impl-strategy without the "me->" pointer, where
|
|
|
|
//! the QM-generated code calls qm_super_sub((state_)).
|
2020-03-17 21:33:58 -04:00
|
|
|
#define QM_SUPER_SUB(state_) (me->qm_super_sub((state_)))
|
|
|
|
|
|
|
|
#endif // QP_API_VERSION < 680
|
2020-10-01 12:50:17 -04:00
|
|
|
#endif // QP_API_VERSION < 691
|
2022-04-19 19:23:30 -04:00
|
|
|
#endif // QP_API_VERSION < 700
|
2019-10-27 12:26:31 -04:00
|
|
|
|
2022-08-11 15:36:19 -04:00
|
|
|
#endif // QPCPP_HPP
|