|
| virtual | ~QAsm ()=default |
| | Virtual destructor of the QP::QAsm abstract base class.
|
| virtual void | init (void const *const e, std::uint_fast8_t const qsId)=0 |
| | Virtual function to take the top-most initial transition in the state machine.
|
| virtual void | init (std::uint_fast8_t const qsId) |
| | Virtual function to take the top-most initial transition in the state machine (overloaded).
|
| virtual void | dispatch (QEvt const *const e, std::uint_fast8_t const qsId)=0 |
| | Virtual function to dispatch an event to the state machine.
|
| virtual bool | isIn (QStateHandler const stateHndl)=0 |
| | Virtual function to check whether the state machine is in a given state.
|
| virtual QStateHandler | getStateHandler () const noexcept=0 |
| | Virtual method for getting the current state handler.
|
| QStateHandler | state () const noexcept |
| QMState const * | stateObj () const noexcept |
Abstract State Machine class (state machine interface).
Forward Traceability
- DVR_QP_PCLP_1801: Base class has a destructor that is not public virtual; public override or protected non-virtual
Definition at line 172 of file qp.hpp.
| virtual void QP::QAsm::init |
( |
void const *const | e, |
|
|
std::uint_fast8_t const | qsId ) |
|
pure virtual |
| void QP::QAsm::init |
( |
std::uint_fast8_t const | qsId | ) |
|
|
virtual |
Virtual function to take the top-most initial transition in the state machine (overloaded).
Details
Synchronously executes the top-most initial transition in a state machine. This overloaded version takes no initialization parameter.
- Parameters
-
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Reimplemented in QP::QActive, QP::QHsm, QP::QMActive, QP::QMsm, QP::QTicker, and QP::QXThread.
Definition at line 86 of file qf_act.cpp.
| virtual void QP::QAsm::dispatch |
( |
QEvt const *const | e, |
|
|
std::uint_fast8_t const | qsId ) |
|
pure virtual |
Virtual function to dispatch an event to the state machine.
Details
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] | e | pointer to the event to be dispatched to the MSM |
| [in] | qsId | QS-id of this state machine (for QS local filter) |
Implemented in QP::QActive, QP::QActiveDummy, QP::QHsm, QP::QHsmDummy, QP::QMActive, QP::QMsm, QP::QTicker, and QP::QXThread.
Virtual function to check whether the state machine is in a given state.
Details
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 the state.
- Parameters
-
| [in] | state | pointer to the state-handler function to be checked |
- Returns
- 'true' if the state machine "is in" the state and 'false' otherwise
- Attention
- The QAsm::isIn() operation is available only for tracing/testing (when Q_SPY is defined). This is to prevent the following problematic uses of the "is-in" query:
- Querying the current state inside the state machine in question (e.g., as a guard condition based on QAsm::isIn()) is generally a bad design and often makes no sense because the state machine might be in the middle of a transition, where the current state is not well-defined.
- Querying the current state of a concurrently executing state machine (e.g., from one active object to the other) is a bad idea because such a state can change asynchronously. Also, the other state machine might be in the middle of a state transition, where the "current state" is not well-defined.
- Querying the current state requires exposing the state handlers to the rest of the system. (The QAsm::isIn() requires the state-handler parameter).
Backward Traceability
- SRS_QP_SM_25: All State Machine Implementation Strategies provided by the QP/C++ Framework component might supply a method for checking if a state machine is in a given state.
Implemented in QP::QActive, QP::QHsm, QP::QHsmDummy, QP::QMActive, and QP::QMsm.
Virtual method for getting the current state handler.
Details
This virtual call applies to all subclasses of QP::QAsm, such as: QP::QHsm, QP::QMsm, QP::QActive, and QP::QMActive.
- Returns
- the current state-handler of the type QP::QStateHandler (pointer to function)
- Note
- This function can be called in any context (including from a critical section) and also not necessarily in the "stable state configuration". When called during a state transition in the state machine, it returns the source state.
Backward Traceability
- SRS_QP_SM_26: All State Machine Implementation Strategies provided by the QP/C++ Framework component might supply a method for obtaining the current state.
Usage
The following example illustrates how to obtain the current state handler of an Active Object:
QState(*)(void *const me, QEvt const *const e) QStateHandler
Pointer to a state-handler function.
Implemented in QP::QActive, QP::QActiveDummy, QP::QHsm, QP::QHsmDummy, QP::QMActive, and QP::QMsm.