QMsm implementation
More...
#include "qep_port.h"
#include "qassert.h"
#include "qs_port.h"
#include "qs_pkg.h"
Go to the source code of this file.
QMsm implementation
Definition in file qep_msm.c.
◆ QEP_ACT_PTR_INC_
#define QEP_ACT_PTR_INC_ |
( |
|
act_ | ) |
(++(act_)) |
Internal QEP macro to increment the given action table act_
.
- Note
- Incrementing a pointer violates the MISRA-C 2004 Rule 17.4(req), pointer arithmetic other than array indexing. Encapsulating this violation in a macro allows to selectively suppress this specific deviation.
Definition at line 74 of file qep_msm.c.
◆ anonymous enum
internal QEP constants
Enumerator |
---|
QMSM_MAX_ENTRY_DEPTH_ | maximum depth of entry levels in a MSM for transition to history.
|
Definition at line 54 of file qep_msm.c.
◆ QMsm_ctor()
- Description
- Performs the first step of QMsm initialization by assigning the initial pseudostate to the currently active state of the state machine.
- Parameters
-
[in,out] | me | pointer (see Object Orientation) |
[in] | initial | the top-most initial transition for the MSM. |
- Note
- Must be called only ONCE before QHSM_INIT().
-
QMsm inherits QHsm, so by the Object Orientation convention it should call the constructor of the superclass, i.e., QHsm_ctor(). However, this would pull in the QHsmVtable, which in turn will pull in the code for QHsm_init_() and QHsm_dispatch_() implemetations. To avoid this code size penalty, in case QHsm is not used in a given project, the QMsm_ctor() performs direct intitialization of the Vtable, which avoids pulling in the code for QMsm.
- Usage
- The following example illustrates how to invoke QMsm_ctor() in the "constructor" of a derived state machine:
void Calc_ctor(Calc * const me) {
me->operand1 = 0.0;
me->operand2 = 0.0;
me->len = 0U;
me->opKey = 0U;
}
#define Q_STATE_CAST(handler_)
Perform cast to QStateHandler.
void QMsm_ctor(QMsm *const me, QStateHandler initial)
Constructor of QMsm.
Definition at line 135 of file qep_msm.c.
◆ QMsm_getStateHandler_()
◆ QMsm_isInState()
- Description
- Tests if a state machine derived from QMsm is-in a given state.
- Note
- For a MSM, to "be-in" a state means also to "be-in" a superstate of of the state.
- Parameters
-
- Returns
- 'true' if the MSM "is in" the
state
and 'false' otherwise
Definition at line 642 of file qep_msm.c.
◆ QMsm_childStateObj_()
- Description
- Finds the child state of the given
parent
, such that this child state is an ancestor of the currently active state. The main purpose of this function is to support shallow history transitions in state machines derived from QMsm.
- Parameters
-
- Returns
- the child of a given
parent
state, which is an ancestor of the currently active state. For the corner case when the currently active state is the given parent
state, function returns the parent
state.
- See also
- QMsm_childStateObj()
- Postcondition
- the child must be found
Definition at line 673 of file qep_msm.c.
◆ l_msm_top_s
Initial value:= {
}
#define Q_ACTION_CAST(action_)
Perform cast to QActionHandler.
State object for the QMsm class (QM State Machine).
Definition at line 1 of file qep_msm.c.