QP/C++
Classes | Defines | Typedefs | Variables
qep.h File Reference

QEP/C++ platform-independent public interface. More...

#include "qevt.h"

Go to the source code of this file.

Classes

class  QEP
 Provides miscellaneous QEP services. More...
class  QFsm
 Finite State Machine base class. More...
class  QHsm
 Hierarchical State Machine base class. More...

Defines

#define Q_TRAN(target_)   (me->tran(Q_STATE_CAST(target_)))
 Designates a target for an initial or regular transition. Q_TRAN() can be used both in the FSMs and HSMs.
#define Q_SUPER(super_)   (me->super(Q_STATE_CAST(super_)))
 Designates the superstate of a given state in an HSM.
#define Q_STATE_CAST(handler_)   (reinterpret_cast<QP_ QStateHandler>(handler_))
 Perform cast to QStateHandler.
#define Q_EVT_CAST(class_)   (static_cast<class_ const *>(e))
 Perform downcast of an event onto a subclass of QEvt class_.

Typedefs

typedef uint8_t QState
 Type returned from a state-handler function.
typedef QState(* QStateHandler )(void *const me, QEvt const *const e)
 pointer to state-handler function

Variables

QState const Q_RET_HANDLED = static_cast<QState>(0)
 Value returned by a state-handler function when it handles the event.
QState const Q_RET_IGNORED = static_cast<QState>(1)
 Value returned by a non-hierarchical state-handler function when it ignores (does not handle) the event.
QState const Q_RET_TRAN = static_cast<QState>(2)
 Value returned by a state-handler function when it takes a regular state transition.
QState const Q_RET_SUPER = static_cast<QState>(3)
 Value returned by a state-handler function when it forwards the event to the superstate to handle.
QState const Q_RET_UNHANDLED = static_cast<QState>(4)
 Value returned by a state-handler function when a guard condition prevents it from handling the event.
enum_t const Q_USER_SIG = static_cast<enum_t>(4)
 Offset or the user signals.

Detailed Description

QEP/C++ platform-independent public interface.

This header file must be included directly or indirectly in all modules (*.cpp files) that use QEP/C++.

Definition in file qep.h.


Define Documentation

#define Q_EVT_CAST (   class_)    (static_cast<class_ const *>(e))

Perform downcast of an event onto a subclass of QEvt class_.

This macro encapsulates the downcast of QEvt pointers, which violates MISRA-C 2004 rule 11.4(advisory). This macro helps to localize this deviation.

Definition at line 75 of file qep.h.

#define Q_STATE_CAST (   handler_)    (reinterpret_cast<QP_ QStateHandler>(handler_))

Perform cast to QStateHandler.

This macro encapsulates the cast of a specific state handler function pointer to QStateHandler, which violates MISRA-C 2004 rule 11.4(advisory). This macro helps to localize this deviation.

Definition at line 66 of file qep.h.

Referenced by QFsm::init(), and QHsm::init().

#define Q_SUPER (   super_)    (me->super(Q_STATE_CAST(super_)))

Designates the superstate of a given state in an HSM.

Definition at line 58 of file qep.h.

#define Q_TRAN (   target_)    (me->tran(Q_STATE_CAST(target_)))

Designates a target for an initial or regular transition. Q_TRAN() can be used both in the FSMs and HSMs.

Definition at line 52 of file qep.h.