#include <qf.h>
Protected Member Functions | |
void | QActive_ctor (QActive *const me, QStateHandler initial) |
void | QActive_stop (QActive *const me) |
void | QActive_subscribe (QActive const *const me, enum_t const sig) |
void | QActive_unsubscribe (QActive const *const me, enum_t const sig) |
void | QActive_unsubscribeAll (QActive const *const me) |
bool | QActive_defer (QActive const *const me, QEQueue *const eq, QEvt const *const e) |
bool | QActive_recall (QActive *const me, QEQueue *const eq) |
uint_fast16_t | QActive_flushDeferred (QActive const *const me, QEQueue *const eq) |
void | QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2) |
![]() | |
void | QHsm_ctor (QHsm *const me, QStateHandler initial) |
QState | QHsm_top (void const *const me, QEvt const *const e) |
Protected Attributes | |
QHsm | super |
Private Member Functions | |
bool | QActive_post_ (QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender) |
void | QActive_postLIFO_ (QActive *const me, QEvt const *const e) |
QEvt const * | QActive_get_ (QActive *const me) |
void | QActive_start_ (QActive *const me, uint_fast8_t prio, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par) |
Private Attributes | |
uint8_t | prio |
Additional Inherited Members | |
![]() | |
QStateHandler | QHsm_childState (QHsm *const me, QStateHandler const parent) |
bool | QHsm_isIn (QHsm *const me, QStateHandler const state) |
![]() | |
static QStateHandler | QHsm_state (QHsm *const me) |
Active Object base class (based on QHsm implementation)
Active objects in QP are encapsulated state machines (each embedding an event queue and a thread) that communicate with one another asynchronously by sending and receiving events. Within an active object, events are processed sequentially in a run-to-completion (RTC) fashion, while QF encapsulates all the details of thread-safe event exchange and queuing.
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.
super
is defined as the first member of the derived struct (see oop).
|
protected |
protected "constructor" of an QActive active object
Performs the first step of active object initialization by assigning the virtual pointer and calling the superclass constructor.
[in,out] | me | pointer (see oop) |
[in] | initial | pointer to the event to be dispatched to the MSM |
|
protected |
Stops execution of an active object and removes it from the framework's supervision.
Subscribes for delivery of signal sig
to the active object me
.
This function is part of the Publish-Subscribe event delivery mechanism available in QF. Subscribing to an event means that the framework will start posting all published events with a given signal sig
to the event queue of the active object me
.
[in,out] | me | pointer (see oop) |
[in] | sig | event signal to subscribe |
Un-subscribes from the delivery of signal sig
to the AO me
.
This function is part of the Publish-Subscribe event delivery mechanism available in QF. Un-subscribing from an event means that the framework will stop posting published events with a given signal sig
to the event queue of the active object me
.
[in] | me | pointer (see oop) |
[in] | sig | event signal to unsubscribe |
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.
|
protected |
Un-subscribes from the delivery of all signals to the AO me
.
This function is part of the Publish-Subscribe event delivery mechanism available in QF. Un-subscribing from all events means that the framework will stop posting any published events to the event queue of the active object me
.
[in] | me | pointer (see oop) |
Defer an event e
to a given event queue eq
.
This function is part of the event deferral support. An active object uses this function to defer an event 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,out] | me | pointer (see oop) |
[in] | eq | pointer to a "raw" thread-safe queue to recall an event from. |
[in] | e | pointer to the event to be deferred |
An active object can use multiple event queues to defer events of different kinds.
Definition at line 71 of file qf_defer.c.
Recall a deferred event from a given event queue eq
.
This function is part of the event deferral support. An active object uses this function to recall a deferred event from a given QF event queue. Recalling an event means that it is removed from the deferred event queue eq
and posted (LIFO) to the event queue of the active object.
[in,out] | me | pointer (see oop) |
[in] | eq | pointer to a "raw" thread-safe queue to recall an event from. |
Definition at line 111 of file qf_defer.c.
Flush the specified deferred queue eq
.
This function is part of the event deferral support. An active object can use this function to flush a given QF event queue. The function makes sure that the events are not leaked.
[in,out] | me | pointer (see oop) |
[in] | eq | pointer to a "raw" thread-safe queue to flush. |
Definition at line 181 of file qf_defer.c.
|
protected |
Generic setting of additional attributes (useful in QP ports)
|
private |
Direct event posting is the simplest asynchronous communication method available in QF.
[in,out] | me | pointer (see oop) |
[in] | e | pointer to the event to be posted |
[in] | margin | number of required free slots in the queue after posting the event. The special value QF_NO_MARGIN means that this function will assert if posting fails. |
[in] | sender | pointer to a sender object (used only for QS tracing) |
margin
parameter is special and denotes situation when the post() operation is assumed to succeed (event delivery guarantee). An assertion fires, when the event cannot be delivered in this case.Prototype of the internal active object post (FIFO) implementation.
posts an event to the event queue of the active object me
using the Last-In-First-Out (LIFO) policy.
[in] | me | pointer (see oop) |
[in] | e | pointer to the event to post to the queue |
Prototype of the internal active object post LIFO implementation.
The behavior of this function depends on the kernel/OS used in the QF port. For built-in kernels (QV or QK) the function can be called only when the queue is not empty, so it doesn't block. For a blocking kernel/OS the function can block and wait for delivery of an event.
[in,out] | me | pointer (see oop) |
Get an event from the event queue of an active object.
|
private |
QF priority (1..QF_MAX_ACTIVE) of this active object.