QP/C  8.0.3
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 // clear the whole QMActive object, so that the framework can start
48 // correctly even if the startup code fails to clear the uninitialized
49 // data (as is required by the C Standard).
50 QF_bzero_(me, sizeof(*me));
51
52 // NOTE: QActive inherits the QActvie class, but it calls the
53 // constructor of the QMsm subclass. This is because QMActive inherits
54 // the behavior from the QMsm subclass.
55 QMsm_ctor((QMsm *)(me), initial);
56
57 // NOTE: this vtable is identical as QMsm, but is provided
58 // for the QMActive subclass to provide a UNIQUE vptr to distinguish
59 // subclasses of QActive (e.g., in the debugger).
60 static struct QAsmVtable const vtable = { // QMActive virtual table
61 &QMsm_init_,
62 &QMsm_dispatch_,
63 &QMsm_isIn_
64#ifdef Q_SPY
65 ,&QMsm_getStateHandler_
66#endif
67 };
68 me->super.super.vptr = &vtable; // hook vptr to QMActive vtable
69}
QState(* QStateHandler)(void *const me, QEvt const *const e)
Pointer to a state-handler function.
Definition qp.h:145
Internal (package scope) QP/C interface.
Sample QP/C port.
QS/C dummy public interface.
Sample QS/C port.
QP Functional Safety (FuSa) Subsystem.
QAsm super
Definition qp.h:505
struct QAsmVtable const * vptr
Virtual pointer inherited by all QAsm subclasses (see also SAS_QP_OO)
Definition qp.h:179
Virtual table for the QAsm class.
Definition qp.h:221
Active object class (based on QMsm implementation strategy)
Definition qp.h:618
QActive super
Definition qp.h:619
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:311