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 qsId) override |
Virtual function to take the top-most initial transition in the state machine. | |
void | init (std::uint_fast8_t const qsId) override |
Virtual function to take the top-most initial transition in the state machine (overloaded). | |
void | dispatch (QEvt const *const e, std::uint_fast8_t const qsId) override |
Virtual function to dispatch an event to the state machine. | |
bool | isIn (QStateHandler const state) noexcept override |
Virtual function to check whether the state machine is in a given state. | |
QStateHandler | childState (QStateHandler const parent) noexcept |
void | setAttr (std::uint32_t attr1, void const *attr2=nullptr) |
void | start (QPrioSpec const prioSpec, QEvtPtr *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, QEvtPtr *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 |
Public Member Functions inherited from QP::QAsm | |
virtual | ~QAsm () noexcept |
Virtual destructor of the QP::QAsm abstract base class. | |
QStateHandler | state () const noexcept |
QMState const * | stateObj () const noexcept |
virtual QStateHandler | getStateHandler () noexcept |
Virtual method for getting the state handler. | |
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 qsId) noexcept |
static void | evtLoop_ (QActive *act) |
static void | publishFromISR (QEvt const *e, void *par, void const *sender) noexcept |
Static Public Member Functions inherited from QP::QAsm | |
static QState | top (void *const me, QEvt const *const e) noexcept |
Top state handler that ignores all events. | |
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 | |
Protected Member Functions inherited from QP::QAsm | |
QAsm () noexcept | |
Constructor of the QP::QAsm base class. | |
QState | tran (QStateHandler const target) noexcept |
Internal helper function to take a state transition in sublclasses of QP::QAsm. | |
QState | tran_hist (QStateHandler const hist) noexcept |
Internal helper function to take a state transition to history in sublclasses of QP::QAsm. | |
QState | super (QStateHandler const superstate) noexcept |
Internal helper function to indicate superstate of a given state in sublclasses of QP::QAsm. | |
QState | qm_tran (void const *const tatbl) noexcept |
Internal helper function to take a state transition in QP::QMsm. | |
QState | qm_tran_init (void const *const tatbl) noexcept |
QState | qm_tran_hist (QMState const *const hist, void const *const tatbl) noexcept |
Internal helper function to take a state transition to history in QP::QMsm. | |
QState | qm_entry (QMState const *const s) noexcept |
Internal helper function to execute state entry actions in QP::QMsm. | |
QState | qm_exit (QMState const *const s) noexcept |
Internal helper function to execute state exit actions in QP::QMsm. | |
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 |
Protected Attributes inherited from QP::QAsm | |
QAsmAttr | m_state |
Current state (pointer to the current state-handler function) | |
QAsmAttr | m_temp |
Temporary storage for target/act-table etc. | |
Friends | |
class | QTimeEvt |
class | QTicker |
class | QXThread |
class | QXMutex |
class | QXSemaphore |
class | QActiveDummy |
class | GuiQActive |
class | GuiQMActive |
void | schedLock () |
Additional Inherited Members | |
Public Types inherited from QP::QAsm | |
enum | QStateRet : QState { Q_RET_SUPER , 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_HIST } |
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 |
Virtual function to take the top-most initial transition in the state machine.
[in] | e | pointer to an initialization parameter (might be nullptr) |
[in] | qsId | QS-id of this state machine (for QS local filter) |
Implements QP::QAsm.
Reimplemented in QP::QMActive, and QP::QTicker.
|
inlineoverridevirtual |
Virtual function to take the top-most initial transition in the state machine (overloaded).
[in] | qsId | QS-id of this state machine (for QS local filter) |
Reimplemented from QP::QAsm.
Reimplemented in QP::QMActive, and QP::QTicker.
|
inlineoverridevirtual |
Virtual function to dispatch an event to the state machine.
[in] | e | pointer to the event to be dispatched to the MSM |
[in] | qsId | QS-id of this state machine (for QS local filter) |
Implements QP::QAsm.
Reimplemented in QP::QMActive, and QP::QTicker.
|
inlineoverridevirtualnoexcept |
Virtual function to check whether the state machine is in a given state.
[in] | state | pointer to the state-handler function to be checked |
state
and 'false' otherwiseqep_hsm:602
Reimplemented from QP::QAsm.
Reimplemented in QP::QMActive.
|
inlinenoexcept |
void QP::QActive::setAttr | ( | std::uint32_t | attr1, |
void const * | attr2 = nullptr ) |
Generic setting of additional attributes (defined in some QP ports)
void QP::QActive::stop | ( | ) |
Stops execution of an active object and removes it from the framework's supervision
|
noexcept |
Register this active object to be managed by the framework
qf_qact:100
qf_qact:190
Definition at line 67 of file qf_qact.cpp.
|
noexcept |
Un-register the active object from the framework
qf_qact:200
Definition at line 123 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:110
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 62 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 247 of file qf_actq.cpp.
|
noexcept |
Get an event from the event queue of an active object
Definition at line 355 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
qsId
might be defined/provided only in the Spy build configuration (see Q_SPY). The macro ignores the qsId
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 61 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 90 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 152 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 |