QP Framework 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 QP::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. | |
| namespace | QP::QF |
| QF Active Object Framework namespace. | |
Macros | |
| #define | QP_VERSION_STR "8.1.2" |
| Version string complying with Software Versioning specification. | |
| #define | QP_VERSION 812U |
| Version number for internal use (must correspond to QP_VERSION_STR). | |
| #define | QP_RELEASE 0x6A45C1C3U |
| Encrypted current QP release for internal use (7.3.5 on 2024-05-31). | |
| #define | Q_UNUSED_PAR(par_) |
| Helper macro to clearly mark unused parameters of functions. | |
| #define | Q_DIM(array_) |
| #define | Q_UINT2PTR_CAST(type_, uint_) |
| #define | Q_STATE_DECL(state_) |
| #define | Q_STATE_DEF(subclass_, state_) |
| #define | Q_EVT_CAST(subclass_) |
| Perform downcast of an event onto a subclass of QP::QEvt class_. | |
| #define | Q_STATE_CAST(handler_) |
| Perform cast to QP::QStateHandler. | |
| #define | QM_STATE_DECL(state_) |
| #define | QM_ACTION_DECL(action_) |
| #define | QM_STATE_DEF(subclass_, state_) |
| #define | QM_ACTION_DEF(subclass_, action_) |
| #define | INIT(qsId_) |
| #define | DISPATCH(e_, qsId_) |
| #define | Q_PRIO(prio_, pthre_) |
| Create a QP::QPrioSpec object to specify priority of an AO or a thread. | |
| #define | Q_NEW(evtT_, sig_, ...) |
| Macro to allocate a dynamic event and asserting successful allocation. | |
| #define | Q_NEW_X(evtT_, margin_, sig_, ...) |
| Macro to allocate a dynamic event without asserting successful allocation. | |
| #define | Q_NEW_REF(evtRef_, evtT_) |
| Create a new reference of the current event e. | |
| #define | Q_DELETE_REF(evtRef_) |
| Delete the event reference. | |
| #define | PUBLISH(e_, sender_) |
| Publish an event to all subscriber Active Objects. | |
| #define | POST(e_, sender_) |
| Invoke the direct event posting facility QP::QActive::post_(). | |
| #define | POST_X(e_, margin_, sender_) |
| Invoke the direct event posting facility QActive::postx_() without delivery guarantee. | |
| #define | TICK_X(tickRate_, sender_) |
| Invoke the system clock tick processing QP::QTimeEvt::tick_(). | |
| #define | TRIG(sender_) |
| Asynchronously trigger the QP::QTicker::trig_() AO to perform tick processing. | |
| #define | TICK(sender_) |
| Invoke the system clock tick processing for tick rate 0. | |
| #define | QF_CRIT_EXIT_NOP() |
| No-operation for exiting a critical section. | |
Typedefs | |
| using | int_t = int |
| Alias for assertion-ID numbers in QP assertions and return from QP::QF::run(). | |
| using | QP::QSignal = std::uint16_t |
| The signal of event QP::QEvt. | |
| using | QP::QEvtPtr = QEvt const * |
| Pointer to const event instances passed around in QP/C++ Framework. | |
| using | QP::QState = std::uint_fast8_t |
| Type returned from state-handler functions. | |
| using | QP::QStateHandler = QState (*)(void * const me, QEvt const * const e) |
| Pointer to a state-handler function. | |
| using | QP::QActionHandler = QState (*)(void * const me) |
| Pointer to an action-handler function. | |
| using | QP::QXThreadHandler = void (*)(QXThread * const me) |
| Pointer to an extended-thread handler function. | |
| using | QP::QPrioSpec = std::uint16_t |
| Priority specification for Active Objects in QP. | |
| using | QP::QTimeEvtCtr = std::uint32_t |
| Data type to store the block-size defined based on the macro QF_TIMEEVT_CTR_SIZE. | |
| using | QP::QPSetBits = std::uint32_t |
| Bitmask for the internal representation of QPSet elements. | |
Functions | |
| char const * | QP::version () noexcept |
| std::uint_fast8_t | QP::QF_LOG2 (QP::QPSetBits const bitmask) noexcept |
| void | QP::QF::init () |
| QF initialization. | |
| void | QP::QF::stop () |
| Invoked by the application layer to stop the QF framework and return control to the OS/Kernel (used in some QF ports). | |
| int_t | QP::QF::run () |
| Transfers control to QF to run the application. | |
| void | QP::QF::onStartup () |
| Startup QF callback. | |
| void | QP::QF::onCleanup () |
| Cleanup QF callback. | |
| void | QP::QF::psInit (QSubscrList *const subscrSto, QSignal const maxSignal) noexcept |
| void | QP::QF::publish_ (QEvt const *const e, void const *const sender, std::uint_fast8_t const qsId) noexcept |
| static std::uint_fast16_t | QP::QF::getQueueMin (std::uint_fast8_t const prio) noexcept |
| This function returns the minimum of free entries of the given event queue. | |
| void | QP::QF::tick (std::uint_fast8_t const tickRate, void const *const sender) noexcept |
| void | QP::QF::poolInit (void *const poolSto, std::uint_fast32_t const poolSize, std::uint_fast16_t const evtSize) noexcept |
| Event pool initialization for dynamic allocation of events. | |
| std::uint16_t | QP::QF::poolGetMaxBlockSize () noexcept |
| Obtain the block size of any registered event pools. | |
| std::uint16_t | QP::QF::getPoolUse (std::uint_fast8_t const poolNum) noexcept |
| std::uint16_t | QP::QF::getPoolFree (std::uint_fast8_t const poolNum) noexcept |
| std::uint16_t | QP::QF::getPoolMin (std::uint_fast8_t const poolNum) noexcept |
| Obtain the minimum of free entries of the given event pool. | |
| QEvt * | QP::QF::newX_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, QSignal const sig) noexcept |
| void | QP::QF::gc (QEvt const *const e) noexcept |
| Recycle a mutable (mutable) event. | |
| QEvt const * | QP::QF::newRef_ (QEvt const *const e, QEvt const *const evtRef) noexcept |
| void | QP::QF::deleteRef_ (QEvt const *const evtRef) noexcept |
| template<class evtT_, typename... Args> | |
| evtT_ * | QP::QF::q_new (QSignal const sig, Args... args) |
| template<class evtT_, typename... Args> | |
| evtT_ * | QP::QF::q_new_x (std::uint_fast16_t const margin, QSignal const sig, Args... args) |
| template<class evtT_> | |
| void | QP::QF::q_new_ref (QP::QEvt const *const e, evtT_ const *&evtRef) |
| Create a new reference of the current event e. | |
| template<class evtT_> | |
| void | QP::QF::q_delete_ref (evtT_ const *&evtRef) |
| Delete a new reference of the current event e. | |
| QEvt * | QP::QF::newXfromISR_ (std::uint_fast16_t const evtSize, std::uint_fast16_t const margin, QSignal const sig) noexcept |
| void | QP::QF::gcFromISR (QEvt const *e) noexcept |
| void | QF_onContextSw (QP::QActive *prev, QP::QActive *next) |
Variables | |
| constexpr QSignal | QP::Q_USER_SIG {4U} |
| constexpr std::uint_fast16_t | QP::QF::NO_MARGIN {0xFFFFU} |
| Special value of margin that causes asserting failure in case event allocation or event posting fails. | |
| #define QP_VERSION_STR "8.1.2" |
Version string complying with Software Versioning specification.
Details
QP_VERSION_STR is a zero-terminated version string in the form MAJOR.MINOR.PATCH compliant with Software Versioning specification.
Examples
Backward Traceability
Forward Traceability
| #define QP_VERSION 812U |
Version number for internal use (must correspond to QP_VERSION_STR).
Details
QP_VERSION is an unsigned integer constant of the form MAJOR|MINOR|PATCH corresponding to QP_VERSION_STR, with digits merged together. For example QP_VERSION_STR == "7.3.5-rc.1" results in QP_VERSION == 735.
| #define QP_RELEASE 0x6A45C1C3U |
Encrypted current QP release for internal use (7.3.5 on 2024-05-31).
Details
QP_RELEASE contains information about QP_VERSION (e.g., 735) and release date (e.g., 2023-06-30).
| #define Q_UNUSED_PAR | ( | par_ | ) |
| #define Q_DIM | ( | array_ | ) |
| #define Q_UINT2PTR_CAST | ( | type_, | |
| uint_ ) |
| #define Q_STATE_DECL | ( | state_ | ) |
| #define Q_STATE_DEF | ( | subclass_, | |
| state_ ) |
| #define Q_EVT_CAST | ( | subclass_ | ) |
Perform downcast of an event onto a subclass of QP::QEvt class_.
Details
This macro encapsulates the downcast of QP::QEvt pointers, which violates MISRA-C:2025 Rule 11.3(R). This macro helps to localize this deviation.
| subclass_ | a subclass of QP::QEvt |
Usage
Backward Traceability
Forward Traceability
| #define Q_STATE_CAST | ( | handler_ | ) |
Perform cast to QP::QStateHandler.
Details
This macro encapsulates the cast of a specific state handler function pointer to QP::QStateHandler, which violates MISRA:C++2023 Rule 8.2.4 and Rule 8.2.5. This macro helps to localize these deviations.
| handler_ | state handler (function pointer) |
Usage
Forward Traceability
| #define QM_STATE_DECL | ( | state_ | ) |
| #define QM_ACTION_DECL | ( | action_ | ) |
| #define QM_STATE_DEF | ( | subclass_, | |
| state_ ) |
| #define QM_ACTION_DEF | ( | subclass_, | |
| action_ ) |
| #define Q_PRIO | ( | prio_, | |
| pthre_ ) |
Create a QP::QPrioSpec object to specify priority of an AO or a thread.
| [in] | prio_ | QF priority [1..QF_MAX_ACTIVE] |
| [in] | pthre_ | Preemption threshold [1..QF_MAX_ACTIVE] |
| #define Q_NEW | ( | evtT_, | |
| sig_, | |||
| ... ) |
Macro to allocate a dynamic event and asserting successful allocation.
Details
This deprecated macro is equivalent to invoking the function template QP::QF::q_new<evtT_>(sig_, ...).
| [in] | evtT_ | event type (class name) of the event to allocate |
| [in] | sig_ | signal to assign to the newly allocated event |
| #define Q_NEW_X | ( | evtT_, | |
| margin_, | |||
| sig_, | |||
| ... ) |
Macro to allocate a dynamic event without asserting successful allocation.
Details
This deprecated macro is equivalent to invoking the function template QP::QF::q_new_x<evtT_>(margin_, sig_, ...).
| [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 |
| #define Q_NEW_REF | ( | evtRef_, | |
| evtT_ ) |
Create a new reference of the current event e.
Details
This deprecated macro is equivalent to invoking the function template QP::QF::q_new_ref<evtT_>(e, evtRef).
| [in,out] | evtRef_ | event reference to create |
| [in] | evtT_ | event type (class name) of the event reference |
| #define Q_DELETE_REF | ( | evtRef_ | ) |
Delete the event reference.
Details
This deprecated macro is equivalent to invoking the function template QP::QF::q_new_ref<evtT_>(e, evtRef).
| [in,out] | evtRef_ | event reference to delete |
| #define PUBLISH | ( | e_, | |
| sender_ ) |
Publish an event to all subscriber Active Objects.
Details
If Q_SPY is defined, this macro calls QP::QActive::publish_() with the sender_ parameter to identify the publisher of the event. Otherwise, sender_ is not used.
| [in] | e_ | pointer to the posted event |
| [in] | sender_ | pointer to the sender object (actually used only when Q_SPY is defined) |
| #define POST | ( | e_, | |
| sender_ ) |
Invoke the direct event posting facility QP::QActive::post_().
Details
This macro asserts if the queue overflows and cannot accept the event.
| [in] | e_ | pointer to the event to post |
| [in] | sender_ | pointer to the sender object. |
| #define POST_X | ( | e_, | |
| margin_, | |||
| sender_ ) |
Invoke the direct event posting facility QActive::postx_() without delivery guarantee.
Details
This macro does not assert if the queue overflows and cannot accept the event with the specified margin of free slots remaining.
| [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. |
Backward Traceability
| #define TICK_X | ( | tickRate_, | |
| sender_ ) |
Invoke the system clock tick processing QP::QTimeEvt::tick_().
Details
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.
| [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) |
| #define TRIG | ( | sender_ | ) |
Asynchronously trigger the QP::QTicker::trig_() AO to perform tick processing.
Details
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.
| [in] | sender_ | pointer to the sender object. This parameter is actually only used when QS software tracing is enabled (macro Q_SPY is defined) |
| #define TICK | ( | sender_ | ) |
Invoke the system clock tick processing for tick rate 0.
| [in] | sender_ | pointer to the sender object. This parameter is actually only used when QS software tracing is enabled (macro Q_SPY is defined) |
| #define QF_CRIT_EXIT_NOP | ( | ) |
No-operation for exiting a critical section.
Details
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.
| using int_t = int |
Alias for assertion-ID numbers in QP assertions and return from QP::QF::run().
| void QF_onContextSw | ( | QP::QActive * | prev, |
| QP::QActive * | next ) |