1#ifndef H_EXTENSIONS_CUTEHMI_SERVICES_3_SRC_CUTEHMI_SERVICES_INTERNAL_STATEINTERFACEHELPERS_HPP
2#define H_EXTENSIONS_CUTEHMI_SERVICES_3_SRC_CUTEHMI_SERVICES_INTERNAL_STATEINTERFACEHELPERS_HPP
4#include "internal/common.hpp"
6#include <QAbstractTransition>
16template<std::
size_t N>
19 if (index < 0 ||
static_cast<std::size_t>(index) >= transitions.
size()) {
24 return transitions[index];
30 if (stateData.transitions[index] !=
nullptr) {
31 if (stateData.persistent)
32 stateData.persistent->removeTransition(stateData.transitions[index]);
33 stateData.transitions[index]->deleteLater();
34 stateData.transitions[index] =
nullptr;
41 CUTEHMI_ASSERT(source !=
nullptr,
"source state can not be nullptr");
45 if (serviceableTransition) {
46 transition = serviceableTransition.
release();
49 }
else if (unconditionalIfNull)
58 if (stateData.ephemeric) {
59 stateData.ephemeric->setParent(
nullptr);
60 stateData.ephemeric->deleteLater();
62 stateData.ephemeric =
new QState(stateData.persistent);
63 stateData.ephemeric->setObjectName(ephemericName);
64 stateData.persistent->setInitialState(stateData.ephemeric);
#define CUTEHMI_WARNING(EXPR)
#define CUTEHMI_ASSERT(EXPR, MSG)
QAbstractTransition * getTransition(const std::array< QAbstractTransition *, N > &transitions, int index)
Definition: stateInterfaceHelpers.hpp:17
QAbstractTransition * addServiceableTransition(QState *source, QState *target, std::unique_ptr< QAbstractTransition > serviceableTransition, bool unconditionalIfNull=false)
Definition: stateInterfaceHelpers.hpp:39
void clearTransition(T &stateData, std::size_t index)
Definition: stateInterfaceHelpers.hpp:28
void recreateState(T &stateData, const QString &ephemericName)
Definition: stateInterfaceHelpers.hpp:56
void setTargetState(QAbstractState *target)
void addTransition(QAbstractTransition *transition)