QP/C  7.0.0
Real-Time Embedded Framework
QMActive Struct Reference

#include <qf.h>

Inheritance diagram for QMActive:
QActive QHsm

Protected Member Functions

void QMActive_ctor (QMActive *const me, QStateHandler initial)
 
- Protected Member Functions inherited from QActive
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)
 
- Protected Member Functions inherited from QHsm
void QHsm_ctor (QHsm *const me, QStateHandler initial)
 
QState QHsm_top (void const *const me, QEvt const *const e)
 

Protected Attributes

QActive super
 
- Protected Attributes inherited from QActive
QHsm super
 

Additional Inherited Members

- Public Member Functions inherited from QHsm
QStateHandler QHsm_childState (QHsm *const me, QStateHandler const parent)
 
bool QHsm_isIn (QHsm *const me, QStateHandler const state)
 
- Static Public Member Functions inherited from QHsm
static QStateHandler QHsm_state (QHsm *const me)
 

Detailed Description

QMActive active object base class (based on QMsm implementation)

QMActive represents an active object that uses the QMsm style state machine implementation strategy. This strategy requires the use of the QM modeling tool to generate state machine code automatically, but the code is faster than in the QHsm style implementation strategy and needs less run-time support (smaller event-processor).

Note
QMActive is not intended to be instantiated directly, but rather serves as the base class for derivation of active objects in the application.
Traceability:
traces to: AQP214
Usage
The following example illustrates how to derive an active object from QMActive. Please note that the QActive member super is defined as the first member of the derived struct (see oop).
typedef struct {
QMActive super; /* inherits QMActive */
QTimeEvt timeEvt; /* to timeout the blinking */
} Blinky;
. . .
void Blinky_ctor(Blinky * const me) {
/* constructor of the superclass <--- */
QMActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial));
/* constructor(s) of the members */
QTimeEvt_ctorX(&me->timeEvt, &me->super, TIMEOUT_SIG, 0U);
}
#define Q_STATE_CAST(handler_)
Definition: qep.h:196
Definition: qf.h:378
void QMActive_ctor(QMActive *const me, QStateHandler initial)
Definition: qf_qmact.c:66
QActive super
Definition: qf.h:379
Definition: qf.h:456

Definition at line 378 of file qf.h.

Member Function Documentation

◆ QMActive_ctor()

void QMActive_ctor ( QMActive *const  me,
QStateHandler  initial 
)
protected

protected "constructor" of an QMActive active object.

Performs the first step of active object initialization by assigning the virtual pointer and calling the superclass constructor.

Parameters
[in,out]mepointer (see oop)
[in]initialpointer to the event to be dispatched to the MSM
Note
Must be called only ONCE before QMSM_INIT().
See also
QHsm_ctor()
Note
QMActive inherits QActive, so by the oop convention it should call the constructor of the superclass, i.e., QActive_ctor(). However, this would pull in the QActiveVtable, which in turn will pull in the code for QHsm_init_() and QHsm_dispatch_() implemetations, which is expensive. To avoid this code size penalty, in case QHsm is not used in a given project, the call to QMsm_ctor() avoids pulling in the code for QHsm.

Definition at line 66 of file qf_qmact.c.

Field Documentation

◆ super

QActive super
protected

inherits QActive

Definition at line 379 of file qf.h.


The documentation for this struct was generated from the following files: