CuteHMI - Data Acquisition (CuteHMI.DataAcquisition.1)
EventWriter.hpp
1#ifndef H_EXTENSIONS_CUTEHMI_DATAACQUISITION_1_INCLUDE_CUTEHMI_DATAACQUISITION_EVENTWRITER_HPP
2#define H_EXTENSIONS_CUTEHMI_DATAACQUISITION_1_INCLUDE_CUTEHMI_DATAACQUISITION_EVENTWRITER_HPP
3
4#include "internal/EventCollective.hpp"
5#include "internal/DbServiceableMixin.hpp"
6#include "AbstractWriter.hpp"
7
8#include <cutehmi/services/Serviceable.hpp>
9
10namespace cutehmi {
11namespace dataacquisition {
12
13class CUTEHMI_DATAACQUISITION_API EventWriter:
15 private internal::DbServiceableMixin<EventWriter>
16{
17 Q_OBJECT
18 QML_NAMED_ELEMENT(EventWriter)
19
21
22 public:
23 EventWriter(QObject * parent = nullptr);
24
25 void configureStarting(QState * starting, AssignStatusFunction assignStatus) override;
26
27 void configureStarted(QState * active, const QState * idling, const QState * yielding, AssignStatusFunction assignStatus) override;
28
29 void configureStopping(QState * stopping, AssignStatusFunction assignStatus) override;
30
31 void configureBroken(QState * broken, AssignStatusFunction assignStatus) override;
32
33 void configureRepairing(QState * repairing, AssignStatusFunction assignStatus) override;
34
35 void configureEvacuating(QState * evacuating, AssignStatusFunction assignStatus) override;
36
37 std::unique_ptr<QAbstractTransition> transitionToStarted() const override;
38
39 std::unique_ptr<QAbstractTransition> transitionToStopped() const override;
40
41 std::unique_ptr<QAbstractTransition> transitionToBroken() const override;
42
43 std::unique_ptr<QAbstractTransition> transitionToYielding() const override;
44
45 std::unique_ptr<QAbstractTransition> transitionToIdling() const override;
46
47 protected:
48 Q_SIGNAL void collectiveFinished();
49
50 void onValueAppend(TagValue * tagValue) override;
51
52 void onValueRemove(TagValue * tagValue) override;
53
54 private slots:
55 void onSchemaChanged();
56
57 void insertEvent(cutehmi::dataacquisition::TagValue * tagValue);
58
59 void connectValueChangedSignals();
60
61 void disconnectValueChangedSignals();
62
63 void confirmCollectiveFinished();
64
65 private:
66 void configureStartingOrRepairing(QState * parent, AssignStatusFunction assignStatus);
67
68 void connectValueChangedSignal(TagValue * value);
69
70 struct Members
71 {
72 bool valueChangedConnectionsActive;
73 internal::EventCollective dbCollective;
74
75 Members():
76 valueChangedConnectionsActive(false)
77 {
78 }
79 };
80
82};
83
84}
85}
86
87#endif
88
89//(c)C: Copyright © 2022, Michał Policht <michal@policht.pl>. All rights reserved.
90//(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
91//(c)C: This file is a part of CuteHMI.
92//(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.
93//(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.
94//(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/>.
95//(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
96//(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:
97//(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
98//(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.
Abstract database writer.
Definition: AbstractWriter.hpp:28
Definition: EventWriter.hpp:16
Tag value.
Definition: TagValue.hpp:19
Definition: DbServiceableMixin.hpp:17
Definition: EventCollective.hpp:17