46 #define QP_VERSION 693U
51 #define QP_VERSION_STR "6.9.3"
54 #define QP_RELEASE 0x8295AA8AU
65 #define Q_SIGNAL_SIZE 2U
108 #define Q_EVT_CAST(class_) (static_cast<class_ const *>(e))
117 #define Q_UINT2PTR_CAST(type_, uint_) (reinterpret_cast<type_ *>(uint_))
124 #define QEVT_INITIALIZER(sig_) { static_cast<QP::QSignal>(sig_), 0U, 0U }
135 #if (Q_SIGNAL_SIZE == 1U)
137 #elif (Q_SIGNAL_SIZE == 2U)
147 #elif (Q_SIGNAL_SIZE == 4U)
150 #error "Q_SIGNAL_SIZE defined incorrectly, expected 1U, 2U, or 4U"
166 constexpr
QEvt(
QSignal const s, StaticEvt ) noexcept
174 virtual ~
QEvt() noexcept {}
278 virtual void init(
void const *
const e,
283 this->
init(
nullptr, qs_id);
305 static QState top(
void *
const me,
QEvt const *
const e) noexcept;
388 void const *
const tatbl) noexcept
412 void const *
const tatbl) noexcept
505 void init(
void const *
const e,
508 this->
init(
nullptr, qs_id);
619 #define Q_STATE_DECL(state_) \
620 QP::QState state_ ## _h(QP::QEvt const * const e); \
621 static QP::QState state_(void * const me, QP::QEvt const * const e)
625 #define Q_STATE_DEF(subclass_, state_) \
626 QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
627 return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
628 QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)
631 #define Q_HANDLED() (Q_RET_HANDLED)
635 #define Q_UNHANDLED() (Q_RET_UNHANDLED)
642 #define Q_STATE_CAST(handler_) \
643 (reinterpret_cast<QP::QStateHandler>(handler_))
650 #define Q_ACTION_CAST(act_) (reinterpret_cast<QP::QActionHandler>(act_))
654 #define Q_ACTION_NULL (nullptr)
662 #define QM_STATE_DECL(state_) \
663 QP::QState state_ ## _h(QP::QEvt const * const e); \
664 static QP::QState state_(void * const me, QP::QEvt const * const e); \
665 static QP::QMState const state_ ## _s
669 #define QM_SM_STATE_DECL(subm_, state_) \
670 QP::QState state_ ## _h(QP::QEvt const * const e); \
671 static QP::QState state_(void * const me, QP::QEvt const * const e); \
672 static SM_ ## subm_ const state_ ## _s
676 #define QM_ACTION_DECL(action_) \
677 QP::QState action_ ## _h(void); \
678 static QP::QState action_(void * const me)
682 #define QM_STATE_DEF(subclass_, state_) \
683 QP::QState subclass_::state_(void * const me, QP::QEvt const * const e) {\
684 return static_cast<subclass_ *>(me)->state_ ## _h(e); } \
685 QP::QState subclass_::state_ ## _h(QP::QEvt const * const e)
689 #define QM_ACTION_DEF(subclass_, action_) \
690 QP::QState subclass_::action_(void * const me) { \
691 return static_cast<subclass_ *>(me)->action_ ## _h(); } \
692 QP::QState subclass_::action_ ## _h(void)
695 #define QM_HANDLED() (Q_RET_HANDLED)
699 #define QM_UNHANDLED() (Q_RET_UNHANDLED)
702 #define QM_SUPER() (Q_RET_SUPER)
706 #define QM_STATE_NULL (nullptr)
unsigned int uint16_t
exact-width 16-bit unsigned int
unsigned long int uint32_t
exact-width 32-bit unsigned int
signed int int_fast8_t
fast at-least 8-bit signed int
unsigned char uint8_t
exact-width 8-bit unsigned int
unsigned int uint_fast8_t
fast at-least 8-bit unsigned int
Dummy Active Object class.
QActive active object (based on QP::QHsm implementation)
Provides miscellaneous QEP services.
static char_t const * getVersion(void) noexcept
get the current QEP version number string of the form "X.Y.Z"
Native QF Event Queue class.
Hierarchical State Machine base class.
static constexpr QState Q_RET_SUPER_SUB
event passed to submachine superstate
QState qm_tran_init(void const *const tatbl) noexcept
Helper function to specify an initial state transition in a QM state-handler.
QState qm_tran_hist(QMState const *const hist, void const *const tatbl) noexcept
Helper function to specifiy a transition to history in a QM state-handler.
static constexpr QState Q_RET_HANDLED
event handled (internal transition)
static constexpr QState Q_RET_SUPER
event passed to the superstate to handle
QState tran_hist(QStateHandler const hist) noexcept
Helper function to specify a transition to history.
static constexpr QState Q_RET_UNHANDLED
event unhandled due to a guard evaluating to 'false'
QState qm_entry(QMState const *const s) noexcept
Helper function to specify a state entry in a QM state-handler.
virtual void dispatch(QEvt const *const e, std::uint_fast8_t const qs_id)
Dispatches an event to QHsm.
static constexpr QState Q_RET_IGNORED
event silently ignored (bubbled up to top)
@ Q_INIT_SIG
signal for nested initial transitions
@ Q_EXIT_SIG
signal for exit actions
@ Q_ENTRY_SIG
signal for entry actions
QState tran(QStateHandler const target) noexcept
Helper function to specify a state transition.
QState qm_tran_xp(QActionHandler const xp, void const *const tatbl) noexcept
Helper function to specify a transition to an exit point from a submachine state in a QM state-handle...
static QState top(void *const me, QEvt const *const e) noexcept
the top-state.
virtual void init(std::uint_fast8_t const qs_id)
overloaded init(qs_id)
virtual QStateHandler getStateHandler() noexcept
Get the current state handler of the HSM.
virtual ~QHsm()
virtual destructor
QState qm_tran_ep(void const *const tatbl) noexcept
Helper function to specify a transition to an entry point to a submachine state in a QM state-handler...
virtual void init(void const *const e, std::uint_fast8_t const qs_id)
executes the top-most initial transition in QP::QHsm
static constexpr QState Q_RET_TRAN_EP
entry-point transition into a submachine
QState qm_super_sub(QMState const *const s) noexcept
Helper function to call in a QM state-handler when it passes the event to the host submachine state t...
static constexpr QState Q_RET_TRAN_INIT
initial transition taken
static constexpr QState Q_RET_NULL
return value without any effect
static constexpr QState Q_RET_TRAN
regular transition taken
QStateHandler childState(QStateHandler const parent) noexcept
Obtain the current active child state of a given parent.
QHsmAttr m_state
current active state (state-variable)
static constexpr QState Q_RET_EXIT
state exit action executed
static constexpr std::int_fast8_t MAX_NEST_DEPTH_
< maximum nesting depth of states in HSM
QState qm_exit(QMState const *const s) noexcept
Helper function to specify a state exit in a QM state-handler.
QStateHandler state(void) const noexcept
Obtain the current state (state handler function)
QState super(QStateHandler const superstate) noexcept
Helper function to specify the superstate of a given state.
QState qm_tran(void const *const tatbl) noexcept
Helper function to specify a regular state transition in a QM state-handler.
bool isIn(QStateHandler const s) noexcept
Tests if a given state is part of the current active state configuration.
static constexpr QState Q_RET_TRAN_HIST
transition to history of a given state
QHsmAttr m_temp
temporary: transition chain, target state, etc.
static constexpr QState Q_RET_TRAN_XP
exit-point transition out of a submachine
std::int_fast8_t hsm_tran(QStateHandler(&path)[MAX_NEST_DEPTH_], std::uint_fast8_t const qs_id)
internal helper function to take a transition in QP::QHsm
static constexpr QState Q_RET_ENTRY
state entry action executed
QState qm_sm_exit(QMState const *const s) noexcept
Helper function to specify a submachine exit in a QM state-handler.
QHsm(QStateHandler const initial) noexcept
Protected constructor of QHsm.
QMActive active object (based on QP::QMsm implementation)
QM State Machine implementation strategy.
void exitToTranSource_(QMState const *s, QMState const *const ts, std::uint_fast8_t const qs_id)
Internal helper function to exit current state to transition source.
bool isIn(QStateHandler const s) noexcept=delete
disallow inhertited isIn() function in QP::QMsm and subclasses
static QMState const msm_top_s
the top state object for the QMsm
QStateHandler getStateHandler() noexcept override
Get the current state handler of the QMsm.
QStateHandler state(void) const noexcept=delete
disallow inhertited state() function in QP::QMsm and subclasses
static QState top(void *const me, QEvt const *const e) noexcept=delete
disallow inhertited top() function in QP::QMsm and subclasses
QMState const * stateObj(void) const noexcept
Return the current active state object (read only)
QState execTatbl_(QMTranActTable const *const tatbl, std::uint_fast8_t const qs_id)
Internal helper function to execute a transition-action table.
void dispatch(QEvt const *const e, std::uint_fast8_t const qs_id) override
Dispatches an event to a HSM.
static constexpr std::int_fast8_t MAX_ENTRY_DEPTH_
maximum depth of implemented entry levels for transitions to history
void init(std::uint_fast8_t const qs_id) override
overloaded init(qs_id)
QMState const * childStateObj(QMState const *const parent) const noexcept
Obtain the current active child state of a given parent (read only)
QStateHandler childState(QStateHandler const parent) noexcept=delete
disallow inhertited childState() function in QP::QMsm and subclasses
QState enterHistory_(QMState const *const hist, std::uint_fast8_t const qs_id)
Internal helper function to enter state history.
void init(void const *const e, std::uint_fast8_t const qs_id) override
Performs the second step of SM initialization by triggering the top-most initial transition.
bool isInState(QMState const *const st) const noexcept
Tests if a given state is part of the active state configuration.
Ticker Active Object class.
Priority Ceiling Mutex the QXK preemptive kernel.
Counting Semaphore of the QXK preemptive kernel.
Extended (blocking) thread of the QXK preemptive kernel.
namespace associated with the QP/C++ framework
std::uint_fast8_t QState
Type returned from state-handler functions.
void(*)(QXThread *const me) QXThreadHandler
Pointer to a thread-handler function.
QActionHandler const act[1]
void QF_EVT_REF_CTR_INC_(QEvt const *const e) noexcept
increment the refCtr_ of an event e
QMState const * obj
pointer to QMState object
QMTranActTable const * tatbl
transition-action table
QActionHandler const entryAction
entry action handler function
QMState const * superstate
superstate of this state
constexpr char_t const versionStr[]
the current QP version number string based on QP_VERSION_STR
QState(*)(void *const me) QActionHandler
Pointer to an action-handler function.
constexpr enum_t Q_USER_SIG
Offset or the user signals.
std::uint8_t QF_EVT_POOL_ID_(QEvt const *const e) noexcept
return the Pool-ID of an event e
QActionHandler const initAction
init action handler function
QState(*)(void *const me, QEvt const *const e) QStateHandler
Pointer to state-handler function.
QActionHandler const exitAction
exit action handler function
QStateHandler const stateHandler
state handler function
QXThreadHandler thr
pointer to an thread-handler function
QStateHandler fun
pointer to a state handler function
std::uint16_t QSignal
QSignal represents the signal of an event.
void QF_EVT_REF_CTR_DEC_(QEvt const *const e) noexcept
decrement the refCtr_ of an event e
std::uint8_t QF_EVT_REF_CTR_(QEvt const *const e) noexcept
return the Reference Conter of an event e
QActionHandler act
pointer to an action-handler function
State object for the QP::QMsm class (QM State Machine).
Transition-Action Table for the QP::QMsm State Machine.
Attribute of for the QHsm class (Hierarchical State Machine).
char char_t
typedef for character strings.
int int_t
typedef for assertions-ids and line numbers in assertions.
int enum_t
alias for enumerations used for event signals
float float32_t
alias for 32-bit IEEE 754 floating point numbers
#define QP_VERSION_STR
The current QP version number string of the form XX.Y.Z, where XX is.
double float64_t
alias for 64-bit IEEE 754 floating point numbers
QSignal sig
signal of the event instance
std::uint8_t volatile refCtr_
reference counter
std::uint8_t poolId_
pool ID (0 for static event)