QP/C++  6.9.3
Real-Time Embedded Framework
qep.hpp File Reference

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

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  QEvt
 
union  QHsmAttr
 
class  QHsm
 
class  QMsm
 
struct  QMState
 
struct  QMTranActTable
 Transition-Action Table for the QP::QMsm State Machine. More...
 
class  QEP
 Provides miscellaneous QEP services. More...
 

Namespaces

 QP
 

Macros

#define QP_VERSION   693U
 The current QP version as a decimal constant XXYZ, where XX is a 2-digit. More...
 
#define QP_VERSION_STR   "6.9.3"
 The current QP version number string of the form XX.Y.Z, where XX is. More...
 
#define QP_RELEASE   0x8295AA8AU
 Encrypted current QP release (6.9.3) and date (2021-04-12) More...
 
#define Q_SIGNAL_SIZE   2U
 
#define Q_EVT_CAST(class_)   (static_cast<class_ const *>(e))
 
#define Q_UINT2PTR_CAST(type_, uint_)   (reinterpret_cast<type_ *>(uint_))
 
#define QEVT_INITIALIZER(sig_)   { static_cast<QP::QSignal>(sig_), 0U, 0U }
 
#define Q_STATE_DECL(state_)
 
#define Q_STATE_DEF(subclass_, state_)
 
#define Q_HANDLED()   (Q_RET_HANDLED)
 Macro to specify that the event was handled. More...
 
#define Q_UNHANDLED()   (Q_RET_UNHANDLED)
 
#define Q_STATE_CAST(handler_)    (reinterpret_cast<QP::QStateHandler>(handler_))
 
#define Q_ACTION_CAST(act_)   (reinterpret_cast<QP::QActionHandler>(act_))
 
#define Q_ACTION_NULL   (nullptr)
 
#define QM_STATE_DECL(state_)
 
#define QM_SM_STATE_DECL(subm_, state_)
 
#define QM_ACTION_DECL(action_)
 
#define QM_STATE_DEF(subclass_, state_)
 
#define QM_ACTION_DEF(subclass_, action_)
 
#define QM_HANDLED()   (Q_RET_HANDLED)
 Macro for a QM action-handler when it handles the event. More...
 
#define QM_UNHANDLED()   (Q_RET_UNHANDLED)
 
#define QM_SUPER()   (Q_RET_SUPER)
 Macro for a QM action-handler when it passes the event to the superstate. More...
 
#define QM_STATE_NULL   (nullptr)
 

Typedefs

using char_t = char
 
using int_t = int
 alias for line numbers in assertions and return from QF::run() More...
 
using enum_t = int
 alias for enumerations used for event signals More...
 
using float32_t = float
 
using float64_t = double
 
using QSignal = std::uint16_t
 
using QState = std::uint_fast8_t
 Type returned from state-handler functions. More...
 
using QStateHandler = QState(*)(void *const me, QEvt const *const e)
 Pointer to state-handler function. More...
 
using QActionHandler = QState(*)(void *const me)
 Pointer to an action-handler function. More...
 
using QXThreadHandler = void(*)(QXThread *const me)
 Pointer to a thread-handler function. More...
 

Variables

constexpr char_t const versionStr [] {QP_VERSION_STR}
 the current QP version number string based on QP_VERSION_STR More...
 
constexpr enum_t Q_USER_SIG {4}
 Offset or the user signals. More...
 

Detailed Description

QEP/C++ platform-independent public interface.

Definition in file qep.hpp.


Data Structure Documentation

◆ QP::QHsmAttr

union QP::QHsmAttr

Attribute of for the QHsm class (Hierarchical State Machine).

Description
This union represents possible values stored in the 'state' and 'temp' attributes of the QHsm and QMsm classes.

Definition at line 238 of file qep.hpp.

Collaboration diagram for QHsmAttr:
Collaboration graph
Data Fields
QStateHandler fun pointer to a state handler function
QActionHandler act pointer to an action-handler function
QXThreadHandler thr pointer to an thread-handler function
QMState const * obj pointer to QMState object
QMTranActTable const * tatbl transition-action table

◆ QP::QMState

struct QP::QMState

State object for the QP::QMsm class (QM State Machine).

Description
This class groups together the attributes of a QP::QMsm state, such as the parent state (state nesting), the associated state handler function and the exit action handler function. These attributes are used inside the QP::QMsm::dispatch() and QP::QMsm::init() functions.
Attention
The QP::QMState class is only intended for the QM code generator and should not be used in hand-crafted code.

Definition at line 584 of file qep.hpp.

Collaboration diagram for QMState:
Collaboration graph
Data Fields
QMState const * superstate superstate of this state
QStateHandler const stateHandler state handler function
QActionHandler const entryAction entry action handler function
QActionHandler const exitAction exit action handler function
QActionHandler const initAction init action handler function

◆ QP::QMTranActTable

struct QP::QMTranActTable

Transition-Action Table for the QP::QMsm State Machine.

Definition at line 593 of file qep.hpp.

Collaboration diagram for QMTranActTable:
Collaboration graph
Data Fields
QMState const * target
QActionHandler const act[1]

Macro Definition Documentation

◆ QP_VERSION

#define QP_VERSION   693U

The current QP version as a decimal constant XXYZ, where XX is a 2-digit.

Definition at line 46 of file qep.hpp.

◆ QP_VERSION_STR

#define QP_VERSION_STR   "6.9.3"

The current QP version number string of the form XX.Y.Z, where XX is.

Definition at line 51 of file qep.hpp.

◆ QP_RELEASE

#define QP_RELEASE   0x8295AA8AU

Encrypted current QP release (6.9.3) and date (2021-04-12)

Definition at line 54 of file qep.hpp.

◆ Q_SIGNAL_SIZE

#define Q_SIGNAL_SIZE   2U

The size (in bytes) of the signal of an event. Valid values: 1U, 2U, or 4U; default 2U

Description
This macro can be defined in the QEP port file (qep_port.hpp) to configure the QP::QSignal type. When the macro is not defined, the default of 2 bytes is applied.

Definition at line 65 of file qep.hpp.

◆ Q_EVT_CAST

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

Perform downcast of an event onto a subclass of QEvt class_

Description
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 108 of file qep.hpp.

◆ Q_UINT2PTR_CAST

#define Q_UINT2PTR_CAST (   type_,
  uint_ 
)    (reinterpret_cast<type_ *>(uint_))

Perform cast from unsigned integer uint_ to pointer of type type_.

Description
This macro encapsulates the cast to (type_ *), which QP ports or application might use to access embedded hardware registers. Such uses can trigger PC-Lint "Note 923: cast from int to pointer" and this macro helps to encapsulate this deviation.

Definition at line 117 of file qep.hpp.

◆ QEVT_INITIALIZER

#define QEVT_INITIALIZER (   sig_)    { static_cast<QP::QSignal>(sig_), 0U, 0U }

Initializer of static constant QEvt instances

Description
This macro encapsulates the ugly casting of enumerated signals to QSignal and constants for QEvt.poolID and QEvt.refCtr_.

Definition at line 124 of file qep.hpp.

◆ Q_STATE_DECL

#define Q_STATE_DECL (   state_)
Value:
QP::QState state_ ## _h(QP::QEvt const * const e); \
static QP::QState state_(void * const me, QP::QEvt const * const e)
std::uint_fast8_t QState
Type returned from state-handler functions.
Definition: qep.hpp:223

Macro to generate a declaration of a state-handler, state-caller and a state-object for a given state in a subclass of QP::QHsm.

Definition at line 619 of file qep.hpp.

◆ Q_STATE_DEF

#define Q_STATE_DEF (   subclass_,
  state_ 
)
Value:
QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)

Macro to generate a definition of a state-handler for a given state in a subclass of QP::QHsm.

Definition at line 625 of file qep.hpp.

◆ Q_HANDLED

#define Q_HANDLED ( )    (Q_RET_HANDLED)

Macro to specify that the event was handled.

Definition at line 631 of file qep.hpp.

◆ Q_UNHANDLED

#define Q_UNHANDLED ( )    (Q_RET_UNHANDLED)

Macro to specify that the event was NOT handled due to a guard condition evaluating to 'false'

Definition at line 635 of file qep.hpp.

◆ Q_STATE_CAST

#define Q_STATE_CAST (   handler_)     (reinterpret_cast<QP::QStateHandler>(handler_))

Macro to perform casting to QStateHandler.

Description
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 642 of file qep.hpp.

◆ Q_ACTION_CAST

#define Q_ACTION_CAST (   act_)    (reinterpret_cast<QP::QActionHandler>(act_))

Macro to perform casting to QActionHandler.

Description
This macro encapsulates the cast of a specific action handler function pointer to QActionHandler, which violates MISRA-C2004 rule 11.4(advisory). This macro helps to localize this deviation.

Definition at line 650 of file qep.hpp.

◆ Q_ACTION_NULL

#define Q_ACTION_NULL   (nullptr)

Macro to provide strictly-typed zero-action to terminate action lists in the transition-action-tables

Definition at line 654 of file qep.hpp.

◆ QM_STATE_DECL

#define QM_STATE_DECL (   state_)
Value:
QP::QState state_ ## _h(QP::QEvt const * const e); \
static QP::QState state_(void * const me, QP::QEvt const * const e); \
static QP::QMState const state_ ## _s

Macro to generate a declaration of a state-handler, state-caller and a state-object for a given state in a subclass of QP::QMsm.

Definition at line 662 of file qep.hpp.

◆ QM_SM_STATE_DECL

#define QM_SM_STATE_DECL (   subm_,
  state_ 
)
Value:
QP::QState state_ ## _h(QP::QEvt const * const e); \
static QP::QState state_(void * const me, QP::QEvt const * const e); \
static SM_ ## subm_ const state_ ## _s

Macro to generate a declaration of a state-handler, state-caller and a state-object for a given submachine state in a subclass of QP::QMsm.

Definition at line 669 of file qep.hpp.

◆ QM_ACTION_DECL

#define QM_ACTION_DECL (   action_)
Value:
QP::QState action_ ## _h(void); \
static QP::QState action_(void * const me)

Macro to generate a declaration of an action-handler and action-caller in a subclass of QP::QMsm.

Definition at line 676 of file qep.hpp.

◆ QM_STATE_DEF

#define QM_STATE_DEF (   subclass_,
  state_ 
)
Value:
QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)

Macro to generate a definition of a state-caller and state-handler for a given state in a subclass of QP::QMsm.

Definition at line 682 of file qep.hpp.

◆ QM_ACTION_DEF

#define QM_ACTION_DEF (   subclass_,
  action_ 
)
Value:
QP::QState subclass_::action_(void * const me) { \
return static_cast<subclass_ *>(me)->action_ ## _h(); } \
QP::QState subclass_::action_ ## _h(void)

Macro to generate a definition of an action-caller and action-handler in a subclass of QP::QMsm.

Definition at line 689 of file qep.hpp.

◆ QM_HANDLED

#define QM_HANDLED ( )    (Q_RET_HANDLED)

Macro for a QM action-handler when it handles the event.

Definition at line 695 of file qep.hpp.

◆ QM_UNHANDLED

#define QM_UNHANDLED ( )    (Q_RET_UNHANDLED)

Macro for a QM action-handler when it does not handle the event due to a guard condition evaluating to false.

Definition at line 699 of file qep.hpp.

◆ QM_SUPER

#define QM_SUPER ( )    (Q_RET_SUPER)

Macro for a QM action-handler when it passes the event to the superstate.

Definition at line 702 of file qep.hpp.

◆ QM_STATE_NULL

#define QM_STATE_NULL   (nullptr)

Macro to provide strictly-typed zero-state to use for submachines. Applicable to suclasses of QP::QMsm.

Definition at line 706 of file qep.hpp.

Typedef Documentation

◆ char_t

using char_t = char

alias for characters and character strings.

Description
This alias specifies character type for exclusive use in character strings. Use of this type, rather than plain 'char', is in compliance with the MISRA-C 2004 Rules 6.1(req), 6.3(adv).

Definition at line 76 of file qep.hpp.

◆ int_t

using int_t = int

alias for line numbers in assertions and return from QF::run()

Definition at line 79 of file qep.hpp.

◆ enum_t

using enum_t = int

alias for enumerations used for event signals

Definition at line 82 of file qep.hpp.

◆ float32_t

using float32_t = float

alias for 32-bit IEEE 754 floating point numbers

Note
QP does not use floating-point types anywhere in the internal implementation, except in QS software tracing, where utilities for output of floating-point numbers are provided for application-level trace records.

Definition at line 91 of file qep.hpp.

◆ float64_t

using float64_t = double

alias for 64-bit IEEE 754 floating point numbers

Note
QP does not use floating-point types anywhere in the internal implementation, except in QS software tracing, where utilities for output of floating-point numbers are provided for application-level trace records.

Definition at line 100 of file qep.hpp.