QP/C  7.3.0
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QActive Class Reference

Active object class (based on the QHsm implementation strategy) More...

#include "qp.h"

Inheritance diagram for QActive:
QAsm QActiveDummy QMActive QXThread

Public Member Functions

void QActive_setAttr (QActive *const me, uint32_t attr1, void const *attr2)
 

Static Public Member Functions

void QActive_psInit (QSubscrList *const subscrSto, enum_t const maxSignal)
 

Public Attributes

QAsm super
 

Protected Member Functions

void QActive_ctor (QActive *const me, QStateHandler const 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, struct QEQueue *const eq, QEvt const *const e)
 
bool QActive_recall (QActive *const me, struct QEQueue *const eq)
 
uint_fast16_t QActive_flushDeferred (QActive const *const me, struct QEQueue *const eq)
 
- Protected Member Functions inherited from QAsm
void QAsm_ctor (QAsm *const me)
 
QState QHsm_top (QHsm const *const me, QEvt const *const e)
 

Private Member Functions

void QActive_start_ (QActive *const me, QPrioSpec const prioSpec, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
 
void QActive_register_ (QActive *const me)
 
void QActive_unregister_ (QActive *const me)
 
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_evtLoop_ (QActive *const me)
 

Static Private Member Functions

void QActive_publish_ (QEvt const *const e, void const *const sender, uint_fast8_t const qs_id)
 

Private Attributes

QACTIVE_EQUEUE_TYPE eQueue
 
QACTIVE_OS_OBJ_TYPE osObject
 
QACTIVE_THREAD_TYPE thread
 
uint8_t prio
 
uint8_t pthre
 
QActiveQActive_registry_ [QF_MAX_ACTIVE+1U]
 
QSubscrListQActive_subscrList_
 
enum_t QActive_maxPubSignal_
 

Additional Inherited Members

- Protected Attributes inherited from QAsm
struct QAsmVtable const * vptr
 
union QAsmAttr state
 
union QAsmAttr temp
 

Detailed Description

Active object class (based on the QHsm implementation strategy)

Active objects are encapsulated tasks (each containing an event queue and a state machine) that communicate with one another asynchronously by sending and receiving events. Within an active object, events are processed 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.

Note
QActive is not intended to be instantiated directly, but rather serves as the abstract base class for derivation of active objects in the applications.
See also
QMActive
Traceability
Usage
The following example illustrates how to derive an active object from QActive.
typedef struct {
QActive super; // inherit QActive
QTimeEvt timeEvt; // to timeout the blinking
} Blinky;
. . .
void Blinky_ctor(Blinky * const me) {
// constructor of the superclass <---
QActive_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 qp.h:514
Active object class (based on the QHsm implementation strategy)
Definition qp.h:788
void QActive_ctor(QActive *const me, QStateHandler const initial)
QAsm super
Definition qp.h:790
Time Event class.
Definition qp.h:946

Definition at line 788 of file qp.h.

Member Function Documentation

◆ QActive_ctor()

void QActive_ctor ( QActive *const  me,
QStateHandler const  initial 
)
protected

◆ QActive_setAttr()

void QActive_setAttr ( QActive *const  me,
uint32_t  attr1,
void const *  attr2 
)

◆ QActive_start_()

void QActive_start_ ( QActive *const  me,
QPrioSpec const  prioSpec,
QEvt const **const  qSto,
uint_fast16_t const  qLen,
void *const  stkSto,
uint_fast16_t const  stkSize,
void const *const  par 
)
private

Definition at line 378 of file qk.c.

◆ QActive_stop()

void QActive_stop ( QActive *const  me)
protected

Definition at line 240 of file qutest.c.

◆ QActive_register_()

void QActive_register_ ( QActive *const  me)
private

Definition at line 98 of file qf_qact.c.

◆ QActive_unregister_()

void QActive_unregister_ ( QActive *const  me)
private

Definition at line 146 of file qf_qact.c.

◆ QActive_post_()

bool QActive_post_ ( QActive *const  me,
QEvt const *const  e,
uint_fast16_t const  margin,
void const *const  sender 
)
private

◆ QActive_postLIFO_()

void QActive_postLIFO_ ( QActive *const  me,
QEvt const *const  e 
)
private

Definition at line 212 of file qf_actq.c.

◆ QActive_get_()

QEvt const * QActive_get_ ( QActive *const  me)
private

Definition at line 295 of file qf_actq.c.

◆ QActive_psInit()

void QActive_psInit ( QSubscrList *const  subscrSto,
enum_t const  maxSignal 
)
static

◆ QActive_publish_()

void QActive_publish_ ( QEvt const *const  e,
void const *const  sender,
uint_fast8_t const  qs_id 
)
staticprivate

Definition at line 96 of file qf_ps.c.

◆ QActive_subscribe()

void QActive_subscribe ( QActive const *const  me,
enum_t const  sig 
)
protected

Definition at line 196 of file qf_ps.c.

◆ QActive_unsubscribe()

void QActive_unsubscribe ( QActive const *const  me,
enum_t const  sig 
)
protected

Definition at line 235 of file qf_ps.c.

◆ QActive_unsubscribeAll()

void QActive_unsubscribeAll ( QActive const *const  me)
protected

Definition at line 274 of file qf_ps.c.

◆ QActive_defer()

bool QActive_defer ( QActive const *const  me,
struct QEQueue *const  eq,
QEvt const *const  e 
)
protected

◆ QActive_recall()

bool QActive_recall ( QActive *const  me,
struct QEQueue *const  eq 
)
protected

Definition at line 93 of file qf_defer.c.

◆ QActive_flushDeferred()

uint_fast16_t QActive_flushDeferred ( QActive const *const  me,
struct QEQueue *const  eq 
)
protected

Definition at line 154 of file qf_defer.c.

◆ QActive_evtLoop_()

void QActive_evtLoop_ ( QActive *const  me)
private

Member Data Documentation

◆ super

QAsm QActive::super

Definition at line 790 of file qp.h.

◆ eQueue

QActive::eQueue
private

Port-dependent event-queue type (often QEQueue)

The type of the queue depends on the underlying operating system or a kernel. Many kernels support "message queues" that can be adapted to deliver QF events to the active object. Alternatively, QF provides a native event queue implementation that can be used as well.

Note
The native QF event queue is configured by defining the macro QACTIVE_EQUEUE_TYPE as QEQueue.

Definition at line 794 of file qp.h.

◆ osObject

QActive::osObject
private

Port-dependent per-thread object.

This data might be used in various ways, depending on the QF port. In some ports me->osObject is used to block the calling thread when the native QF queue is empty. In other QF ports the OS-dependent object might be used differently.

Definition at line 799 of file qp.h.

◆ thread

QActive::thread
private

Port-dependent representation of the thread of the active object

This data might be used in various ways, depending on the QF port. In some ports me->thread is used store the thread handle. In other ports me->thread can be a pointer to the Thread-Local-Storage (TLS).

Definition at line 804 of file qp.h.

◆ prio

QActive::prio
private

QF-priority [1..QF_MAX_ACTIVE] of this AO.

See also
QPrioSpec

Definition at line 808 of file qp.h.

◆ pthre

QActive::pthre
private

Preemption-threshold [1..QF_MAX_ACTIVE] of this AO.

See also
QPrioSpec

Definition at line 811 of file qp.h.

◆ QActive_registry_

QActive::QActive_registry_
private

Static (one per-class) array of registered active objects

Definition at line 817 of file qp.h.

◆ QActive_subscrList_

QActive::QActive_subscrList_
private

Static (one per-class) pointer to all subscriber AOs for a given event signal.

Definition at line 820 of file qp.h.

◆ QActive_maxPubSignal_

QActive::QActive_maxPubSignal_
private

Static (one per-class) maximum published signal (the size of the subscrList_ array)

Definition at line 823 of file qp.h.


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