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

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

#include "qp.hpp"

Inheritance diagram for QP::QActive:
QP::QAsm QP::QActiveDummy QP::QMActive QP::QTicker QP::QXThread

Public Member Functions

void init (void const *const e, std::uint_fast8_t const qsId) override
 
void init (std::uint_fast8_t const qsId) override
 
void dispatch (QEvt const *const e, std::uint_fast8_t const qsId) override
 
bool isIn (QStateHandler const state) noexcept override
 
QStateHandler childState (QStateHandler const parent) noexcept
 
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
 
- Public Member Functions inherited from QP::QAsm
virtual void init (void const *const e, std::uint_fast8_t const qsId)=0
 
virtual void init (std::uint_fast8_t const qsId)
 
virtual void dispatch (QEvt const *const e, std::uint_fast8_t const qsId)=0
 
virtual bool isIn (QStateHandler const state) noexcept
 
QStateHandler state () const noexcept
 
QMState const * stateObj () const noexcept
 
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 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
 

Public Attributes

std::uint8_t m_prio_dis
 
std::uint8_t m_pthre_dis
 

Static Public Attributes

static QActiveregistry_ [QF_MAX_ACTIVE+1U]
 
static QSubscrListsubscrList_
 
static enum_t maxPubSignal_
 

Protected Member Functions

 QActive (QStateHandler const initial) noexcept
 
- Protected Member Functions inherited from QP::QAsm
 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
 
- Protected Attributes inherited from QP::QAsm
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

- Public Types inherited from QP::QAsm
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...
 

Detailed Description

Active object class (based on the QHsm implementation strategy)

Description
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.

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.

Note
QP::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
QP::QMActive
Traceability
Usage
The following example illustrates how to derive an active object from QP::QActive.
class Philo : public QP::QActive { // <=== inherit QP::QActive
private:
QP::QTimeEvt m_timeEvt;
std::uint8_t m_id;
public:
static Philo inst[N_PHILO];
public:
Philo();
protected:
Q_STATE_DECL(initial);
Q_STATE_DECL(thinking);
Q_STATE_DECL(hungry);
Q_STATE_DECL(eating);
};
Active object class (based on the QHsm implementation strategy)
Definition qp.hpp:724
Time Event class.
Definition qp.hpp:955
#define Q_STATE_DECL(state_)
Definition qp.hpp:473

Definition at line 724 of file qp.hpp.

Constructor & Destructor Documentation

◆ QActive()

QP::QActive::QActive ( QStateHandler const  initial)
inlineexplicitprotectednoexcept

QActive constructor (abstract base class)

Parameters
[in]initialpointer to the top-most initial state-handler function in the derived active object

Definition at line 766 of file qp.hpp.

Member Function Documentation

◆ init() [1/2]

void QP::QActive::init ( void const *const  e,
std::uint_fast8_t const  qsId 
)
inlineoverridevirtual

Virtual function to take the top-most initial transition in the state machine.

Description
Synchronously executes the top-most initial transition in a state machine (must be overridden in the subclasses).
Parameters
[in]epointer to an initialization parameter (might be nullptr)
[in]qsIdQS-id of this state machine (for QS local filter)
Precondition qep_asm:200
  • the virtual pointer must be initialized,
  • the top-most initial transition must be initialized,
  • the initial transition must not be taken yet.

Implements QP::QAsm.

Reimplemented in QP::QMActive, QP::QTicker, QP::QActiveDummy, and QP::QXThread.

Definition at line 781 of file qp.hpp.

◆ init() [2/2]

void QP::QActive::init ( std::uint_fast8_t const  qsId)
inlineoverridevirtual

Virtual function to take the top-most initial transition in the state machine (overloaded).

Description
Synchronously executes the top-most initial transition in a state machine. This overloaded version takes no initialization parameter.
Parameters
[in]qsIdQS-id of this state machine (for QS local filter)

Reimplemented from QP::QAsm.

Reimplemented in QP::QMActive, QP::QTicker, and QP::QXThread.

Definition at line 787 of file qp.hpp.

◆ dispatch()

void QP::QActive::dispatch ( QEvt const *const  e,
std::uint_fast8_t const  qsId 
)
inlineoverridevirtual

Virtual function to dispatch an event to the state machine.

Description
Synchronously dispatches an event for processing to a state machine (must be overridden in the subclasses). The processing of an event represents one run-to-completion (RTC) step.
Parameters
[in]epointer to the event to be dispatched to the MSM
[in]qsIdQS-id of this state machine (for QS local filter)
Precondition qep_asm:302
  • current state must be initialized
  • check the internal integrity (Software Self-Monitoring (SSM))

Implements QP::QAsm.

Reimplemented in QP::QMActive, QP::QTicker, QP::QActiveDummy, and QP::QXThread.

Definition at line 790 of file qp.hpp.

◆ isIn()

bool QP::QActive::isIn ( QStateHandler const  state)
inlineoverridevirtualnoexcept

Virtual function to check whether the state machine is in a given state.

Description
Tests if a given state is part of the current active state configuration. Please note that in a hierarchical state machine, to "be in a state" means also to be in a superstate of of the state.
Parameters
[in]statepointer to the state-handler function to be checked
Returns
'true' if the state machine "is in" the state and 'false' otherwise
Attention
This function must be called only on a state machine that is in the "stable state configuration". Among others, this means that the state machine cannot call it in the middle of its own transition.
Traceability

Reimplemented from QP::QAsm.

Reimplemented in QP::QMActive.

Definition at line 796 of file qp.hpp.

◆ childState()

QStateHandler QP::QActive::childState ( QStateHandler const  parent)
inlinenoexcept

Definition at line 799 of file qp.hpp.

◆ setAttr()

QP::QActive::setAttr ( std::uint32_t  attr1,
void const *  attr2 = nullptr 
)

Generic setting of additional attributes (defined in some QP ports)

◆ start() [1/2]

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

Description
Starts execution of the AO and registers the AO with the framework.
Parameters
[in]prioSpecpriority specification for the AO (See QP::QPrioSpec)
[in]qStopointer to the storage for the ring buffer of the event queue
[in]qLenlength of the event queue [# QP::QEvt* pointers]
[in]stkStopointer to the stack storage (might be NULL)
[in]stkSizestack size [bytes]
[in]parpointer to an extra parameter (might be NULL)
Traceability
  • DVR-QP-MC4-R08_13
Usage
The following example shows starting an AO when a per-task stack is needed:
#include "qpcpp.hpp"
int main() {
QP::QF::init(); // initialize the framework and the underlying RT kernel
BSP::init(); // initialize the Board Support Package
. . .
// instantiate and start the active objects...
static QP::QEvt const *blinkyQueueSto[10];
APP::AO_Blinky->start(
1U, // QP prio. of the AO
blinkyQueueSto, // event queue storage
Q_DIM(blinkyQueueSto), // queue length [events]
nullptr, 0U, // no stack storage
nullptr); // no initialization param
. . .
return QP::QF::run(); // run the QF application
}
Event class.
Definition qp.hpp:139
int_t run()
Definition qk.cpp:396
void init()
Definition qk.cpp:368
#define Q_DIM(array_)
Definition qp.hpp:544
QP/C++ interface including the backwards-compatibility layer.

Definition at line 448 of file qk.cpp.

◆ start() [2/2]

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 
)
inline

Starts execution of an active object and registers the object with the framework

Description
Starts execution of the AO and registers the AO with the framework.
Parameters
[in]prioSpecpriority specification for the AO (See QP::QPrioSpec)
[in]qStopointer to the storage for the ring buffer of the event queue
[in]qLenlength of the event queue [# QP::QEvt* pointers]
[in]stkStopointer to the stack storage (might be NULL)
[in]stkSizestack size [bytes]
Traceability
  • DVR-QP-MC4-R08_13
Usage
The following example shows starting an AO when a per-task stack is needed:
#include "qpcpp.hpp"
int main() {
QP::QF::init(); // initialize the framework and the underlying RT kernel
BSP::init(); // initialize the Board Support Package
. . .
// instantiate and start the active objects...
static QP::QEvt const *blinkyQueueSto[10];
APP::AO_Blinky->start(
1U, // QP prio. of the AO
blinkyQueueSto, // event queue storage
Q_DIM(blinkyQueueSto), // queue length [events]
nullptr, 0U); // no stack storage
. . .
return QP::QF::run(); // run the QF application
}

Definition at line 812 of file qp.hpp.

◆ stop()

QP::QActive::stop ( )

Stops execution of an active object and removes it from the framework's supervision

Attention
QActive::stop() must be called only from the AO that is about to stop its execution. By that time, any pointers or references to the AO are considered invalid (dangling) and it becomes illegal for the rest of the application to post events to the AO.

Definition at line 264 of file qutest.cpp.

◆ register_()

QP::QActive::register_ ( )
noexcept

Register this active object to be managed by the framework

Description
This function adds a given active object to the active objects managed by the QF framework. It should not be called by the application directly, only through the function QActive::start().
Precondition qf_qact:100
  • the "QF-priority" of the AO must be in range (must be set before calling QActive_register_())
  • the "QF-priority" must not be already in use (unique priority)
  • the "QF-priority" must not exceed the "preemption-threshold"
Postcondition qf_qact:190
  • the preceding pre-thre must not exceed the preemption-threshold
  • the preemption-threshold must not exceed the next preemption-threshold

Definition at line 76 of file qf_qact.cpp.

◆ unregister_()

QP::QActive::unregister_ ( )
noexcept

Un-register the active object from the framework

Description
This function un-registers a given active object from the active objects managed by the QF framework. It should not be called by the QP ports.
Precondition qf_qact:200
  • the priority of the active object must not be zero and cannot exceed the maximum QF_MAX_ACTIVE
  • the priority of the AO must be already registered.
Note
The active object that is removed from the framework can no longer participate in any event exchange.

Definition at line 132 of file qf_qact.cpp.

◆ post_()

QP::QActive::post_ ( QEvt const *const  e,
std::uint_fast16_t const  margin,
void const *const  sender 
)
noexcept

Posts an event e directly to the event queue of the active object using the First-In-First-Out (FIFO) policy.

Description
Direct event posting is the simplest asynchronous communication method available in QF.
Parameters
[in]epointer to the event to be posted
[in]marginnumber of required free slots in the queue after posting the event or QF::NO_MARGIN.
[in]senderpointer to a sender object (used in QS only)
Returns
'true' (success) if the posting succeeded (with the provided margin) and 'false' (failure) when the posting fails.
Precondition qf_actq:102
  • the event pointer must be valid
  • check internal event integrity (QP FuSa Subsystem)
Postcondition qf_actq:190
Attention
This operation is typically used via macros POST() and POST_X(). This is because the last parameter 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.
Note
This function might be implemented differently in various QP/C ports. The provided implementation assumes that the ::QEQueue class is used for the QActive event queue.
Traceability
  • DVP-QS-MC4-R15_05
Usage
extern QP::QActive * const AO_Table;
. . .
Q_STATE_DEF(Philo, hungry) {
QP::QState status_;
switch (e->sig) {
case Q_ENTRY_SIG: {
TableEvt const *pe = Q_NEW(TableEvt, HUNGRY_SIG, m_id);
AO_Table->POST(pe, this); // <===
status_ = Q_RET_HANDLED;
break;
}
. . .
}
return status_;
}
@ Q_RET_HANDLED
event handled (internal transition)
Definition qp.hpp:237
@ Q_ENTRY_SIG
signal for entry actions
Definition qp.hpp:260
std::uint_fast8_t QState
Definition qp.hpp:173
#define Q_NEW(evtT_, sig_,...)
Definition qp.hpp:1183

Definition at line 71 of file qf_actq.cpp.

◆ postLIFO()

QP::QActive::postLIFO ( QEvt const *const  e)
noexcept

Posts an event e directly to the event queue of the active object using the Last-In-First-Out (LIFO) policy.

Description
The LIFO policy should be used only for self-posting and with caution because it alters order of events in the queue.
Parameters
[in]epointer to the event to be posted
Precondition qf_actq:200
  • for the QXK kernel, postLIFO() cannot be called from an extended thread
Precondition qf_actq:201
  • the queue must be able to accept the event (cannot overflow)
Traceability
  • DVP-QS-MC4-R15_05
Note
This function might be implemented differently in various QP/C++ ports. The provided implementation assumes that the QP::QEQueue class is used for the QActive event queue.
See also
QActive_post()

Definition at line 221 of file qf_actq.cpp.

◆ get_()

QP::QActive::get_ ( )
noexcept

Get an event from the event queue of an active object

Description
The behavior of this function depends on the kernel used in the QF port. For built-in kernels (Vanilla 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.
Returns
A pointer to the received event. The returned pointer is guaranteed to be valid (can't be NULL).
Note
This function might be implemented differently in various QP/C++ ports. The provided implementation assumes that the QP::QEQueue class is used for the QActive event queue.

Definition at line 308 of file qf_actq.cpp.

◆ getQueueMin()

static std::uint_fast16_t QP::QActive::getQueueMin ( std::uint_fast8_t const  prio)
staticnoexcept

◆ psInit()

QP::QActive::psInit ( QSubscrList *const  subscrSto,
enum_t const  maxSignal 
)
staticnoexcept

Publish event to all subscribers of a given signal e->sig

Description
This function posts (using the FIFO policy) the event 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.
Note
To avoid any unexpected re-ordering of events posted into AO queues, the event multicasting is performed with scheduler locked. However, the scheduler is locked only up to the priority level of the highest-priority subscriber, so any AOs of even higher priority, which did not subscribe to this event are not affected.

Definition at line 84 of file qf_ps.cpp.

◆ publish_()

QP::QActive::publish_ ( QEvt const *const  e,
void const *const  sender,
std::uint_fast8_t const  qsId 
)
staticnoexcept

Publish event to all subscribers of a given signal e->sig

Description
This function posts (using the FIFO policy) the event 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.
Precondition qf_ps:200
  • the published signal must be within the configured range
Precondition qf_ps:202
  • check the integrity of the subscriber set (QP FuSa Subsystem)
Note
To avoid any unexpected re-ordering of events posted into AO queues, the event multicasting is performed with scheduler locked. However, the scheduler is locked only up to the priority level of the highest-priority subscriber, so any AOs of even higher priority, which did not subscribe to this event are not affected.
Attention
This operation is typically used via macro PUBLISH(). This is because the last parameter 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.
Usage
Q_STATE_DEF(Philo, eating) {
QP::QState status_;
switch (e->sig) {
. . .
case Q_EXIT_SIG: {
m_timeEvt.disarm();
TableEvt const *pe = Q_NEW(TableEvt, DONE_SIG, m_id);
QP::QActive::PUBLISH(pe, this); // <===
status_ = Q_RET_HANDLED;
break;
}
. . .
}
return status_;
}
@ Q_EXIT_SIG
signal for exit actions
Definition qp.hpp:261
#define Q_STATE_DEF(subclass_, state_)
Definition qp.hpp:478

Definition at line 107 of file qf_ps.cpp.

◆ subscribe()

QP::QActive::subscribe ( enum_t const  sig) const
noexcept

Subscribes for delivery of signal sig to the active object

Description
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.
Parameters
[in]sigevent signal to subscribe
Precondition qf_ps:300
  • signal must be in range of subscribe scignals
  • subscriber AO priority must be in range
  • the AO must be registered (started)
Precondition qf_ps:302
  • check the integrity of the subscriber set (QP FuSa Subsystem)
Usage
The following example shows how the Table active object subscribes to three signals in the initial transition:
Q_STATE_DEF(Philo, initial) {
. . .
subscribe(EAT_SIG); // <===
subscribe(TEST_SIG); // <===
. . .
return tran(&thinking);
}
void subscribe(enum_t const sig) const noexcept
Definition qf_ps.cpp:215
QState tran(QStateHandler const target) noexcept
Definition qp.hpp:313
#define Q_UNUSED_PAR(par_)
Definition qp.hpp:541

Definition at line 215 of file qf_ps.cpp.

◆ unsubscribe()

QP::QActive::unsubscribe ( enum_t const  sig) const
noexcept

Unsubscribes from the delivery of signal sig to the active object

Description
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.
Parameters
[in]sigevent signal to unsubscribe
Precondition qf_ps:400
  • signal must be in range of subscribe scignals
  • subscriber AO priority must be in range
  • the AO must be registered (started)
Precondition qf_ps:402
  • check the integrity of the subscriber set (QP FuSa Subsystem)
Note
Due to the latency of event queues, an active object should NOT assume that a given signal 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.
Un-subscribing from a signal that has never been subscribed in the first place is considered an error and QF will raise an assertion.

Definition at line 252 of file qf_ps.cpp.

◆ unsubscribeAll()

QP::QActive::unsubscribeAll ( ) const
noexcept

Unsubscribes from the delivery of all signals to the active object

Description
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.
Precondition qf_ps:500
  • subscriber AO priority must be in range
  • the AO must be registered (started)
Note
Due to the latency of event queues, an active object should NOT assume that no events will ever be dispatched to the state machine of the active object after un-subscribing from all events. The events might be already in the queue, or just about to be posted and the un-subscribe operation will not flush such events. Also, the alternative event-delivery mechanisms, such as direct event posting or time events, can be still delivered to the event queue of the active object.

Definition at line 289 of file qf_ps.cpp.

◆ defer()

QP::QActive::defer ( QEQueue *const  eq,
QEvt const *const  e 
) const
noexcept

Defer an event to a given separate event queue

Description
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.
Remarks
An active object can use multiple event queues to defer events of different kinds.
Parameters
[in]eqpointer to a "raw" thread-safe queue to recall an event from.
[in]epointer to the event to be deferred
Returns
'true' (success) when the event could be deferred and 'false' (failure) if event deferral failed due to overflowing the queue.

Definition at line 70 of file qf_defer.cpp.

◆ recall()

QP::QActive::recall ( QEQueue *const  eq)
noexcept

Recall a deferred event from a given event queue

Description
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.
Parameters
[in]eqpointer to a "raw" thread-safe queue to recall an event from.
Returns
'true' if an event has been recalled and 'false' if not.
Note
An active object can use multiple event queues to defer events of different kinds.

Definition at line 99 of file qf_defer.cpp.

◆ flushDeferred()

QP::QActive::flushDeferred ( QEQueue *const  eq,
std::uint_fast16_t const  num = 0xFFFFU 
) const
noexcept

Flush the specified deferred queue eq

Description
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.
Parameters
[in]eqpointer to a "raw" thread-safe queue to flush.
Returns
the number of events actually flushed from the queue.

Definition at line 161 of file qf_defer.cpp.

◆ getPrio()

std::uint_fast8_t QP::QActive::getPrio ( ) const
inlinenoexcept

Definition at line 851 of file qp.hpp.

◆ setPrio()

void QP::QActive::setPrio ( QPrioSpec const  prio)
inlinenoexcept

Definition at line 854 of file qp.hpp.

◆ getPThre()

std::uint_fast8_t QP::QActive::getPThre ( ) const
inlinenoexcept

Definition at line 858 of file qp.hpp.

◆ getEQueue()

QACTIVE_EQUEUE_TYPE const & QP::QActive::getEQueue ( ) const
inlinenoexcept

Definition at line 863 of file qp.hpp.

◆ getOsObject()

QACTIVE_OS_OBJ_TYPE const & QP::QActive::getOsObject ( ) const
inlinenoexcept

Definition at line 869 of file qp.hpp.

◆ getThread()

QACTIVE_THREAD_TYPE const & QP::QActive::getThread ( ) const
inlinenoexcept

Definition at line 875 of file qp.hpp.

◆ setThread()

void QP::QActive::setThread ( QACTIVE_THREAD_TYPE const &  thr)
inline

Definition at line 881 of file qp.hpp.

◆ evtLoop_()

QP::QActive::evtLoop_ ( QActive act)
static

Event loop thread routine for executing an active object act (defined some in QP ports)

◆ postFromISR()

QP::QActive::postFromISR ( QEvt const *const  e,
std::uint_fast16_t const  margin,
void *  par,
void const *const  sender 
)
virtualnoexcept

The "FromISR" variant used in the QP port to "FreeRTOS"

◆ publishFromISR()

QP::QActive::publishFromISR ( QEvt const *  e,
void *  par,
void const *  sender 
)
staticnoexcept

The "FromISR" variant used in the QP port to "FreeRTOS"

Friends And Related Symbol Documentation

◆ QTimeEvt

friend class QTimeEvt
friend

Definition at line 755 of file qp.hpp.

◆ QTicker

friend class QTicker
friend

Definition at line 756 of file qp.hpp.

◆ QXThread

friend class QXThread
friend

Definition at line 757 of file qp.hpp.

◆ QXMutex

friend class QXMutex
friend

Definition at line 758 of file qp.hpp.

◆ QXSemaphore

friend class QXSemaphore
friend

Definition at line 759 of file qp.hpp.

◆ QActiveDummy

friend class QActiveDummy
friend

Definition at line 760 of file qp.hpp.

◆ GuiQActive

friend class GuiQActive
friend

Definition at line 761 of file qp.hpp.

◆ GuiQMActive

friend class GuiQMActive
friend

Definition at line 762 of file qp.hpp.

◆ schedLock

void schedLock ( )
friend

Member Data Documentation

◆ m_prio

QActive::m_prio
protected

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

See also
QP::QPrioSpec

Definition at line 726 of file qp.hpp.

◆ m_pthre

QActive::m_pthre
protected

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

See also
QP::QPrioSpec

Definition at line 727 of file qp.hpp.

◆ m_thread

QActive::m_thread
protected

Port-dependent representation of the thread of the active object

Description
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 730 of file qp.hpp.

◆ m_osObject

QActive::m_osObject
protected

Port-dependent per-thread object.

Description
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 734 of file qp.hpp.

◆ m_eQueue

QActive::m_eQueue
protected

Port-dependent event-queue type (often QP::QEQueue)

Description
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 QP::QACTIVE_EQUEUE_TYPE as QP::QEQueue.

Definition at line 738 of file qp.hpp.

◆ m_prio_dis

std::uint8_t QP::QActive::m_prio_dis

Definition at line 744 of file qp.hpp.

◆ m_pthre_dis

std::uint8_t QP::QActive::m_pthre_dis

Definition at line 748 of file qp.hpp.

◆ registry_

QActive::registry_
static

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

Definition at line 750 of file qp.hpp.

◆ subscrList_

QActive::subscrList_
static

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

Definition at line 751 of file qp.hpp.

◆ maxPubSignal_

QActive::maxPubSignal_
static

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

Definition at line 752 of file qp.hpp.


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