swift
dupleximpl.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_DBUS_DUPLEXIMPL_H
7 #define SWIFT_MISC_SHAREDSTATE_DBUS_DUPLEXIMPL_H
8 
9 #include <functional>
10 
12 
13 namespace swift::misc
14 {
15  class CIdentifier;
16  class CDBusServer;
17 
18  namespace shared_state::dbus
19  {
20  class CHub;
21 
26  class SWIFT_MISC_EXPORT CDuplex final : public IDuplex
27  {
28  Q_OBJECT
29  Q_CLASSINFO("D-Bus Interface", SWIFT_MISC_DUPLEX_INTERFACE)
30 
31  public:
33  CDuplex(CHub *hub, const CIdentifier &client, CDBusServer *server, QObject *parent = nullptr);
34 
36  virtual ~CDuplex() override;
37 
38  public slots:
41 
43  virtual void postEvent(const QString &channel, const swift::misc::CVariant &param) override;
44 
46  virtual void setSubscription(const QString &channel, const swift::misc::CVariantList &filters) override;
47 
49  virtual void requestPeerSubscriptions() override;
50 
52  virtual void submitRequest(const QString &channel, const swift::misc::CVariant &param,
53  quint32 token) override;
54 
56  virtual void advertise(const QString &channel) override;
57 
59  virtual void withdraw(const QString &channel) override;
61 
62  private:
63  void requestPeerSubscriptions(const QString &channel);
64 
65  CHub *m_hub = nullptr;
66  QMap<QString, CVariantList> m_subscriptions;
67  QSet<QString> m_handlingChannels;
68  };
69  } // namespace shared_state::dbus
70 } // namespace swift::misc
71 
72 #endif // SWIFT_MISC_SHAREDSTATE_DBUS_DUPLEXIMPL_H
Custom DBusServer.
Definition: dbusserver.h:34
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition: identifier.h:29
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
Value object encapsulating a list of variants.
Definition: variantlist.h:29
Server side implementation of IDuplex.
Definition: dupleximpl.h:27
Server side implementation of IHub.
Definition: hubimpl.h:27
Abstract interface for the spoke in a star topology.
Definition: duplex.h:36
#define SWIFT_MISC_DUPLEX_INTERFACE
DBus interface for sharedstate hub.
Definition: duplex.h:19
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.