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