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

Active object class (based on QMsm implementation strategy) More...

#include "qp.hpp"

Inheritance diagram for QP::QMActive:
QP::QActive QP::QAsm

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 getStateHandler () noexcept override
 
bool isInState (QMState const *const st) const noexcept
 
QMState const * childStateObj (QMState const *const parent) const noexcept
 
- Public Member Functions inherited from QP::QActive
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
QStateHandler state () const noexcept
 
QMState const * stateObj () const noexcept
 

Protected Member Functions

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

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...
 
- Static Public Member Functions inherited from QP::QActive
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 inherited from QP::QActive
std::uint8_t m_prio_dis
 
std::uint8_t m_pthre_dis
 
- Static Public Attributes inherited from QP::QActive
static QActiveregistry_ [QF_MAX_ACTIVE+1U]
 
static QSubscrListsubscrList_
 
static enum_t maxPubSignal_
 
- Protected Attributes inherited from QP::QActive
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
 

Detailed Description

Active object class (based on QMsm implementation strategy)

Description
QMActive represents an active object that uses the QP::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 QP::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
Usage
The following example illustrates how to derive an active object from QP::QMActive. Please note the call to the QMActive constructor in the Philo subclass' constructor.
class Philo : public QP::QMActive { // <====
private:
QP::QTimeEvt m_timeEvt;
public:
Philo::Philo()
: QMActive(Q_STATE_CAST(&initial)), // <===
m_timeEvt(this, TIMEOUT_SIG, 0U)
{}
protected:
QM_STATE_DECL( initial);
QM_STATE_DECL( thinking);
QM_ACTION_DECL(thinking_e);
QM_ACTION_DECL(thinking_x);
. . .
}; // class Philo
Active object class (based on QMsm implementation strategy)
Definition qp.hpp:910
Time Event class.
Definition qp.hpp:955
#define Q_STATE_CAST(handler_)
Definition qp.hpp:493
#define QM_STATE_DECL(state_)
Definition qp.hpp:497
#define QM_ACTION_DECL(action_)
Definition qp.hpp:509

Definition at line 910 of file qp.hpp.

Constructor & Destructor Documentation

◆ QMActive()

QMActive::QMActive ( QStateHandler const initial)
protectednoexcept

Constructor of QP::QMActive class.

Description
Performs the first step of active object initialization by assigning the virtual pointer and calling the superclass constructor.
Parameters
[in]initialpointer to the event to be dispatched to the MSM
Note
Must be called only ONCE before QASM_INIT().

Definition at line 72 of file qf_qmact.cpp.

Member Function Documentation

◆ init() [1/2]

void QP::QMActive::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.

Reimplemented from QP::QActive.

Definition at line 915 of file qp.hpp.

◆ init() [2/2]

void QP::QMActive::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::QActive.

Definition at line 921 of file qp.hpp.

◆ dispatch()

void QP::QMActive::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))

Reimplemented from QP::QActive.

Definition at line 924 of file qp.hpp.

◆ isIn()

bool QP::QMActive::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::QActive.

Definition at line 930 of file qp.hpp.

◆ getStateHandler()

QStateHandler QP::QMActive::getStateHandler ( )
inlineoverridevirtualnoexcept

Get the current state (handler) in the state machine

Reimplemented from QP::QAsm.

Definition at line 935 of file qp.hpp.

◆ isInState()

bool QP::QMActive::isInState ( QMState const *const st) const
inlinenoexcept

Definition at line 939 of file qp.hpp.

◆ childStateObj()

QMState const * QP::QMActive::childStateObj ( QMState const *const parent) const
inlinenoexcept

Definition at line 942 of file qp.hpp.


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