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} |
QP/C++ platform-independent public interface.
Definition in file qp.hpp.
| #define QP_VERSION 734U |
The current QP version as an unsigned number
| #define QP_VERSION_STR "7.3.4" |
The current QP version as a zero terminated string literal.
| #define QP_RELEASE 0x70C1EA11U |
| #define Q_STATE_DECL | ( | state_ | ) |
| #define Q_STATE_DEF | ( | subclass_, | |
| state_ ) |
| #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.
| #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.
| #define Q_EVT_CAST | ( | subclass_ | ) | (static_cast<subclass_ const *>(e)) |
Perform downcast of an event onto a subclass of QP::QEvt class_
| subclass_ | a subclass of QP::QEvt |
e.| #define Q_STATE_CAST | ( | handler_ | ) | (reinterpret_cast<QP::QStateHandler>(handler_)) |
Perform cast to QP::QStateHandler.
| handler_ | state handler (function pointer) |
| #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) |
Indicate that an internal transition has been "unhandled" due to a guard condition. Applicable only to QP::QMsm subclasses.
| #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_)) |
Perform cast from unsigned integer uint_ to pointer of type type_
| #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
| [in] | prio_ | QF priority [1..QF_MAX_ACTIVE] |
| [in] | pthre_ | Preemption threshold [1..QF_MAX_ACTIVE] |
prio_ in bits [0..7] and pthre_ in bits [8..15]. | #define Q_NEW | ( | evtT_, | |
| sig_, | |||
| ... ) |
Allocate a mutable (dynamic) event.
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.
| [in] | evtT_ | event type (class name) of the event to allocate |
| [in] | sig_ | signal to assign to the newly allocated event |
me).evtT_.| #define Q_NEW_X | ( | evtT_, | |
| margin_, | |||
| sig_, | |||
| ... ) |
Non-asserting allocate a mutable (dynamic) event.
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.| [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 |
evtT_ or NULL if the event cannot be allocated with the specified margin of events still left in the event pool.| #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
| [in,out] | evtRef_ | event reference to create |
| [in] | evtT_ | event type (class name) of the event reference |
examples/win32/defer illustrates the use of Q_NEW_REF() | #define Q_DELETE_REF | ( | evtRef_ | ) |
Delete the event reference
| [in,out] | evtRef_ | event reference to delete |
examples/win32/defer illustrates the use of Q_DELETE_REF() | #define PUBLISH | ( | e_, | |
| sender_ ) publish_((e_), (sender_), (sender_)->getPrio()) |
Publish an event to all subscriber Active Objects.
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) |
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. | #define POST | ( | e_, | |
| sender_ ) post_((e_), QP::QF::NO_MARGIN, (sender_)) |
Invoke the direct event posting facility QActive_post_()
| [in] | e_ | pointer to the event to post |
| [in] | sender_ | pointer to the sender object. |
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.| #define POST_X | ( | e_, | |
| margin_, | |||
| sender_ ) post_((e_), (margin_), (sender_)) |
Invoke the direct event posting facility QActive_post_() without delivery guarantee
| [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. |
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.| #define TICK_X | ( | tickRate_, | |
| sender_ ) tick((tickRate_), (sender_)) |
Invoke the system clock tick processing QP::QTimeEvt::tick_()
| [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) |
sender parameter, so the overhead of passing this extra parameter is entirely avoided.| #define TICK | ( | sender_ | ) | TICK_X(0U, (sender_)) |
| #define TRIG | ( | sender_ | ) | trig_((sender_)) |
Asynchronously trigger the QP::QTicker::trig_() AO to perform tick processing.
| [in] | sender_ | pointer to the sender object. This parameter is actually only used when QS software tracing is enabled (macro Q_SPY is defined) |
sender parameter, so the overhead of passing this extra parameter is entirely avoided.| #define QF_CRIT_EXIT_NOP | ( | ) | (static_cast<void>(0)) |
No-operation for exiting a critical section
| int_t = int |
| float32_t = float |
Alias for IEEE 754 32-bit floating point number
| float64_t = double |
Alias for IEEE 754 64-bit floating point number
| void QF_onContextSw | ( | QP::QActive * | prev, |
| QP::QActive * | next ) |