QP/C++  8.0.0
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 7.0.0 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
10//
11// Q u a n t u m L e a P s
12// ------------------------
13// Modern Embedded Software
14//
15// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
16//
17// The QP/C++ software is dual-licensed under the terms of the open-source
18// GNU General Public License (GPL) or under the terms of one of the closed-
19// source Quantum Leaps commercial licenses.
20//
21// Redistributions in source code must retain this top-level comment block.
22// Plagiarizing this software to sidestep the license obligations is illegal.
23//
24// NOTE:
25// The GPL does NOT permit the incorporation of this code into proprietary
26// programs. Please contact Quantum Leaps for commercial licensing options,
27// which expressly supersede the GPL and are designed explicitly for
28// closed-source distribution.
29//
30// Quantum Leaps contact information:
31// <www.state-machine.com/licensing>
32// <info@state-machine.com>
33//
34//$endhead${include::qpcpp.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35#ifndef QPCPP_HPP_
36#define QPCPP_HPP_
37
38//============================================================================
39#include "qp_port.hpp" // QP port from the port directory
40#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
41#ifdef Q_SPY // software tracing enabled?
42 #include "qs_port.hpp" // QS/C++ port from the port directory
43#else
44 #include "qs_dummy.hpp" // QS/C++ dummy (inactive) interface
45#endif
46
47//============================================================================
48#ifndef QP_API_VERSION
49 #define QP_API_VERSION 0
50#endif // QP_API_VERSION
51
52// QP API compatibility layer...
53//============================================================================
54#if (QP_API_VERSION < 750)
55
56#define QM_SM_STATE_DECL(subm_, state_) error "submachines no longer supported"
57#define qm_super_sub(sm_state_) error "submachines no longer supported"
58#define qm_tran_ep(tatbl_) error "submachines no longer supported"
59#define qm_tran_xp(xp_, tatbl_) error "submachines no longer supported"
60#define qm_sm_exit(sm_state_) error "submachines no longer supported"
61
62#ifdef QEVT_DYN_CTOR
63//! @deprecated #QEVT_DYN_CTOR, please use #QEVT_PAR_INIT
64#define QEVT_PAR_INIT
65#endif
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_) (static_cast<void>(expr_))
83
84#elif defined Q_UNSAFE
85
86 //! @deprecated general purpose assertion with user-specified ID
87 //! number that **always** evaluates the `expr_` expression.
88 #define Q_ALLEGE_ID(id_, expr_) (static_cast<void>(expr_))
89
90#else // QP FuSa Subsystem enabled
91
92 //! @deprecated general purpose assertion with user-specified ID
93 //! number that **always** evaluates the `expr_` expression.
94 //! @note
95 //! The use of this macro is no longer recommended.
96 #define Q_ALLEGE_ID(id_, expr_) if (!(expr_)) { \
97 QF_CRIT_STAT \
98 QF_CRIT_ENTRY(); \
99 Q_onError(&Q_this_module_[0], (id_)); \
100 QF_CRIT_EXIT(); \
101 } else ((void)0)
102
103#endif
104
105//! @deprecated general purpose assertion without ID number
106//! that **always** evaluates the `expr_` expression.
107//! Instead of ID number, this macro is based on the standard
108//! `__LINE__` macro.
109//!
110//! @note The use of this macro is no longer recommended.
111#define Q_ALLEGE(expr_) Q_ALLEGE_ID(__LINE__, (expr_))
112
113//! Static (compile-time) assertion.
114//!
115//! @deprecated
116//! Use Q_ASSERT_STATIC() or better yet `static_assert()` instead.
117//!
118#define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_)
119
120//! @deprecated use QP::QF::NO_MARGIN instead
121#define QF_NO_MARGIN QP::QF::NO_MARGIN
122
123//============================================================================
124#if (QP_API_VERSION < 691)
125
126//! @deprecated enable the QS global filter
127#define QS_FILTER_ON(rec_) QS_GLB_FILTER((rec_))
128
129//! @deprecated disable the QS global filter
130#define QS_FILTER_OFF(rec_) QS_GLB_FILTER(-(rec_))
131
132//! @deprecated enable the QS local filter for SM (state machine) object
133#define QS_FILTER_SM_OBJ(obj_) (static_cast<void>(0))
134
135//! @deprecated enable the QS local filter for AO (active objects)
136#define QS_FILTER_AO_OBJ(obj_) (static_cast<void>(0))
137
138//! @deprecated enable the QS local filter for MP (memory pool) object
139#define QS_FILTER_MP_OBJ(obj_) (static_cast<void>(0))
140
141//! @deprecated enable the QS local filter for EQ (event queue) object
142#define QS_FILTER_EQ_OBJ(obj_) (static_cast<void>(0))
143
144//! @deprecated enable the QS local filter for TE (time event) object
145#define QS_FILTER_TE_OBJ(obj_) (static_cast<void>(0))
146
147#ifdef Q_SPY
148
149//! @deprecated local Filter for a generic application object `obj_`.
150#define QS_FILTER_AP_OBJ(obj_) \
151 (QP::QS::filt_.loc_AP = (obj_))
152
153//! @deprecated begin of a user QS record, instead use QS_BEGIN_ID()
154#define QS_BEGIN(rec_, obj_) \
155 if (QS_GLB_FILTER_(rec_) && \
156 ((QP::QS::filt_.loc[QP::QS::AP_OBJ] == nullptr) \
157 || (QP::QS::filt_.loc_AP == (obj_)))) \
158 { \
159 QS_CRIT_STAT \
160 QS_CRIT_ENTRY(); \
161 QP::QS::beginRec_(static_cast<std::uint_fast8_t>(rec_)); \
162 QS_TIME_PRE();
163
164//! @deprecated output hex-formatted std::uint32_t to the QS record
165#define QS_U32_HEX(width_, data_) \
166 (QP::QS::u32_fmt_(static_cast<std::uint8_t>( \
167 (static_cast<std::uint8_t>((width_) << 4)) | QS_HEX_FMT), (data_)))
168
169#else
170
171#define QS_FILTER_AP_OBJ(obj_) (static_cast<void>(0))
172#define QS_BEGIN(rec_, obj_) if (false) {
173#define QS_U32_HEX(width_, data_) (Q_UNUSED_PAR(0))
174
175#endif // def Q_SPY
176
177//============================================================================
178#if (QP_API_VERSION < 680)
179
180//! @deprecated
181//! Macro to specify a tran. in the "me->" impl-strategy.
182//! Instead use the new impl-strategy without the "me->" pointer, where
183//! you call tran(Q_STATE_CAST(target_)).
184#define Q_TRAN(target_) (me->tran(Q_STATE_CAST(target_)))
185
186//! @deprecated
187//! Macro to specify a tran-to-history in the "me->" impl-strategy.
188//! Instead use the new impl-strategy without the "me->" pointer, where
189//! you call tran_hist(Q_STATE_CAST(hist_)).
190#define Q_TRAN_HIST(hist_) (me->tran_hist((hist_)))
191
192//! @deprecated
193//! Macro to specify the superstate in the "me->" impl-strategy.
194//! Instead use the new impl-strategy without the "me->" pointer, where
195//! you call super(state_)).
196#define Q_SUPER(state_) (me->super(Q_STATE_CAST(state_)))
197
198//! @deprecated
199//! Macro to call in a QM state entry-handler. Applicable only to QMSMs.
200//! Instead use the new impl-strategy without the "me->" pointer, where
201//! the QM-generated code calls qm_entry(Q_STATE_CAST(state_)).
202#define QM_ENTRY(state_) (me->qm_entry((state_)))
203
204//! @deprecated
205//! Macro to call in a QM state 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_exit(Q_STATE_CAST(state_)).
208#define QM_EXIT(state_) (me->qm_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#endif // QP_API_VERSION < 680
230#endif // QP_API_VERSION < 691
231#endif // QP_API_VERSION < 750
232
233#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.