swift
scalarjournal.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2020 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_SHAREDSTATE_SCALARJOURNAL_H
7 #define SWIFT_MISC_SHAREDSTATE_SCALARJOURNAL_H
8 
9 #include <QMutex>
10 #include <QObject>
11 
14 #include "misc/swiftmiscexport.h"
15 #include "misc/variant.h"
16 
18 {
19  class IDataLink;
20 
26  {
27  Q_OBJECT
28 
29  public:
31  void initialize(IDataLink *);
32 
33  protected:
35  CGenericScalarJournal(QObject *parent) : QObject(parent) {}
36 
37  private:
38  CVariant handleRequest(const CVariant &param);
39  void handleEvent(const CVariant &param);
40 
41  QSharedPointer<CActiveMutator> m_mutator = CActiveMutator::create(this, &CGenericScalarJournal::handleRequest);
42  QSharedPointer<CPassiveObserver> m_observer =
43  CPassiveObserver::create(this, &CGenericScalarJournal::handleEvent);
44  CVariant m_value;
45  };
46 
52  template <typename T>
54  {
55  protected:
57  CScalarJournal(QObject *parent) : CGenericScalarJournal(parent) {}
58  };
59 } // namespace swift::misc::shared_state
60 
61 #endif // SWIFT_MISC_SHAREDSTATE_SCALARJOURNAL_H
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
static auto create(T *parent, F requestHandler)
Factory method.
Definition: activemutator.h:39
Non-template base class for CScalarJournal.
Definition: scalarjournal.h:26
CGenericScalarJournal(QObject *parent)
Constructor.
Definition: scalarjournal.h:35
static auto create(T *parent, F eventHandler)
Factory method.
Base class for an object that shares state with a corresponding CScalarObserver subclass object.
Definition: scalarjournal.h:54
CScalarJournal(QObject *parent)
Constructor.
Definition: scalarjournal.h:57
Utilities for sharing state between multiple objects.
Definition: application.h:48
#define SWIFT_MISC_EXPORT
Export a class or function from the library.