Active object class (based on the QHsm implementation strategy) More...
#include "qp.hpp"
Public Member Functions | |
void | init (void const *const e, std::uint_fast8_t const qs_id) override |
void | init (std::uint_fast8_t const qs_id) override |
void | dispatch (QEvt const *const e, std::uint_fast8_t const qs_id) override |
void | setAttr (std::uint32_t attr1, void const *attr2=nullptr) |
void | start (QPrioSpec const prioSpec, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize, void const *const par) |
void | start (QPrioSpec const prioSpec, QEvt const **const qSto, std::uint_fast16_t const qLen, void *const stkSto, std::uint_fast16_t const stkSize) |
void | stop () |
void | register_ () noexcept |
void | unregister_ () noexcept |
bool | post_ (QEvt const *const e, std::uint_fast16_t const margin, void const *const sender) noexcept |
void | postLIFO (QEvt const *const e) noexcept |
QEvt const * | get_ () noexcept |
void | subscribe (enum_t const sig) const noexcept |
void | unsubscribe (enum_t const sig) const noexcept |
void | unsubscribeAll () const noexcept |
bool | defer (QEQueue *const eq, QEvt const *const e) const noexcept |
bool | recall (QEQueue *const eq) noexcept |
std::uint_fast16_t | flushDeferred (QEQueue *const eq, std::uint_fast16_t const num=0xFFFFU) const noexcept |
std::uint_fast8_t | getPrio () const noexcept |
void | setPrio (QPrioSpec const prio) noexcept |
std::uint_fast8_t | getPThre () const noexcept |
QACTIVE_EQUEUE_TYPE const & | getEQueue () const noexcept |
QACTIVE_OS_OBJ_TYPE const & | getOsObject () const noexcept |
QACTIVE_THREAD_TYPE const & | getThread () const noexcept |
void | setThread (QACTIVE_THREAD_TYPE const &thr) |
virtual bool | postFromISR (QEvt const *const e, std::uint_fast16_t const margin, void *par, void const *const sender) noexcept |
![]() | |
virtual void | init (void const *const e, std::uint_fast8_t const qs_id)=0 |
virtual void | init (std::uint_fast8_t const qs_id) |
virtual void | dispatch (QEvt const *const e, std::uint_fast8_t const qs_id)=0 |
virtual QStateHandler | getStateHandler () noexcept |
Static Public Member Functions | |
static std::uint_fast16_t | getQueueMin (std::uint_fast8_t const prio) noexcept |
static void | psInit (QSubscrList *const subscrSto, enum_t const maxSignal) noexcept |
static void | publish_ (QEvt const *const e, void const *const sender, std::uint_fast8_t const qs_id) noexcept |
static void | evtLoop_ (QActive *act) |
static void | publishFromISR (QEvt const *e, void *par, void const *sender) noexcept |
![]() | |
static QState | top (void *const me, QEvt const *const e) noexcept |
Public Attributes | |
std::uint8_t | m_prio_dis |
std::uint8_t | m_pthre_dis |
Static Public Attributes | |
static QActive * | registry_ [QF_MAX_ACTIVE+1U] |
static QSubscrList * | subscrList_ |
static enum_t | maxPubSignal_ |
Protected Member Functions | |
QActive (QStateHandler const initial) noexcept | |
![]() | |
QAsm () noexcept | |
QState | tran (QStateHandler const target) noexcept |
QState | tran_hist (QStateHandler const hist) noexcept |
QState | super (QStateHandler const superstate) noexcept |
QState | qm_tran (void const *const tatbl) noexcept |
QState | qm_tran_init (void const *const tatbl) noexcept |
QState | qm_tran_hist (QMState const *const hist, void const *const tatbl) noexcept |
QState | qm_tran_ep (void const *const tatbl) noexcept |
QState | qm_tran_xp (QActionHandler const xp, void const *const tatbl) noexcept |
QState | qm_entry (QMState const *const s) noexcept |
QState | qm_exit (QMState const *const s) noexcept |
QState | qm_sm_exit (QMState const *const s) noexcept |
QState | qm_super_sub (QMState const *const s) noexcept |
Protected Attributes | |
std::uint8_t | m_prio |
std::uint8_t | m_pthre |
QACTIVE_THREAD_TYPE | m_thread |
QACTIVE_OS_OBJ_TYPE | m_osObject |
QACTIVE_EQUEUE_TYPE | m_eQueue |
![]() | |
QAsmAttr | m_state |
QAsmAttr | m_temp |
Friends | |
class | QTimeEvt |
class | QTicker |
class | QXThread |
class | QXMutex |
class | QXSemaphore |
class | QActiveDummy |
class | GuiQActive |
class | GuiQMActive |
void | schedLock () |
Additional Inherited Members | |
![]() | |
enum | QStateRet : QState { Q_RET_SUPER , Q_RET_SUPER_SUB , Q_RET_UNHANDLED , Q_RET_HANDLED , Q_RET_IGNORED , Q_RET_ENTRY , Q_RET_EXIT , Q_RET_NULL , Q_RET_TRAN , Q_RET_TRAN_INIT , Q_RET_TRAN_EP , Q_RET_TRAN_HIST , Q_RET_TRAN_XP } |
enum | ReservedSig : QSignal { Q_EMPTY_SIG , Q_ENTRY_SIG , Q_EXIT_SIG , Q_INIT_SIG } |
Reserved signals by the QP-framework. More... | |
Active object class (based on the QHsm implementation strategy)
QP::QActive represents an active object that uses the QHsm-style implementation strategy for state machines. This strategy is tailored to manual coding, but it is also supported by the QM modeling tool. The resulting code is slower than in the QMsm-style implementation strategy.
|
inlineexplicitprotectednoexcept |
|
inlineoverridevirtual |
Take the top-most initial transition.
[in] | e | pointer to an initialization parameter (might be nullptr) |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
qep_asm:200
Implements QP::QAsm.
Reimplemented in QP::QMActive, QP::QTicker, QP::QActiveDummy, and QP::QXThread.
|
inlineoverridevirtual |
Take the top-most initial transition (overloaded version).
[in] | qs_id | QS-id of this state machine (for QS local filter) |
Reimplemented from QP::QAsm.
Reimplemented in QP::QMActive, QP::QTicker, and QP::QXThread.
|
inlineoverridevirtual |
Dispatch an event to a state machine
[in] | e | pointer to the event to be dispatched to the MSM |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
qep_asm:302
Implements QP::QAsm.
Reimplemented in QP::QMActive, QP::QTicker, QP::QActiveDummy, and QP::QXThread.
QP::QActive::setAttr | ( | std::uint32_t | attr1, |
void const * | attr2 = nullptr |
||
) |
Generic setting of additional attributes (defined in some QP ports)
QP::QActive::start | ( | QPrioSpec const | prioSpec, |
QEvt const **const | qSto, | ||
std::uint_fast16_t const | qLen, | ||
void *const | stkSto, | ||
std::uint_fast16_t const | stkSize, | ||
void const *const | par | ||
) |
Starts execution of an active object and registers the object with the framework
[in] | prioSpec | priority specification for the AO (See QP::QPrioSpec) |
[in] | qSto | pointer to the storage for the ring buffer of the event queue |
[in] | qLen | length of the event queue [# QP::QEvt* pointers] |
[in] | stkSto | pointer to the stack storage (might be NULL) |
[in] | stkSize | stack size [bytes] |
[in] | par | pointer to an extra parameter (might be NULL) |
|
inline |
Starts execution of an active object and registers the object with the framework
[in] | prioSpec | priority specification for the AO (See QP::QPrioSpec) |
[in] | qSto | pointer to the storage for the ring buffer of the event queue |
[in] | qLen | length of the event queue [# QP::QEvt* pointers] |
[in] | stkSto | pointer to the stack storage (might be NULL) |
[in] | stkSize | stack size [bytes] |
QP::QActive::stop | ( | ) |
Stops execution of an active object and removes it from the framework's supervision
Definition at line 259 of file qutest.cpp.
|
noexcept |
Register this active object to be managed by the framework
qf_qact:100
qf_qact:190
Definition at line 76 of file qf_qact.cpp.
|
noexcept |
Un-register the active object from the framework
qf_qact:200
Definition at line 132 of file qf_qact.cpp.
|
noexcept |
Posts an event e
directly to the event queue of the active object using the First-In-First-Out (FIFO) policy.
[in] | e | pointer to the event to be posted |
[in] | margin | number of required free slots in the queue after posting the event or QF::NO_MARGIN. |
[in] | sender | pointer to a sender object (used in QS only) |
qf_actq:102
qf_actq:190
margin
== QF::NO_MARGIN)sender
might be defined/provided only in the Spy build configuration (see Q_SPY). The macros ignore the sender
parameter outside the Spy configuration, so the same code builds correctly in all configurations.Definition at line 71 of file qf_actq.cpp.
|
noexcept |
Posts an event e
directly to the event queue of the active object using the Last-In-First-Out (LIFO) policy.
[in] | e | pointer to the event to be posted |
qf_actq:200
qf_actq:201
Definition at line 221 of file qf_actq.cpp.
|
noexcept |
Get an event from the event queue of an active object
Definition at line 308 of file qf_actq.cpp.
|
staticnoexcept |
|
staticnoexcept |
Publish event to all subscribers of a given signal e->sig
e
to all active objects that have subscribed to the signal e
->sig, which is called multicasting. The multicasting performed in this function is very efficient based on reference-counting inside the published event ("zero-copy" event multicasting). This function is designed to be callable from any part of the system, including ISRs, device drivers, and active objects.
|
staticnoexcept |
Publish event to all subscribers of a given signal e->sig
e
to all active objects that have subscribed to the signal e
->sig, which is called multicasting. The multicasting performed in this function is very efficient based on reference-counting inside the published event ("zero-copy" event multicasting). This function is designed to be callable from any part of the system, including ISRs, device drivers, and active objects.qf_ps:200
qf_ps:202
qs_id
might be defined/provided only in the Spy build configuration (see Q_SPY). The macro ignores the qs_id
parameter outside the Spy configuration, so the same code builds correctly in all configurations.
|
noexcept |
Subscribes for delivery of signal sig
to the active object
sig
to the event queue of the active object.[in] | sig | event signal to subscribe |
qf_ps:300
qf_ps:302
|
noexcept |
Unsubscribes from the delivery of signal sig
to the active object
sig
to the event queue of the active object.[in] | sig | event signal to unsubscribe |
qf_ps:400
qf_ps:402
sig
will never be dispatched to the state machine of the active object after un-subscribing from that signal. The event might be already in the queue, or just about to be posted and the un-subscribe operation will not flush such events.
|
noexcept |
Unsubscribes from the delivery of all signals to the active object
qf_ps:500
Defer an event to a given separate event queue
e
to the QF-supported native event queue eq
. QF correctly accounts for another outstanding reference to the event and will not recycle the event at the end of the RTC step. Later, the active object might recall one event at a time from the event queue.[in] | eq | pointer to a "raw" thread-safe queue to recall an event from. |
[in] | e | pointer to the event to be deferred |
Definition at line 70 of file qf_defer.cpp.
|
noexcept |
Recall a deferred event from a given event queue
eq
and posted (LIFO) to the event queue of the active object.[in] | eq | pointer to a "raw" thread-safe queue to recall an event from. |
Definition at line 99 of file qf_defer.cpp.
|
noexcept |
Flush the specified deferred queue eq
[in] | eq | pointer to a "raw" thread-safe queue to flush. |
Definition at line 161 of file qf_defer.cpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
static |
Event loop thread routine for executing an active object act
(defined some in QP ports)
|
virtualnoexcept |
The "FromISR" variant used in the QP port to "FreeRTOS"
|
staticnoexcept |
The "FromISR" variant used in the QP port to "FreeRTOS"
|
friend |
|
friend |
|
friend |
|
protected |
QF-priority [1..QF_MAX_ACTIVE] of this AO.
|
protected |
Preemption-threshold [1..QF_MAX_ACTIVE] of this AO.
|
protected |
Port-dependent representation of the thread of the active object
|
protected |
|
protected |
Port-dependent event-queue type (often QP::QEQueue)
|
static |
|
static |
|
static |