QP/C++  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qpcpp.hpp
Go to the documentation of this file.
1//$file${include::qpcpp.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpcpp.qm
4// File: ${include::qpcpp.hpp}
5//
6// This code has been generated by QM 6.1.1 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// This code is covered by the following QP license:
10// License # : LicenseRef-QL-dual
11// Issued to : Any user of the QP/C++ real-time embedded framework
12// Framework(s) : qpcpp
13// Support ends : 2024-12-31
14// License scope:
15//
16// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17//
18// Q u a n t u m L e a P s
19// ------------------------
20// Modern Embedded Software
21//
22// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
23//
24// This software is dual-licensed under the terms of the open source GNU
25// General Public License version 3 (or any later version), or alternatively,
26// under the terms of one of the closed source Quantum Leaps commercial
27// licenses.
28//
29// The terms of the open source GNU General Public License version 3
30// can be found at: <www.gnu.org/licenses/gpl-3.0>
31//
32// The terms of the closed source Quantum Leaps commercial licenses
33// can be found at: <www.state-machine.com/licensing>
34//
35// Redistributions in source code must retain this top-level comment block.
36// Plagiarizing this software to sidestep the license obligations is illegal.
37//
38// Contact information:
39// <www.state-machine.com/licensing>
40// <info@state-machine.com>
41//
42//$endhead${include::qpcpp.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QPCPP_HPP_
44#define QPCPP_HPP_
45
46//============================================================================
47#include "qp_port.hpp" // QP port from the port directory
48#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
49#ifdef Q_SPY // software tracing enabled?
50 #include "qs_port.hpp" // QS/C++ port from the port directory
51#else
52 #include "qs_dummy.hpp" // QS/C++ dummy (inactive) interface
53#endif
54
55//============================================================================
56#ifndef QP_API_VERSION
57
58#define QP_API_VERSION 0
59
60#endif // QP_API_VERSION
61
62//============================================================================
63// QP/C++ API compatibility layer...
64
65#if (QP_API_VERSION < 730)
66
67//! @deprecated plain 'char' is no longer forbidden in MISRA/AUTOSAR-C++
68using char_t = char;
69
70//! @deprecated assertion failure handler
71//! Use Q_onError() instead.
72#define Q_onAssert(module_, id_) Q_onError(module_, id_)
73
74//! @deprecated #Q_NASSERT preprocessor switch to disable QP assertions
75#ifdef Q_NASSERT
76
77 // #Q_UNSAFE now replaces the functionality of Q_NASSERT
78 #define Q_UNSAFE
79
80 //! @deprecated general purpose assertion with user-specified ID
81 //! number that **always** evaluates the `expr_` expression.
82 #define Q_ALLEGE_ID(id_, expr_) ((void)(expr_))
83
84#else // QP FuSa Subsystem enabled
85
86 //! @deprecated general purpose assertion with user-specified ID
87 //! number that **always** evaluates the `expr_` expression.
88 //! @note
89 //! The use of this macro is no longer recommended.
90 #define Q_ALLEGE_ID(id_, expr_) if (!(expr_)) { \
91 QF_CRIT_STAT \
92 QF_CRIT_ENTRY(); \
93 Q_onError(&Q_this_module_[0], (id_)); \
94 QF_CRIT_EXIT(); \
95 } else ((void)0)
96
97#endif
98
99//! @deprecated general purpose assertion without ID number
100//! that **always** evaluates the `expr_` expression.
101//! Instead of ID number, this macro is based on the standard
102//! `__LINE__` macro.
103//!
104//! @note The use of this macro is no longer recommended.
105#define Q_ALLEGE(expr_) Q_ALLEGE_ID(__LINE__, (expr_))
106
107//! Static (compile-time) assertion.
108//!
109//! @deprecated
110//! Use Q_ASSERT_STATIC() or better yet `static_assert()` instead.
111//!
112#define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_)
113
114//! @deprecated use QP::QF::NO_MARGIN instead
115#define QF_NO_MARGIN QP::QF::NO_MARGIN
116
117//============================================================================
118#if (QP_API_VERSION < 691)
119
120//! @deprecated enable the QS global filter
121#define QS_FILTER_ON(rec_) QS_GLB_FILTER((rec_))
122
123//! @deprecated disable the QS global filter
124#define QS_FILTER_OFF(rec_) QS_GLB_FILTER(-(rec_))
125
126//! @deprecated enable the QS local filter for SM (state machine) object
127#define QS_FILTER_SM_OBJ(obj_) (static_cast<void>(0))
128
129//! @deprecated enable the QS local filter for AO (active objects)
130#define QS_FILTER_AO_OBJ(obj_) (static_cast<void>(0))
131
132//! @deprecated enable the QS local filter for MP (memory pool) object
133#define QS_FILTER_MP_OBJ(obj_) (static_cast<void>(0))
134
135//! @deprecated enable the QS local filter for EQ (event queue) object
136#define QS_FILTER_EQ_OBJ(obj_) (static_cast<void>(0))
137
138//! @deprecated enable the QS local filter for TE (time event) object
139#define QS_FILTER_TE_OBJ(obj_) (static_cast<void>(0))
140
141#ifdef Q_SPY
142
143//! @deprecated local Filter for a generic application object `obj_`.
144#define QS_FILTER_AP_OBJ(obj_) \
145 (QP::QS::filt_.loc_AP = (obj_))
146
147//! @deprecated begin of a user QS record, instead use QS_BEGIN_ID()
148#define QS_BEGIN(rec_, obj_) \
149 if (QS_GLB_FILTER_(rec_) && \
150 ((QP::QS::filt_.loc[QP::QS::AP_OBJ] == nullptr) \
151 || (QP::QS::filt_.loc_AP == (obj_)))) \
152 { \
153 QS_CRIT_STAT \
154 QS_CRIT_ENTRY(); \
155 QP::QS::beginRec_(static_cast<std::uint_fast8_t>(rec_)); \
156 QS_TIME_PRE_();
157
158//! @deprecated output hex-formatted std::uint32_t to the QS record
159#define QS_U32_HEX(width_, data_) \
160 (QP::QS::u32_fmt_(static_cast<std::uint8_t>( \
161 (static_cast<std::uint8_t>((width_) << 4)) | QS_HEX_FMT), (data_)))
162
163#else
164
165#define QS_FILTER_AP_OBJ(obj_) (static_cast<void>(0))
166#define QS_BEGIN(rec_, obj_) if (false) {
167#define QS_U32_HEX(width_, data_) (Q_UNUSED_PAR(0))
168
169#endif // def Q_SPY
170
171//============================================================================
172#if (QP_API_VERSION < 680)
173
174//! @deprecated
175//! Macro to specify a tran. in the "me->" impl-strategy.
176//! Instead use the new impl-strategy without the "me->" pointer, where
177//! you call tran(Q_STATE_CAST(target_)).
178#define Q_TRAN(target_) (me->tran(Q_STATE_CAST(target_)))
179
180//! @deprecated
181//! Macro to specify a tran-to-history in the "me->" impl-strategy.
182//! Instead use the new impl-strategy without the "me->" pointer, where
183//! you call tran_hist(Q_STATE_CAST(hist_)).
184#define Q_TRAN_HIST(hist_) (me->tran_hist((hist_)))
185
186//! @deprecated
187//! Macro to specify the superstate in the "me->" impl-strategy.
188//! Instead use the new impl-strategy without the "me->" pointer, where
189//! you call super(state_)).
190#define Q_SUPER(state_) (me->super(Q_STATE_CAST(state_)))
191
192//! @deprecated
193//! Macro to call in a QM state entry-handler. Applicable only to QMSMs.
194//! Instead use the new impl-strategy without the "me->" pointer, where
195//! the QM-generated code calls qm_entry(Q_STATE_CAST(state_)).
196#define QM_ENTRY(state_) (me->qm_entry((state_)))
197
198//! @deprecated
199//! Macro to call in a QM state exit-handler. Applicable only to QMSMs.
200//! Instead use the new impl-strategy without the "me->" pointer, where
201//! the QM-generated code calls qm_exit(Q_STATE_CAST(state_)).
202#define QM_EXIT(state_) (me->qm_exit((state_)))
203
204//! @deprecated
205//! Macro to call in a QM submachine exit-handler. Applicable only to QMSMs.
206//! Instead use the new impl-strategy without the "me->" pointer, where
207//! the QM-generated code calls qm_sm_exit(Q_STATE_CAST(state_)).
208#define QM_SM_EXIT(state_) (me->qm_sm_exit((state_)))
209
210//! @deprecated
211//! Macro to call in a QM state-handler when it executes a tran.
212//! Instead use the new impl-strategy without the "me->" pointer, where
213//! the QM-generated code calls qm_tran((tatbl_)).
214#define QM_TRAN(tatbl_) (me->qm_tran((tatbl_)))
215
216//! @deprecated
217//! Macro to call in a QM state-handler when it executes an initial tran.
218//! Instead use the new impl-strategy without the "me->" pointer, where
219//! the QM-generated code calls qm_tran_init((tatbl_)).
220#define QM_TRAN_INIT(tatbl_) (me->qm_tran_init((tatbl_)))
221
222//! @deprecated
223//! Macro to call in a QM state-handler when it executes a tran-to-history.
224//! Instead use the new impl-strategy without the "me->" pointer, where
225//! the QM-generated code calls qm_tran_hist((history_), (tatbl_)).
226#define QM_TRAN_HIST(history_, tatbl_) \
227 (me->qm_tran_hist((history_), (tatbl_)))
228
229//! @deprecated
230//! Macro to call in a QM state-handler when it executes an initial tran.
231//! Instead use the new impl-strategy without the "me->" pointer, where
232//! the QM-generated code calls qm_tran_ep((tatbl_)).
233#define QM_TRAN_EP(tatbl_) (me->qm_tran_ep((tatbl_)))
234
235//! @deprecated
236//! Macro to call in a QM state-handler when it executes a tran-to-exit-point.
237//! Instead use the new impl-strategy without the "me->" pointer, where
238//! the QM-generated code calls qm_tran_xp((xp_), (tatbl_)).
239#define QM_TRAN_XP(xp_, tatbl_) (me->qm_tran_xp((xp_), (tatbl_)))
240
241//! @deprecated
242//! Designates the superstate of a given state in a subclass of QP::QMsm.
243//! Instead use the new impl-strategy without the "me->" pointer, where
244//! the QM-generated code calls qm_super_sub((state_)).
245#define QM_SUPER_SUB(state_) (me->qm_super_sub((state_)))
246
247#endif // QP_API_VERSION < 680
248#endif // QP_API_VERSION < 691
249#endif // QP_API_VERSION < 700
250
251#endif // QPCPP_HPP_
Sample QP/C++ port.
char char_t
Definition qpcpp.hpp:68
QS/C++ port to a 32-bit CPU, generic C++ compiler.
QP Functional Safety (FuSa) Subsystem.