Hierarchical State Machine class. More...
#include "qep.h"
Public Member Functions | |
bool | QHsm_isIn (QHsm *const me, QStateHandler const state) |
QStateHandler | QHsm_childState (QHsm *const me, QStateHandler const parent) |
Static Public Member Functions | |
static QStateHandler | QHsm_state (QHsm *const me) |
Protected Member Functions | |
void | QHsm_ctor (QHsm *const me, QStateHandler const initial) |
QState | QHsm_top (QHsm const *const me, QEvt const *const e) |
void | QHsm_init_ (QHsm *const me, void const *const e, uint_fast8_t const qs_id) |
void | QHsm_dispatch_ (QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id) |
Private Member Functions | |
QStateHandler | QHsm_getStateHandler_ (QHsm *const me) |
void | QHsm_state_entry_ (QHsm *const me, QStateHandler const state, uint_fast8_t const qs_id) |
bool | QHsm_state_exit_ (QHsm *const me, QStateHandler const state, uint_fast8_t const qs_id) |
int_fast8_t | QHsm_tran_ (QHsm *const me, QStateHandler *const path, uint_fast8_t const qs_id) |
Static Private Member Functions | |
static QState | QHsm_reservedEvt_ (QHsm *const me, QStateHandler const state, enum QReservedSig const sig) |
Private Attributes | |
struct QHsmVtable const * | vptr |
union QHsmAttr | state |
union QHsmAttr | temp |
QHsm represents a Hierarchical State Machine (HSM) with full support for hierarchical nesting of states, entry/exit actions, initial transitions, and transitions to history in any composite state. This class is designed for ease of manual coding of HSMs in C, but it is also supported by the QM modeling tool.
QHsm is also the base class for the QMsm state machine, which provides a superior efficiency, but requires the use of the QM modeling tool to generate code.
bool QHsm_isIn | ( | QHsm *const | me, |
QStateHandler const | state | ||
) |
Tests if a given state is part of the current active state configuration in QHsm subclasses.
Tests if a state machine derived from QHsm is-in a given state.
[in] | me | current instance pointer (see oop) |
[in] | state | pointer to the state-handler function to be tested |
state
and 'false' otherwiseqep_hsm:600
|
inlinestatic |
QStateHandler QHsm_childState | ( | QHsm *const | me, |
QStateHandler const | parent | ||
) |
Obtain the current active child state of a given parent in QHsm
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 QHsm.
[in] | me | current instance pointer (see oop) |
[in] | parent | pointer to the state-handler function |
parent
state, which is an ancestor of the current active state. For the corner case when the currently active state is the given parent
state, function returns the parent
state.qep_hsm:890
|
protected |
Protected "constructor" of QHsm
Performs the first step of HSM initialization by assigning the initial pseudostate to the currently active state of the state machine.
[in,out] | me | current instance pointer (see oop) |
[in] | initial | pointer to the top-most initial state-handler function in the derived state machine |
The top-state of QHsm.
QHsm_top() is the ultimate root of state hierarchy in all HSMs derived from QHsm.
[in] | me | current instance pointer (see oop) |
[in] | e | pointer to the event to be dispatched to the FSM |
|
protected |
Implementation of the top-most initial tran. in QHsm.
Executes the top-most initial transition in a HSM.
[in,out] | me | current instance pointer (see oop) |
[in] | e | pointer to an extra parameter (might be NULL) |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
qep_hsm:200
Implementation of dispatching events to a QHsm
Dispatches an event for processing to a hierarchical state machine (HSM). The processing of an event represents one run-to-completion (RTC) step.
[in,out] | me | current instance pointer (see oop) |
[in] | e | pointer to the event to be dispatched to the HSM |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
qep_hsm:400
|
private |
|
private |
|
private |
Helper function to execute exit from a given state in a hierarchical state machine (HSM).
[in] | state | state handler function |
[in] | qs_id | QS-id of this state machine (for QS local filter) |
|
inlinestaticprivate |
|
private |
|
private |
|
private |