QP/C 8.1.2
Real-Time Event Framework
Loading...
Searching...
No Matches
qf_qmact.c
Go to the documentation of this file.
1//============================================================================
2// QP/C Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#define QP_IMPL // this is QP implementation
30#include "qp_port.h" // QP port
31#include "qp_pkg.h" // QP package-scope interface
32#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
33#ifdef Q_SPY // QS software tracing enabled?
34 #include "qs_port.h" // QS port
35 #include "qs_pkg.h" // QS facilities for pre-defined trace records
36#else
37 #include "qs_dummy.h" // disable the QS software tracing
38#endif // Q_SPY
39
40//Q_DEFINE_THIS_MODULE("qf_qmact")
41
42//............................................................................
43//! @protected @memberof QMActive
44void QMActive_ctor(QMActive * const me,
45 QStateHandler const initial)
46{
47 // NOTE: QMActive indirectly inherits the abstract QAsm base class,
48 // but it will delegate the state machine behavior to the QMsm class,
49 // so the following initiaization is identical as in QMsm ctor:
50 QMsm_ctor((QMsm *)(me), initial);
51
52 // NOTE: this vtable is identical as QMsm, but is provided
53 // for the QMActive subclass to provide a UNIQUE vptr to distinguish
54 // subclasses of QActive (e.g., in the debugger).
55 static struct QAsmVtable const vtable = { // QMActive virtual table
56 &QMsm_init_,
57 &QMsm_dispatch_,
58 &QMsm_isIn_,
59 &QMsm_getStateHandler_
60 };
61 me->super.super.vptr = &vtable; // hook vptr to QMActive vtable
62}
QState(* QStateHandler)(void *const me, QEvt const *const e)
Pointer to a state-handler function.
Definition qp.h:142
QP/C Framework in C internal (package-scope) interface.
Sample QP/C port.
QS (QP/Spy software tracing) internal (package-scope) interface.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
QAsm super
Definition qp.h:448
struct QAsmVtable const * vptr
Virtual pointer inherited by all QAsm subclasses (see also SAS_QP_OOA).
Definition qp.h:179
Virtual table for the QAsm class.
Definition qp.h:208
Active object class (based on QMsm implementation strategy).
Definition qp.h:560
QActive super
Definition qp.h:561
void QMActive_ctor(QMActive *const me, QStateHandler const initial)
Constructor of QMActive class.
Definition qf_qmact.c:44
Hierarchical State Machine class (QMsm-style state machine implementation strategy).
Definition qp.h:312