QP/C++  7.3.3
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
97#ifdef Q_XTOR
98 ~QEQueue();
99#endif // def Q_XTOR
100 void init(
101 QEvt const * qSto[],
102 std::uint_fast16_t const qLen) noexcept;
103 bool post(
104 QEvt const * const e,
105 std::uint_fast16_t const margin,
106 std::uint_fast8_t const qsId) noexcept;
107 void postLIFO(
108 QEvt const * const e,
109 std::uint_fast8_t const qsId) noexcept;
110 QEvt const * get(std::uint_fast8_t const qsId) noexcept;
111 QEQueueCtr getNFree() const noexcept {
112 return m_nFree;
113 }
114 QEQueueCtr getNMin() const noexcept {
115 return m_nMin;
116 }
117 bool isEmpty() const noexcept {
118 return m_frontEvt == nullptr;
119 }
120
121private:
122 QEQueue(QEQueue const & other) = delete;
123 QEQueue & operator=(QEQueue const & other) = delete;
124}; // class QEQueue
125
126} // namespace QP
127//$enddecl${QF::QEQueue} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128
129#endif // QEQUEUE_HPP_
Active object class (based on the QHsm implementation strategy)
Definition qp.hpp:724
Native QP event queue.
Definition qequeue.hpp:70
QEQueueCtr volatile m_nFree
Definition qequeue.hpp:77
bool post(QEvt const *const e, std::uint_fast16_t const margin, std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:88
QEQueueCtr m_nMin
Definition qequeue.hpp:78
QEQueueCtr volatile m_tail
Definition qequeue.hpp:76
QEQueueCtr volatile m_head
Definition qequeue.hpp:75
QEvt const * get(std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:219
QEQueue() noexcept
Definition qequeue.hpp:87
QEQueueCtr getNFree() const noexcept
Definition qequeue.hpp:111
void postLIFO(QEvt const *const e, std::uint_fast8_t const qsId) noexcept
Definition qf_qeq.cpp:168
QEQueue & operator=(QEQueue const &other)=delete
QEvt const ** m_ring
Definition qequeue.hpp:73
QEvt const *volatile m_frontEvt
Definition qequeue.hpp:72
void init(QEvt const *qSto[], std::uint_fast16_t const qLen) noexcept
Definition qf_qeq.cpp:72
QEQueue(QEQueue const &other)=delete
bool isEmpty() const noexcept
Definition qequeue.hpp:117
QEQueueCtr getNMin() const noexcept
Definition qequeue.hpp:114
QEQueueCtr m_end
Definition qequeue.hpp:74
Event class.
Definition qp.hpp:139
"Ticker" Active Object class
Definition qp.hpp:1029
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