QP/C++  7.4.0-rc.1
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qequeue.hpp
Go to the documentation of this file.
1//$file${include::qequeue.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpcpp.qm
4// File: ${include::qequeue.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::qequeue.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QEQUEUE_HPP_
44#define QEQUEUE_HPP_
45
46#ifndef QF_EQUEUE_CTR_SIZE
47 #define QF_EQUEUE_CTR_SIZE 1U
48#endif
49
50namespace QP {
51
52#if (QF_EQUEUE_CTR_SIZE == 1U)
53 using QEQueueCtr = std::uint8_t;
54#elif (QF_EQUEUE_CTR_SIZE == 2U)
55 using QEQueueCtr = std::uint16_t;
56#elif (QF_EQUEUE_CTR_SIZE == 4U)
57 using QEQueueCtr = std::uint32_t;
58#else
59 #error "QF_EQUEUE_CTR_SIZE defined incorrectly, expected 1U, 2U, or 4U"
60#endif
61
62class QEvt; // forward declaration
63
64} // namespace QP
65
66//$declare${QF::QEQueue} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
67namespace QP {
68
69//${QF::QEQueue} .............................................................
70class QEQueue {
71private:
72 QEvt const * volatile m_frontEvt;
73 QEvt const ** m_ring;
79
80 // friends...
81 friend class QActive;
82 friend class QTicker;
83 friend class QXMutex;
84 friend class QXThread;
85
86public:
87 QEQueue() noexcept
88 : m_frontEvt(nullptr),
89 m_ring(nullptr),
90 m_end(0U),
91 m_head(0U),
92 m_tail(0U),
93 m_nFree(0U),
94 m_nMin(0U)
95 {}
96 void init(
97 QEvt const * qSto[],
98 std::uint_fast16_t const qLen) noexcept;
99 bool post(
100 QEvt const * const e,
101 std::uint_fast16_t const margin,
102 std::uint_fast8_t const qsId) noexcept;
103 void postLIFO(
104 QEvt const * const e,
105 std::uint_fast8_t const qsId) noexcept;
106 QEvt const * get(std::uint_fast8_t const qsId) noexcept;
107 QEQueueCtr getNFree() const noexcept {
108 return m_nFree;
109 }
110 QEQueueCtr getNMin() const noexcept {
111 return m_nMin;
112 }
113 bool isEmpty() const noexcept {
114 return m_frontEvt == nullptr;
115 }
116
117private:
118 QEQueue(QEQueue const & other) = delete;
119 QEQueue & operator=(QEQueue const & other) = delete;
120}; // class QEQueue
121
122} // namespace QP
123//$enddecl${QF::QEQueue} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124
125#endif // QEQUEUE_HPP_
Active object class (based on the QHsm implementation strategy)
Definition qp.hpp:722
Native QP event queue.
Definition qequeue.hpp:70
QEQueueCtr volatile m_nFree
Definition qequeue.hpp:77
QEQueue() noexcept
Definition qequeue.hpp:87
QEvt const * get(std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:231
QEQueue & operator=(QEQueue const &other)=delete
void init(QEvt const *qSto[], std::uint_fast16_t const qLen) noexcept
Definition qf_qeq.cpp:72
bool isEmpty() const noexcept
Definition qequeue.hpp:113
QEQueueCtr volatile m_tail
Definition qequeue.hpp:76
QEQueueCtr m_nMin
Definition qequeue.hpp:78
bool post(QEvt const *const e, std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:99
QEQueueCtr getNFree() const noexcept
Definition qequeue.hpp:107
QEQueueCtr volatile m_head
Definition qequeue.hpp:75
QEQueue(QEQueue const &other)=delete
QEQueueCtr getNMin() const noexcept
Definition qequeue.hpp:110
QEvt const *volatile m_frontEvt
Definition qequeue.hpp:72
QEQueueCtr m_end
Definition qequeue.hpp:74
QEvt const ** m_ring
Definition qequeue.hpp:73
void postLIFO(QEvt const *const e, std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:179
Event class.
Definition qp.hpp:137
"Ticker" Active Object class
Definition qp.hpp:1023
Blocking Mutex of the QXK preemptive kernel.
Definition qxk.hpp:164
eXtended (blocking) thread of the QXK preemptive kernel
Definition qxk.hpp:88
QP/C++ framework.
Definition qequeue.hpp:50
std::uint16_t QEQueueCtr
Definition qequeue.hpp:55