QP/C++  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qp.hpp File Reference

QP/C++ platform-independent public interface. More...

Go to the source code of this file.

Classes

class  QP::QEvt
 Event class. More...
 
struct  QP::QMState
 State object for the QP::QMsm class (QM State Machine). More...
 
struct  QP::QMTranActTable
 Transition-Action Table for the QP::QMsm State Machine. More...
 
union  QP::QAsmAttr
 Attribute of for the QP::QAsm class (Abstract State Machine). More...
 
class  QP::QAsm
 Abstract State Machine class (state machine interface) More...
 
class  QP::QHsm
 Hierarchical State Machine class (QHsm-style state machine implementation strategy) More...
 
class  QP::QMsm
 Hierarchical State Machine class (QMsm-style state machine implementation strategy) More...
 
class  QP::QPSet
 Set of Active Objects of up to QF_MAX_ACTIVE elements. More...
 
class  QP::QSubscrList
 Subscriber List (for publish-subscribe) More...
 
class  QP::QActive
 Active object class (based on the QHsm implementation strategy) More...
 
class  QP::QMActive
 Active object class (based on QMsm implementation strategy) More...
 
class  QP::QTimeEvt
 Time Event class. More...
 
class  QP::QTicker
 "Ticker" Active Object class More...
 

Namespaces

namespace  QP
 QP/C++ framework.
 
namespace  QP::QF
 QF Active Object Framework.
 

Macros

#define QP_VERSION   734U
 
#define QP_VERSION_STR   "7.3.4"
 
#define QP_RELEASE   0x70C1EA11U
 Encrypted current QP release (7.3.4) and date (2024-03-21)
 
#define Q_STATE_DECL(state_)
 
#define Q_STATE_DEF(subclass_, state_)
 
#define Q_HANDLED()   (Q_RET_HANDLED)
 
#define Q_UNHANDLED()   (Q_RET_UNHANDLED)
 
#define Q_EVT_CAST(subclass_)   (static_cast<subclass_ const *>(e))
 
#define Q_STATE_CAST(handler_)    (reinterpret_cast<QP::QStateHandler>(handler_))
 
#define QM_STATE_DECL(state_)
 
#define QM_SM_STATE_DECL(subm_, state_)
 
#define QM_ACTION_DECL(action_)
 
#define QM_STATE_DEF(subclass_, state_)
 
#define QM_ACTION_DEF(subclass_, action_)
 
#define QM_HANDLED()   (Q_RET_HANDLED)
 
#define QM_UNHANDLED()   (Q_RET_HANDLED)
 
#define QM_SUPER()   (Q_RET_SUPER)
 
#define QM_STATE_NULL   (nullptr)
 
#define Q_ACTION_NULL   (nullptr)
 
#define Q_UNUSED_PAR(par_)   (static_cast<void>(par_))
 
#define Q_DIM(array_)   (sizeof(array_) / sizeof((array_)[0U]))
 
#define Q_UINT2PTR_CAST(type_, uint_)   (reinterpret_cast<type_ *>(uint_))
 
#define INIT(qsId_)   init((qsId_))
 
#define DISPATCH(e_, qsId_)   dispatch((e_), (qsId_))
 
#define Q_PRIO(prio_, pthre_)    (static_cast<QP::QPrioSpec>((prio_) | (pthre_) << 8U))
 
#define Q_NEW(evtT_, sig_, ...)
 
#define Q_NEW_X(evtT_, margin_, sig_, ...)
 
#define Q_NEW_REF(evtRef_, evtT_)    ((evtRef_) = static_cast<evtT_ const *>(QP::QF::newRef_(e, (evtRef_))))
 
#define Q_DELETE_REF(evtRef_)
 
#define PUBLISH(e_, sender_)    publish_((e_), (sender_), (sender_)->getPrio())
 
#define POST(e_, sender_)   post_((e_), QP::QF::NO_MARGIN, (sender_))
 
#define POST_X(e_, margin_, sender_)    post_((e_), (margin_), (sender_))
 
#define TICK_X(tickRate_, sender_)   tick((tickRate_), (sender_))
 
#define TICK(sender_)   TICK_X(0U, (sender_))
 
#define TRIG(sender_)   trig_((sender_))
 
#define QF_CRIT_EXIT_NOP()   (static_cast<void>(0))
 
#define QF_MEM_SYS()   (static_cast<void>(0))
 
#define QF_MEM_APP()   (static_cast<void>(0))
 

Typedefs

using int_t = int
 
using enum_t = int
 
using float32_t = float
 
using float64_t = double
 
using QP::QSignal = std::uint16_t
 
using QP::QState = std::uint_fast8_t
 
using QP::QStateHandler = QState (*)(void * const me, QEvt const * const e)
 
using QP::QActionHandler = QState (*)(void * const me)
 
using QP::QXThreadHandler = void (*)(QXThread * const me)
 
using QP::QPrioSpec = std::uint16_t
 
using QP::QTimeEvtCtr = std::uint32_t
 
using QP::QPSetBits = std::uint32_t
 

Functions

std::uint_fast8_t QP::QF_LOG2 (QP::QPSetBits x) noexcept
 
void QP::QF::init ()
 
void QP::QF::stop ()
 
int_t QP::QF::run ()
 
void QP::QF::onStartup ()
 
void QP::QF::onCleanup ()
 
void QP::QF::psInit (QSubscrList *const subscrSto, enum_t const maxSignal) noexcept
 
void QP::QF::publish_ (QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept
 
void QP::QF::tick (std::uint_fast8_t const tickRate, void const *const sender) noexcept
 
std::uint_fast16_t QP::QF::getQueueMin (std::uint_fast8_t const prio) noexcept
 
void QP::QF::poolInit (void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const evtSize) noexcept
 
std::uint_fast16_t QP::QF::poolGetMaxBlockSize () noexcept
 
std::uint_fast16_t QP::QF::getPoolMin (std::uint_fast8_t const poolNum) noexcept
 
QEvt * QP::QF::newX_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, enum_t const sig) noexcept
 
void QP::QF::gc (QEvt const *const e) noexcept
 
QEvt const * QP::QF::newRef_ (QEvt const *const e, QEvt const *const evtRef) noexcept
 
void QP::QF::deleteRef_ (QEvt const *const evtRef) noexcept
 
QEvt * QP::QF::newXfromISR_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, enum_t const sig) noexcept
 
void QP::QF::gcFromISR (QEvt const *e) noexcept
 
void QF_onContextSw (QP::QActive *prev, QP::QActive *next)
 

Variables

constexpr char const QP::versionStr [] {QP_VERSION_STR}
 
constexpr enum_t QP::Q_USER_SIG {4}
 
constexpr std::uint_fast16_t QP::QF::NO_MARGIN {0xFFFFU}
 

Detailed Description

QP/C++ platform-independent public interface.

Definition in file qp.hpp.

Macro Definition Documentation

◆ QP_VERSION

#define QP_VERSION   734U

The current QP version as an unsigned number

Description
QP_VERSION is a decimal constant, where XX is a 1-digit or 2-digit major version number, Y is a 1-digit minor version number, and Z is a 1-digit release number.

Definition at line 47 of file qp.hpp.

◆ QP_VERSION_STR

#define QP_VERSION_STR   "7.3.4"

The current QP version as a zero terminated string literal.

Description
QP_VERSION_STR is of the form "XX.Y.Z", where XX is a 1-or 2-digit major version number, Y is a 1-digit minor version number, and Z is a 1-digit release number.

Definition at line 48 of file qp.hpp.

◆ QP_RELEASE

#define QP_RELEASE   0x70C1EA11U

Encrypted current QP release (7.3.4) and date (2024-03-21)

Definition at line 51 of file qp.hpp.

◆ Q_STATE_DECL

#define Q_STATE_DECL ( state_)
Value:
QP::QState state_ ## _h(QP::QEvt const * const e); \
static QP::QState state_(void * const me, QP::QEvt const * const e)
Event class.
Definition qp.hpp:139
std::uint_fast8_t QState
Definition qp.hpp:173

Definition at line 473 of file qp.hpp.

◆ Q_STATE_DEF

#define Q_STATE_DEF ( subclass_,
state_ )
Value:
QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) { \
return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)

Definition at line 478 of file qp.hpp.

◆ Q_HANDLED

#define Q_HANDLED ( )    (Q_RET_HANDLED)

Indicate that an action has been "handled". Applies to entry/exit actions and to internal transitions in QP::QHsm state machines.

Traceability
Usage
Q_STATE_DEF(ToasterOven, toasting) {
QP::QState status_;
switch (e->sig) {
case Q_ENTRY_SIG: {
PRINTF_S("%s;", "toasting");
status_ = Q_HANDLED(); // <===
break;
}
. . .
}
return status_;
}
#define Q_STATE_DEF(subclass_, state_)
Definition qp.hpp:478
#define Q_HANDLED()
Definition qp.hpp:484

Definition at line 484 of file qp.hpp.

◆ Q_UNHANDLED

#define Q_UNHANDLED ( )    (Q_RET_UNHANDLED)

Indicate that an internal transition has been "unhandled" due to a guard condition. Applies to internal transitions in QP::QHsm state machines.

Description
This macro must be called when a state-handler attempts to handle an event but a guard condition evaluates to 'false' and there is no other explicit way of handling the event. Applicable only to QP::QHsm subclasses.
Usage
Q_STATE_DEF(Philo, hungry) {
QP::QState status_;
switch (e->sig) {
. . .
case EAT_SIG: {
if (Q_EVT_CAST(TableEvt)->philoId == m_id) {
status_ = tran(&eating);
}
else {
status_ = Q_UNHANDLED(); // <===
}
break;
}
. . .
}
return status_;
}
#define Q_EVT_CAST(subclass_)
Definition qp.hpp:490
#define Q_UNHANDLED()
Definition qp.hpp:487

Definition at line 487 of file qp.hpp.

◆ Q_EVT_CAST

#define Q_EVT_CAST ( subclass_)    (static_cast<subclass_ const *>(e))

Perform downcast of an event onto a subclass of QP::QEvt class_

Description
This macro encapsulates the downcast of QP::QEvt pointers, which violates MISRA-C:2023 Rule 11.3(R). This macro helps to localize this deviation.
Parameters
subclass_a subclass of QP::QEvt
Note
The macro performs down-cast from the event pointer e.
Traceability
Usage
Q_STATE_DEF(Table, serving) {
QP::QState status_;
switch (e->sig) {
. . .
case HUNGRY_SIG: {
std::uint8_t n = Q_EVT_CAST(TableEvt)->philoId; // <===
. . .
break;
}
. . .
}
return status_;
}

Definition at line 490 of file qp.hpp.

◆ Q_STATE_CAST

#define Q_STATE_CAST ( handler_)     (reinterpret_cast<QP::QStateHandler>(handler_))

Perform cast to QP::QStateHandler.

Description
This macro encapsulates the cast of a specific state handler function pointer to QP::QStateHandler, which violates MISRA:C-2023 Rule 11.1(R). This macro helps to localize this deviation.
Parameters
handler_state handler (function pointer)
Traceability
Usage
Philo::Philo()
: QActive(Q_STATE_CAST(&initial)), // <===
m_timeEvt(this, TIMEOUT_SIG, 0U),
m_id(0xFFU)
{}
#define Q_STATE_CAST(handler_)
Definition qp.hpp:493

Definition at line 493 of file qp.hpp.

◆ QM_STATE_DECL

#define QM_STATE_DECL ( state_)
Value:
QP::QState state_ ## _h(QP::QEvt const * const e); \
static QP::QState state_(void * const me, QP::QEvt const * const e); \
static QP::QMState const state_ ## _s
State object for the QP::QMsm class (QM State Machine).
Definition qp.hpp:189

Definition at line 497 of file qp.hpp.

◆ QM_SM_STATE_DECL

#define QM_SM_STATE_DECL ( subm_,
state_ )
Value:
QP::QState state_ ## _h(QP::QEvt const * const e);\
static QP::QState state_(void * const me, QP::QEvt const * const e); \
static SM_ ## subm_ const state_ ## _s

Definition at line 503 of file qp.hpp.

◆ QM_ACTION_DECL

#define QM_ACTION_DECL ( action_)
Value:
QP::QState action_ ## _h(); \
static QP::QState action_(void * const me)

Definition at line 509 of file qp.hpp.

◆ QM_STATE_DEF

#define QM_STATE_DEF ( subclass_,
state_ )
Value:
QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)

Definition at line 514 of file qp.hpp.

◆ QM_ACTION_DEF

#define QM_ACTION_DEF ( subclass_,
action_ )
Value:
QP::QState subclass_::action_(void * const me) { \
return static_cast<subclass_ *>(me)->action_ ## _h(); } \
QP::QState subclass_::action_ ## _h()

Definition at line 520 of file qp.hpp.

◆ QM_HANDLED

#define QM_HANDLED ( )    (Q_RET_HANDLED)

Macro to call in a QM state-handler when it handled an event. Applicable only to QP::QMsm subclasses.

Definition at line 526 of file qp.hpp.

◆ QM_UNHANDLED

#define QM_UNHANDLED ( )    (Q_RET_HANDLED)

Indicate that an internal transition has been "unhandled" due to a guard condition. Applicable only to QP::QMsm subclasses.

Description
This macro must be called when a state-handler attempts to handle an event but a guard condition evaluates to 'false' and there is no other explicit way of handling the event.

Definition at line 529 of file qp.hpp.

◆ QM_SUPER

#define QM_SUPER ( )    (Q_RET_SUPER)

Macro to call in a QM state-handler when it designates the superstate to handle an event. Applicable only to QMSMs.

Definition at line 532 of file qp.hpp.

◆ QM_STATE_NULL

#define QM_STATE_NULL   (nullptr)

Macro to provide strictly-typed zero-state to use for submachines. Applicable to subclasses of QP::QMsm.

Definition at line 535 of file qp.hpp.

◆ Q_ACTION_NULL

#define Q_ACTION_NULL   (nullptr)

Macro to provide strictly-typed zero-action to terminate action lists in the transition-action-tables

Definition at line 538 of file qp.hpp.

◆ Q_UNUSED_PAR

#define Q_UNUSED_PAR ( par_)    (static_cast<void>(par_))

Helper macro to clearly mark unused parameters of functions.

Definition at line 541 of file qp.hpp.

◆ Q_DIM

#define Q_DIM ( array_)    (sizeof(array_) / sizeof((array_)[0U]))

Definition at line 544 of file qp.hpp.

◆ Q_UINT2PTR_CAST

#define Q_UINT2PTR_CAST ( type_,
uint_ )   (reinterpret_cast<type_ *>(uint_))

Perform cast from unsigned integer uint_ to pointer of type type_

Description
This macro encapsulates the cast to (type_ *), which QP ports or application might use to access embedded hardware registers. Such uses can trigger PC-Lint "Note 923: cast from int to pointer" and this macro helps to encapsulate this deviation.

Definition at line 547 of file qp.hpp.

◆ INIT

#define INIT ( qsId_)    init((qsId_))

Definition at line 551 of file qp.hpp.

◆ DISPATCH

#define DISPATCH ( e_,
qsId_ )   dispatch((e_), (qsId_))

Definition at line 561 of file qp.hpp.

◆ Q_PRIO

#define Q_PRIO ( prio_,
pthre_ )    (static_cast<QP::QPrioSpec>((prio_) | (pthre_) << 8U))

Create a QP::QPrioSpec object to specify priority of an AO or a thread

Parameters
[in]prio_QF priority [1..QF_MAX_ACTIVE]
[in]pthre_Preemption threshold [1..QF_MAX_ACTIVE]
Returns
The combined 16-bit priority specification (prio_ in bits [0..7] and pthre_ in bits [8..15].

Definition at line 1172 of file qp.hpp.

◆ Q_NEW

#define Q_NEW ( evtT_,
sig_,
... )
Value:
( static_cast<evtT_ *>( \
QP::QF::newX_(sizeof(evtT_), QP::QF::NO_MARGIN, (sig_)))->ctor(__VA_ARGS__))
constexpr std::uint_fast16_t NO_MARGIN
Definition qp.hpp:1101

Allocate a mutable (dynamic) event.

Description
This macro allocates a mutable (dynamic) event and internally asserts that the allocation is successful. This means that the caller does not need to check the returned event pointer for validity because it is guaranteed to be not NULL.

The macro calls the internal QF function QF_newX_() with argument margin == QF_NO_MARGIN, which causes an assertion failure when the event cannot be successfully allocated.

Parameters
[in]evtT_event type (class name) of the event to allocate
[in]sig_signal to assign to the newly allocated event
Note
When the configuration macro QEVT_DYN_CTOR is defined, the macro Q_NEW() becomes variadic and takes additional parameters, which are passed to the event constructor. In that case, you need to provide the constructor for each of your event classes derived from ::QEvt. This constructor needs to take at least one parameter and must return the event pointer (me).
Returns
A valid event pointer cast to the type evtT_.
Traceability
Usage
The following example illustrates non-variadic version of Q_NEW() (when QEVT_DYN_CTOR is NOT defined):
// event without parameters
QP::QEvt *myEvt = Q_NEW(QP::QEvt, APP::MY_SIG); // <===
// post or publish the event...
// event with parameter(s) (event parameter(s) initialized separately)
APP::KeypressEvt *ke = Q_NEW(APP::KeypressEvt, APP::KEYPRESS_SIG); // <===
ke->keyId = keyId;
// post or publish the event...
#define Q_NEW(evtT_, sig_,...)
Definition qp.hpp:1183
The following example illustrates variadic version of Q_NEW() (when QEVT_DYN_CTOR IS defined):
// event without parameters (QEVT_DYNAMIC passed to the QEvt(DynEvt) constructor)
QP::QEvt *myEvt = Q_NEW(QP::QEvt, APP::MY_SIG, QP::QEvt::DYNAMIC); // <==
// post or publish the event...
// event with parameters
namespace APP {
struct KeypressEvt : public QP::QEvt { <=== inherit QP::QEvt
// event parameters follow...
std::uint8_t keyId; // ID of the key pressed
// when QEVT_DYN_CTOR is defined, the ctor must be provided
KeypressEvt(std::uint8_t id)
: QEvt(QP::QEvt::DYNAMIC),
keyId(id)
{}
} KeypressEvt;
} // namespace
// event with parameters (keyId passed to KeypressEvt() constructor)
APP::KeypressEvt const *ke = Q_NEW(APP::KeypressEvt, APP::KEYPRESS_SIG, keyId);
// post or publish the event...
@ DYNAMIC
Definition qp.hpp:149
QP/C++ framework.
Definition qequeue.hpp:50

Definition at line 1183 of file qp.hpp.

◆ Q_NEW_X

#define Q_NEW_X ( evtT_,
margin_,
sig_,
... )
Value:
( static_cast<evtT_ *>( \
QP::QF::newX_(sizeof(evtT_), (margin_), (sig_)))->ctor(__VA_ARGS__))

Non-asserting allocate a mutable (dynamic) event.

Description
This macro allocates a mutable (dynamic) event, but only if the corresponding event pool has at least of marign of free events left. If the event pool has insufficient number of events left, the macro returns nullptr. The caller of this macro is responsible for checking the returned event pointer for NULL.
Parameters
[in]evtT_event type (class name) of the event to allocate
[in]margin_number of events that must remain available in the given pool after this allocation. The special value QF_NO_MARGIN causes asserting failure in case event allocation fails.
[in]sig_signal to assign to the newly allocated event
Returns
An event pointer cast to the type evtT_ or NULL if the event cannot be allocated with the specified margin of events still left in the event pool.
Remarks
If QEVT_DYN_CTOR is defined, the Q_NEW_X() macro becomes variadic and takes all the arguments needed by the constructor of the event class being allocated.
Traceability
Usage
The following example illustrates non-variadic version of Q_NEW_X() (when QEVT_DYN_CTOR is NOT defined):
// event without parameters
QP::QEvt *myEvt = Q_NEW_X(QP::QEvt, 5U, APP::MY_SIG); // <== (margin == 5U)
if (myEvt) { // check the event pointer!
// post or publish the event...
}
// event with parameter(s) (event parameter(s) initialized separately)
APP::KeypressEvt *kevt = Q_NEW_X(APP::KeypressEvt, 10U, APP::KEYPRESS_SIG); // <===
if (kevt) { // check the event pointer!
kevt->keyId = keyId;
// post or publish the event...
}
#define Q_NEW_X(evtT_, margin_, sig_,...)
Definition qp.hpp:1195
The following example illustrates variadic version of Q_NEW() (when QEVT_DYN_CTOR IS defined):
// event without parameters (QEVT_DYNAMIC passed to QEvt(DynEvt) constructor)
QP::QEvt *myEvt = Q_NEW_X(QP::QEvt, APP::MY_SIG, 5U, QP::QEvt::DYNAMIC); // <== (margin == 5U)
if (myEvt) { // check the event pointer!
// post or publish the event...
}
// event with parameters
namespace APP {
struct KeypressEvt : public QP::QEvt { <=== inherit QP::QEvt
// event parameters follow...
std::uint8_t keyId; // ID of the key pressed
// when QEVT_DYN_CTOR is defined, the ctor must be provided
KeypressEvt(std::uint8_t id)
: QEvt(QP::QEvt::DYNAMIC),
keyId(id)
{}
} KeypressEvt;
} // namespace
// event with parameters (keyId passed to KeypressEvt() constructor)
APP::KeypressEvt const *ke = Q_NEW_X(APP::KeypressEvt, 10U, APP::KEYPRESS_SIG, keyId);
if (ke) { // check the event pointer!
// post or publish the event...
}

Definition at line 1195 of file qp.hpp.

◆ Q_NEW_REF

#define Q_NEW_REF ( evtRef_,
evtT_ )    ((evtRef_) = static_cast<evtT_ const *>(QP::QF::newRef_(e, (evtRef_))))

Create a new reference of the current event e

Description
The current event processed by an active object is available only for the duration of the run-to-completion (RTC) step. After that step, the current event is no longer available and the framework might recycle (garbage-collect) the event. The macro Q_NEW_REF() explicitly creates a new reference to the current event that can be stored and used beyond the current RTC step, until the reference is explicitly recycled by means of the macro Q_DELETE_REF().
Parameters
[in,out]evtRef_event reference to create
[in]evtT_event type (class name) of the event reference
Usage
The example defer in the directory examples/win32/defer illustrates the use of Q_NEW_REF()

Definition at line 1200 of file qp.hpp.

◆ Q_DELETE_REF

#define Q_DELETE_REF ( evtRef_)
Value:
do { \
QP::QF::deleteRef_((evtRef_)); \
(evtRef_) = 0U; \
} while (false)

Delete the event reference

Description
Every event reference created with the macro Q_NEW_REF() needs to be eventually deleted by means of the macro Q_DELETE_REF() to avoid leaking the event.
Parameters
[in,out]evtRef_event reference to delete
Usage
The example defer in the directory examples/win32/defer illustrates the use of Q_DELETE_REF()

Definition at line 1204 of file qp.hpp.

◆ PUBLISH

#define PUBLISH ( e_,
sender_ )    publish_((e_), (sender_), (sender_)->getPrio())

Publish an event to all subscriber Active Objects.

Description
If Q_SPY is defined, this macro calls QActive_publish_() with the sender_ parameter to identify the publisher of the event. Otherwise, sender_ is not used.
Parameters
[in]e_pointer to the posted event
[in]sender_pointer to the sender object (actually used only when Q_SPY is defined)
Note
The pointer to the sender_ object is not necessarily a pointer to an active object. In fact, if QACTIVE_PUBLISH() is called from an interrupt or other context, you can create a unique object just to unambiguously identify the sender of the event.

Definition at line 1211 of file qp.hpp.

◆ POST

#define POST ( e_,
sender_ )   post_((e_), QP::QF::NO_MARGIN, (sender_))

Invoke the direct event posting facility QActive_post_()

Description
This macro asserts if the queue overflows and cannot accept the event.
Parameters
[in]e_pointer to the event to post
[in]sender_pointer to the sender object.
Note
The sendedr_ parameter is actually only used when QS tracing is enabled (macro Q_SPY is defined). When QS software tracing is disabled, the QACTIVE_POST() macro does not pass the sender_ parameter, so the overhead of passing this extra parameter is entirely avoided.
The pointer to the sender object is not necessarily a pointer to an active object. In fact, if QACTIVE_POST() is called from an interrupt or other context, you can create a unique object just to unambiguously identify the sender of the event.
See also
QP::QActive::post_()
Traceability

Definition at line 1222 of file qp.hpp.

◆ POST_X

#define POST_X ( e_,
margin_,
sender_ )    post_((e_), (margin_), (sender_))

Invoke the direct event posting facility QActive_post_() without delivery guarantee

Description
This macro does not assert if the queue overflows and cannot accept the event with the specified margin of free slots remaining.
Parameters
[in]e_pointer to the event to post
[in]margin_the minimum free slots in the queue, which must still be available after posting the event. The special value QF::NO_MARGIN causes asserting failure in case event posting fails.
[in]sender_pointer to the sender object.
Returns
'true' if the posting succeeded, and 'false' if the posting failed due to insufficient margin of free entries available in the queue.
Note
The sender_ parameter is actually only used when QS tracing is enabled (macro Q_SPY is defined). When QS software tracing is disabled, the POST_X() macro does not pass the sender_ parameter, so the overhead of passing this extra parameter is entirely avoided.
The pointer to the sender object is not necessarily a pointer to an active object. In fact, if POST_X() is called from an interrupt or other context, you can create a unique object just to unambiguously identify the sender of the event.
Traceability

Definition at line 1232 of file qp.hpp.

◆ TICK_X

#define TICK_X ( tickRate_,
sender_ )   tick((tickRate_), (sender_))

Invoke the system clock tick processing QP::QTimeEvt::tick_()

Description
This macro is the recommended way of invoking clock tick processing, because it provides the vital information for software tracing and avoids any overhead when the tracing is disabled.
Parameters
[in]tickRate_clock tick rate to be serviced through this call
[in]sender_pointer to the sender object. This parameter is actually only used when QS software tracing is enabled (macro Q_SPY is defined)
Note
When QS software tracing is disabled, the macro calls QTimeEvt::tick_() without the sender parameter, so the overhead of passing this extra parameter is entirely avoided.
The pointer to the sender object is not necessarily a pointer to an active object. In fact, when TICK_X() is called from an interrupt, you would create a unique object just to unambiguously identify the ISR as the sender of the time events.

Definition at line 1243 of file qp.hpp.

◆ TICK

#define TICK ( sender_)    TICK_X(0U, (sender_))

Invoke the system clock tick processing for tick rate 0

Definition at line 1252 of file qp.hpp.

◆ TRIG

#define TRIG ( sender_)    trig_((sender_))

Asynchronously trigger the QP::QTicker::trig_() AO to perform tick processing.

Description
This macro is the recommended way to trigger clock tick processing, because it provides the vital information for software tracing and avoids any overhead when the tracing is disabled.
Parameters
[in]sender_pointer to the sender object. This parameter is actually only used when QS software tracing is enabled (macro Q_SPY is defined)
Note
When QS software tracing is disabled, the macro calls QTicker_trig_() without the sender parameter, so the overhead of passing this extra parameter is entirely avoided.
The pointer to the sender object is not necessarily a pointer to an active object. In fact, when QTICKER_TRIG() is called from an interrupt, you would create a unique object just to unambiguously identify the ISR as the sender of the time events.

Definition at line 1256 of file qp.hpp.

◆ QF_CRIT_EXIT_NOP

#define QF_CRIT_EXIT_NOP ( )    (static_cast<void>(0))

No-operation for exiting a critical section

Description
In some QF ports the critical section exit takes effect only on the next machine instruction. If this next instruction is another entry to a critical section, the critical section won't be really exited, but rather the two adjacent critical sections would be merged. The QF_CRIT_EXIT_NOP() macro contains minimal code required to prevent such merging of critical sections in such merging of critical sections in QF ports, in which it can occur.

Definition at line 1266 of file qp.hpp.

◆ QF_MEM_SYS

#define QF_MEM_SYS ( )    (static_cast<void>(0))

Definition at line 1271 of file qp.hpp.

◆ QF_MEM_APP

#define QF_MEM_APP ( )    (static_cast<void>(0))

Definition at line 1276 of file qp.hpp.

Typedef Documentation

◆ int_t

int_t = int

Alias for assertion-ID numbers in QP assertions and return from QF_run()

Definition at line 105 of file qp.hpp.

◆ enum_t

using enum_t = int

Definition at line 108 of file qp.hpp.

◆ float32_t

float32_t = float

Alias for IEEE 754 32-bit floating point number

Note
QP does not use floating-point types anywhere in the internal implementation, except in QS software tracing, where utilities for output of floating-point numbers are provided for application-specific trace records.

Definition at line 111 of file qp.hpp.

◆ float64_t

float64_t = double

Alias for IEEE 754 64-bit floating point number

Note
QP does not use floating-point types anywhere in the internal implementation, except in QS software tracing, where utilities for output of floating-point numbers are provided for application-specific trace records.

Definition at line 114 of file qp.hpp.

Function Documentation

◆ QF_onContextSw()

void QF_onContextSw ( QP::QActive * prev,
QP::QActive * next )