QP/C++ 8.1.2
Real-Time Event Framework
Loading...
Searching...
No Matches
qp_pkg.hpp
Go to the documentation of this file.
1//============================================================================
2// QP/C++ Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#ifndef QP_PKG_HPP_
30#define QP_PKG_HPP_
31
32#ifdef QP_IMPL
33
34namespace QP {
35
36extern std::array<QActive*, QF_MAX_ACTIVE + 1U> QActive_registry_;
39
40#if (QF_MAX_TICK_RATE > 0U)
41extern std::array<QTimeEvt, QF_MAX_TICK_RATE> QTimeEvt_head_;
42
43// Bitmasks are for the QTimeEvt::flags attribute
44constexpr std::uint8_t QTE_FLAG_IS_LINKED {1U << 7U};
45constexpr std::uint8_t QTE_FLAG_WAS_DISARMED {1U << 6U};
46
47#endif // (QF_MAX_TICK_RATE > 0U)
48
49//============================================================================
50void QEvt_refCtr_inc_(QEvt const * const me) noexcept;
51void QEvt_refCtr_dec_(QEvt const * const me) noexcept;
52
53//----------------------------------------------------------------------------
54// Duplicate Inverse Storage (DIS) facilities
55
56#ifndef Q_UNSAFE
57
58template<typename T_>
59static T_ dis_update(T_ const org) {
60 // calculate the Duplicate Inverse Storage (DIS) for the original
61 // variable org
62 return static_cast<T_>(~org);
63}
64//........................................................................
65template<typename T_>
66static bool dis_verify(T_ const org, T_ const dis) {
67 // verify that the Duplicate Inverse Storage (DIS) dis matches
68 // the original variable org
69 return dis == static_cast<T_>(~org);
70}
71
72#endif // Q_UNSAFE
73
74//============================================================================
75namespace QF {
76
77class Attr {
78public:
79
80#if (QF_MAX_EPOOL > 0U)
81 std::array<QF_EPOOL_TYPE_, QF_MAX_EPOOL> ePool_;
82 std::uint8_t maxPool_;
83#else
84 std::uint8_t dummy;
85#endif // (QF_MAX_EPOOL == 0U)
86}; // class Attr
87
88extern QF::Attr priv_;
89
90} // namespace QF
91} // namespace QP
92
93#endif // QP_IMPL
94
95#endif // QP_PKG_HPP_
Private attributes of the QF framework.
Definition qp_pkg.hpp:77
std::array< QF_EPOOL_TYPE_, QF_MAX_EPOOL > ePool_
Array of event pools sized for the maximum allowed number of pools.
Definition qp_pkg.hpp:81
std::uint8_t maxPool_
Number of event pools managed by the QF Framework.
Definition qp_pkg.hpp:82
Subscriber List (for publish-subscribe).
Definition qp.hpp:468
QF::Attr priv_
Definition qf_qact.cpp:51
QP/C++ Framework namespace.
Definition qequeue.hpp:36
constexpr std::uint8_t QTE_FLAG_WAS_DISARMED
Definition qp_pkg.hpp:45
QSubscrList * QActive_subscrList_
Internal pointer to the array of subscribers to the event-signals.
Definition qf_ps.cpp:47
static T_ dis_update(T_ const org)
Internal function template to calculate the Duplicate Inverse Storage (DIS).
Definition qp_pkg.hpp:59
void QEvt_refCtr_inc_(QEvt const *const me) noexcept
Internal function to increment the refCtr of a const event.
Definition qf_act.cpp:57
static bool dis_verify(T_ const org, T_ const dis)
Internal function template to verify the Duplicate Inverse Storage (DIS).
Definition qp_pkg.hpp:66
void QEvt_refCtr_dec_(QEvt const *const me) noexcept
Internal function to decrement the refCtr of a const event.
Definition qf_act.cpp:68
std::array< QActive *, QF_MAX_ACTIVE+1U > QActive_registry_
Internal array of pointers to the registered Active Objects.
Definition qf_qact.cpp:47
std::uint16_t QSignal
The signal of event QP::QEvt.
Definition qp.hpp:98
QSignal QActive_maxPubSignal_
Internal maximum published signal (# used entries in the QP::QActive_subscrList_ array).
Definition qf_ps.cpp:48
std::array< QTimeEvt, QF_MAX_TICK_RATE > QTimeEvt_head_
Internal heads of the time-event linked-lists (by clock-tick rate).
Definition qf_time.cpp:51
constexpr std::uint8_t QTE_FLAG_IS_LINKED
Definition qp_pkg.hpp:44