QP/C++ 8.1.1
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#include <array> // for std::array
33
34#ifdef QP_IMPL
35
36namespace QP {
37
38extern std::array<QActive*, QF_MAX_ACTIVE + 1U> QActive_registry_;
41
42#if (QF_MAX_TICK_RATE > 0U)
43extern std::array<QTimeEvt, QF_MAX_TICK_RATE> QTimeEvt_head_;
44
45// Bitmasks are for the QTimeEvt::flags attribute
46constexpr std::uint8_t QTE_FLAG_IS_LINKED {1U << 7U};
47constexpr std::uint8_t QTE_FLAG_WAS_DISARMED {1U << 6U};
48
49#endif // (QF_MAX_TICK_RATE > 0U)
50
51//============================================================================
52void QEvt_refCtr_inc_(QEvt const * const me) noexcept;
53void QEvt_refCtr_dec_(QEvt const * const me) noexcept;
54
55//============================================================================
56// Duplicate Inverse Storage (DIS) facilities
57
58#ifndef Q_UNSAFE
59
60template<typename T_>
61static T_ dis_update(T_ const org) {
62 // calculate the Duplicate Inverse Storage (DIS) for the original
63 // variable org
64 return static_cast<T_>(~org);
65}
66//........................................................................
67template<typename T_>
68static bool dis_verify(T_ const org, T_ const dis) {
69 // verify that the Duplicate Inverse Storage (DIS) dis matches
70 // the original variable org
71 return dis == static_cast<T_>(~org);
72}
73
74#endif
75
76//============================================================================
77namespace QF {
78
79class Attr {
80public:
81
82#if (QF_MAX_EPOOL > 0U)
83 std::array<QF_EPOOL_TYPE_, QF_MAX_EPOOL> ePool_;
84 std::uint8_t maxPool_;
85#else
86 std::uint8_t dummy;
87#endif // (QF_MAX_EPOOL == 0U)
88}; // class Attr
89
90extern QF::Attr priv_;
91
92} // namespace QF
93} // namespace QP
94
95#endif // QP_IMPL
96
97#endif // QP_PKG_HPP_
Private attributes of the QF framework.
Definition qp_pkg.hpp:79
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:83
std::uint8_t maxPool_
Number of event pools managed by the QF Framework.
Definition qp_pkg.hpp:84
Subscriber List (for publish-subscribe).
Definition qp.hpp:464
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:47
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:61
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:68
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:46