QP/C++  7.3.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QP::QEvt Class Reference

Event class. More...

#include "qp.hpp"

Inheritance diagram for QP::QEvt:
QP::QTimeEvt

Public Types

enum  DynEvt : std::uint8_t { DYNAMIC }
 

Public Member Functions

 QEvt ()=delete
 
constexpr QEvt (QSignal const s) noexcept
 
 QEvt (DynEvt dummy) noexcept
 
std::uint_fast8_t getPoolId_ () const noexcept
 

Static Public Member Functions

static bool verify_ (QEvt const *const e) noexcept
 

Public Attributes

QSignal sig
 
std::uint8_t volatile refCtr_
 
std::uint8_t evtTag_
 

Static Public Attributes

static constexpr std::uint8_t MARKER {0xE0U}
 

Detailed Description

Event class.

QP::QEvt represents events without parameters and serves as the base class for derivation of events with parameters.

Traceability
Usage
The following example illustrates how to add an event parameter by derivation of the QP::QEvt class. Please note that the QP::QEvt member super is defined as the FIRST member of the derived struct.
struct CalcEvt : public QP::QEvt { // <=== inherit QEvt
std::uint8_t keyId; // ID of the key depressed
};
Event class.
Definition qp.hpp:144

Definition at line 144 of file qp.hpp.

Member Enumeration Documentation

◆ DynEvt

enum QP::QEvt::DynEvt : std::uint8_t
Enumerator
DYNAMIC 

dummy parameter for dynamic event constructor (see QEvt::QEvt(DynEvt))

Definition at line 154 of file qp.hpp.

Constructor & Destructor Documentation

◆ QEvt() [1/3]

QP::QEvt::QEvt ( )
delete

Disallowed default event constructor.

The default event constructor is explicitly disallowed (= delete), so that all subclasses of QP::QEvt must provide constructors.

◆ QEvt() [2/3]

QEvt::QEvt ( QSignal const  s)
inlineexplicitconstexprnoexcept

Event constructor.

Parameters
[in]ssignal of the event to initialize (for non-dynamic events)
Traceability
Usage
The following example illustrates the use of the QEvt::QEvt(QP::QSignal) constructor for stack-allocated events:
QP::QEvt const myEvt(MY_SIG);
. . .

Definition at line 159 of file qp.hpp.

◆ QEvt() [3/3]

QP::QEvt::QEvt ( DynEvt  dummy)
inlineexplicitnoexcept

Event constructor for dynamic event

Parameters
[in]dummydummy parameter on which to overload the constructor
Usage
The following example illustrates the implicit use of the QEvt::QEvt(QEvt::DYNAMIC) constructor for dynamically allocated events. (When QEVT_DYN_CTOR is defined, the macro Q_NEW() calls the dynamic event constructor via placement new):
static QP::QEvt const *evtPtr = Q_NEW(QEvt, MY_SIG, QP::QEvt::DYNAMIC);
. . .
@ DYNAMIC
Definition qp.hpp:154
#define Q_NEW(evtT_, sig_,...)
Definition qp.hpp:1151

Definition at line 166 of file qp.hpp.

Member Function Documentation

◆ verify_()

QEvt::verify_ ( QEvt const *const  e)
inlinestaticnoexcept

Verify the provided event pointer is not nullptr and that the expected memory marker is present in the event (QP FuSa Subsystem)

Returns
'true' if this event passes the integrity check and 'false' otherwise.

Definition at line 171 of file qp.hpp.

◆ getPoolId_()

QP::QEvt::getPoolId_ ( ) const
inlinenoexcept

Get the Pool-ID of the event.

Returns
Pool-ID of the event.
Note
The Pool-ID is zero for immutable (static) events.

Definition at line 175 of file qp.hpp.

Member Data Documentation

◆ sig

QEvt::sig

Signal of the event.

Traceability

Definition at line 146 of file qp.hpp.

◆ refCtr_

QEvt::refCtr_

Reference counter (for mutable events)

Traceability

Definition at line 147 of file qp.hpp.

◆ evtTag_

QEvt::evtTag_

Pool ID indicating which event pool it came from plus event marker

Description
The 8-bit evtTag_ member stores the event-pool number (in bits [0:3]) and the QEvt::MARKER memory marker for integrity checking (in bits [4:7]). In the special case of immutable events (not from event pools) the event-pool number bits [0:3] are 0.
Traceability

Definition at line 148 of file qp.hpp.

◆ MARKER

QEvt::MARKER {0xE0U}
staticconstexpr

QP::QEvt memory marker (for internal integrity checks)

The marker is implanted in bits 4:7 of QEvt::evtTag_.

Definition at line 151 of file qp.hpp.


The documentation for this class was generated from the following files: