Event class.
More...
#include "qp.hpp"
|
constexpr | QEvt (QSignal const s) noexcept |
|
| QEvt ()=delete |
|
void | init () noexcept |
|
void | init (DynEvt const dummy) noexcept |
|
bool | verify_ () const noexcept |
| Internal function to verify the internal integrity of the event instance (QP FuSa Subsystem)
|
|
std::uint_fast8_t | getPoolNum_ () const noexcept |
| Internal function to get the event pool-number of the given event.
|
|
Event class.
- Details
- Class QP QEvt represents QP events and serves as the base class for derivation of events with parameters (see also Object Orientation). Please see the QP QEvt class design specifications linked in the "Backward Traceability" section.
- Backward Traceability
-
- Forward Traceability
-
- Usage
- The following example illustrates how to add event parameter(s) by inheriting the QP QEvt class. Please note that the QEvt member
super
is defined as the FIRST member of the derived class: The following examples illustrate recommended ways to instantiate event objects based on the RAII principle (Resource Acquisition Is Initialization). Please see also QP QEvt::QEvt().
static QEvt const myEvt { MY_SIG };
static KeypressEvt const keyEvt {
KEYPRESS_SIG,
12U
}
KeypressEvt keyEvt {
keyId
};
QSignal sig
Signal of the event (see Event Signal)
- Note
- Please see QP QEvt::QEvt(QSignal) for examples of instantiating event objects (immutable and mutable on the stack). Please see QP::QF::q_new()/QPQF::q_new_x() for code examples of allocating dynamic mutable events.
Definition at line 131 of file qp.hpp.
◆ DynEvt
Enumerator |
---|
DYNAMIC | dummy parameter for dynamic event initialization (see QEvt::QEvt(DynEvt))
|
Definition at line 138 of file qp.hpp.
◆ QEvt() [1/2]
|
inlineexplicitconstexprnoexcept |
Event constexpr
constructor applicable to immutable and mutable event instances.
- Parameters
-
[in] | s | signal of the event to initialize (for non-dynamic events) |
- Backward Traceability
-
- Usage
- The following examples illustrate recommended ways to use this QEvt(QSignal) constructor to instantiate event objects based on the RAII principle (Resource Acquisition Is Initialization).
static QP::QEvt const myEvt { APP::MY_SIG };
static APP::KeypressEvt const keyEvt { APP::KEYPRESS_SIG, 12U };
static APP::KeypressEvt const keyboardEvt[] {
{ APP::KEYPRESS_SIG, 12U },
{ APP::KEYPRESS_SIG, 13U }
};
APP::KeypressEvt keyEvt {
sig, keyId };
Definition at line 141 of file qp.hpp.
◆ QEvt() [2/2]
Disallowed default event constructor.
- Details
- The default event constructor is explicitly disallowed (
= delete
), so that all subclasses of QP::QEvt must provide constructors.
◆ init() [1/2]
Event initialization for dynamic events
- Returns
void
- Usage
- The following example illustrates the implicit use of the QEvt::QEvt(DynEvt) initialization for dynamically allocated events. (When QEVT_PAR_INIT is defined, the template QP::QF::q_new() calls the
init()
member function of the derived event class to initialize event parameters):
. . .
evtT_ * q_new(enum_t const sig, Args... args)
Definition at line 147 of file qp.hpp.
◆ init() [2/2]
void QP::QEvt::init |
( |
DynEvt const | dummy | ) |
|
|
inlinenoexcept |
Event initialization for dynamic events
- Parameters
-
[in] | dummy | dummy parameter on which to overload the initialization |
- Returns
void
- Usage
- The following example illustrates the implicit use of the QEvt::QEvt(DynEvt) initialization for dynamically allocated events. (When QEVT_PAR_INIT is defined, the template QP::QF::q_new() calls the
init()
member function of the derived event class to initialize event parameters):
Definition at line 150 of file qp.hpp.
◆ verify_()
bool QP::QEvt::verify_ |
( |
| ) |
const |
|
inlinenoexcept |
Internal function to verify the internal integrity of the event instance (QP FuSa Subsystem)
- Description
- The integrity checks include:
- range check of the reference counter
- Duplicate Inverse Storage check of bits reference counter bits 0:3
- Returns
- 'true' if this event passes the integrity check and 'false' otherwise.
Definition at line 154 of file qp.hpp.
◆ getPoolNum_()
std::uint_fast8_t QP::QEvt::getPoolNum_ |
( |
| ) |
const |
|
inlinenoexcept |
Internal function to get the event pool-number of the given event.
- Returns
- Pool-ID of the event. The Pool-ID is zero for immutable (static) events.
Definition at line 159 of file qp.hpp.
◆ sig
◆ evtTag_
std::uint8_t QP::QEvt::evtTag_ |
Event "tag" contains pool-ID plus the Duplicate Inverted Storage of the QEvt::refCtr_.
- Details
- The 8-bit
evtTag_
member stores the event-pool number (in bits 4:7) and the Duplicate Inverted Storage of the QEvt::refCtr_ for integrity checking (in bits 0:3). For mutable events, the QEvt_ctor() initializes refCtr_
to 0 and consequently evtTag_
to 0xF. For immutable events (not from event pools) the constexpr constructor QP QEvt::QEvt() initializes refCtr_
to 0xE and consequently evtTag_
to 0x1.
- Backward Traceability
- QP::QEvt : Event class
- SRS_QP_EVT_31 : Event abstraction may contain other data items for internal event management inside QP/C++ Framework
- SRS_QP_EVT_30 : QP/C++ Framework shall allow Application to create event instances with Parameters defined by the Application
Definition at line 134 of file qp.hpp.
◆ refCtr_
std::uint8_t volatile QP::QEvt::refCtr_ |
Event reference counter.)
- Details
- For mutable events (events from event pools), the 8-bit member QEvt::refCtr_ holds the reference count, which must be in the rage 0..2*QF_MAX_ACTIVE. For immutable (static) events, the member QEvt::refCtr_ holds the fixed value 0xE, which is initialized in the constexpr constructor QP QEvt::QEvt().
- Backward Traceability
- QP::QEvt : Event class
- SRS_QP_EVT_31 : Event abstraction may contain other data items for internal event management inside QP/C++ Framework
- SRS_QP_EVT_30 : QP/C++ Framework shall allow Application to create event instances with Parameters defined by the Application
Definition at line 135 of file qp.hpp.
The documentation for this class was generated from the following files: