QP/C++  8.0.3
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//============================================================================
33#define QF_CONST_CAST_(type_, ptr_) const_cast<type_>(ptr_)
34#define Q_PTR2UINT_CAST_(ptr_) (reinterpret_cast<std::uintptr_t>(ptr_))
35#define QF_PTR_RANGE_(x_, min_, max_) (((min_) <= (x_)) && ((x_) <= (max_)))
36
37//============================================================================
38namespace QP {
39namespace QF {
40
41class Attr {
42public:
43
44#if (QF_MAX_EPOOL > 0U)
46 std::uint_fast8_t maxPool_;
47#else
48 std::uint8_t dummy;
49#endif // (QF_MAX_EPOOL == 0U)
50}; // class Attr
51
52extern QF::Attr priv_;
53
54void bzero_(
55 void * const start,
56 std::uint_fast16_t const len) noexcept;
57
58} // namespace QF
59
60//============================================================================
61// Bitmasks are for the QTimeEvt::flags attribute
62constexpr std::uint8_t QTE_FLAG_IS_LINKED {1U << 7U};
63constexpr std::uint8_t QTE_FLAG_WAS_DISARMED {1U << 6U};
64
65//============================================================================
66inline void QEvt_refCtr_inc_(QEvt const * const e) noexcept {
67 // NOTE: this function must be called inside a critical section
68 std::uint8_t rc = e->refCtr_ + 1U;
69 (QF_CONST_CAST_(QEvt*, e))->refCtr_ = rc; // cast away 'const'
70}
71
72inline void QEvt_refCtr_dec_(QEvt const * const e) noexcept {
73 // NOTE: this function must be called inside a critical section
74 std::uint8_t rc = e->refCtr_ - 1U;
75 (QF_CONST_CAST_(QEvt*, e))->refCtr_ = rc; // cast away 'const'
76}
77
78} // namespace QP
79
80#endif // QP_PKG_HPP_
Event class.
Definition qp.hpp:115
Private attributes of the QF framework.
Definition qp_pkg.hpp:41
QF_EPOOL_TYPE_ ePool_[QF_MAX_EPOOL]
Array of event pools sized for the maximum allowed number of pools.
Definition qp_pkg.hpp:45
std::uint_fast8_t maxPool_
Number of event pools managed by the QF Framework.
Definition qp_pkg.hpp:46
QF Active Object Framework namespace.
void bzero_(void *const start, std::uint_fast16_t const len) noexcept
Definition qf_act.cpp:56
QF::Attr priv_
Definition qf_act.cpp:54
QP/C++ framework.
Definition qequeue.hpp:36
constexpr std::uint8_t QTE_FLAG_WAS_DISARMED
Definition qp_pkg.hpp:63
void QEvt_refCtr_inc_(QEvt const *const e) noexcept
Definition qp_pkg.hpp:66
void QEvt_refCtr_dec_(QEvt const *const e) noexcept
Decrement the refCtr of a const event (requires casting const away)
Definition qp_pkg.hpp:72
constexpr std::uint8_t QTE_FLAG_IS_LINKED
Definition qp_pkg.hpp:62
#define QF_EPOOL_TYPE_
Definition qk.hpp:107
#define QF_MAX_EPOOL
Maximum # event pools in the system (0..15)
#define QF_CONST_CAST_(type_, ptr_)
Definition qp_pkg.hpp:33