QP-nano
Data Fields
QFsm Struct Reference

Finite State Machine. More...

#include <qepn.h>

Data Fields

QStateHandler state
QEvent evt

Detailed Description

Finite State Machine.

QFsm represents a traditional non-hierarchical Finite State Machine (FSM) without state hierarchy, but with entry/exit actions.

Note:
QFsm is not intended to be instantiated directly, but rather serves as the base structure for derivation of state machines in the application code.

The following example illustrates how to derive a state machine structure from QFsm. Please note that the QFsm member super_ is defined as the FIRST member of the derived struct.

typedef struct QBombTag {
    QFsm super;                                        /* derives from QFsm */
    uint8_t timeout;                    /* number of seconds till explosion */
    uint8_t defuse;                               /* the secret defuse code */
    uint8_t code;                          /* the current defuse code entry */
} QBomb;
See also:
Encapsulation and Single Inheritance in C

Definition at line 195 of file qepn.h.


Field Documentation

currently processed event in the FSM (protected)

Definition at line 197 of file qepn.h.

current active state (private)

Definition at line 196 of file qepn.h.

Referenced by QFsm_dispatch(), and QFsm_init().


The documentation for this struct was generated from the following file: