CuteHMI - Services (CuteHMI.Services.3)
Serviceable.hpp
1#ifndef H_EXTENSIONS_CUTEHMI_SERVICES_3_INCLUDE_CUTEHMI_SERVICES_SERVICEABLE_HPP
2#define H_EXTENSIONS_CUTEHMI_SERVICES_3_INCLUDE_CUTEHMI_SERVICES_SERVICEABLE_HPP
3
4#include "internal/common.hpp"
5
6#include <QObject>
7#include <QState>
8#include <QSignalTransition>
9
10#include <utility>
11
12namespace cutehmi {
13namespace services {
14
32class CUTEHMI_SERVICES_API Serviceable
33{
34 public:
35 typedef std::function<void (QState & state, const QString & status)> AssignStatusFunction;
36
42 virtual void configureStarting(QState * starting, AssignStatusFunction assignStatus) = 0;
43
56 virtual void configureStarted(QState * active, const QState * idling, const QState * yielding, AssignStatusFunction assignStatus) = 0;
57
63 virtual void configureStopping(QState * stopping, AssignStatusFunction assignStatus) = 0;
64
70 virtual void configureBroken(QState * broken, AssignStatusFunction assignStatus) = 0;
71
77 virtual void configureRepairing(QState * repairing, AssignStatusFunction assignStatus) = 0;
78
84 virtual void configureEvacuating(QState * evacuating, AssignStatusFunction assignStatus) = 0;
85
92
99
106
113
120
121 protected:
122 Serviceable() = default;
123
124 virtual ~Serviceable() = default;
125
126 Serviceable(const Serviceable & other) = default;
127
128 Serviceable & operator =(const Serviceable & other) = default;
129};
130
131}
132}
133
134Q_DECLARE_METATYPE(cutehmi::services::Serviceable *)
135
136#endif
137
138//(c)C: Copyright © 2022, Michał Policht <michal@policht.pl>. All rights reserved.
139//(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
140//(c)C: This file is a part of CuteHMI.
141//(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
142//(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
143//(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
144//(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
145//(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
146//(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
147//(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Serviceable interface.
Definition: Serviceable.hpp:33
virtual void configureEvacuating(QState *evacuating, AssignStatusFunction assignStatus)=0
Configure evacuating state.
virtual std::unique_ptr< QAbstractTransition > transitionToYielding() const =0
Transition to yielding state.
virtual void configureBroken(QState *broken, AssignStatusFunction assignStatus)=0
Configure broken state.
virtual void configureStopping(QState *stopping, AssignStatusFunction assignStatus)=0
Configure stopping state.
virtual ~Serviceable()=default
virtual std::unique_ptr< QAbstractTransition > transitionToIdling() const =0
Transition to idling state.
std::function< void(QState &state, const QString &status)> AssignStatusFunction
Definition: Serviceable.hpp:35
virtual std::unique_ptr< QAbstractTransition > transitionToBroken() const =0
Transition to broken state.
virtual void configureStarting(QState *starting, AssignStatusFunction assignStatus)=0
Configure starting state.
virtual std::unique_ptr< QAbstractTransition > transitionToStopped() const =0
Transition to stopped state.
Serviceable(const Serviceable &other)=default
virtual void configureStarted(QState *active, const QState *idling, const QState *yielding, AssignStatusFunction assignStatus)=0
Configure started state.
virtual void configureRepairing(QState *repairing, AssignStatusFunction assignStatus)=0
Configure repairing state.
virtual std::unique_ptr< QAbstractTransition > transitionToStarted() const =0
Transition to started state.