swift
Loading...
Searching...
No Matches
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
13namespace 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 {
30
31 public:
33 CDuplex(CHub *hub, const CIdentifier &client, CDBusServer *server, QObject *parent = nullptr);
34
36 ~CDuplex() override;
37
38 public slots:
41
43 void postEvent(const QString &channel, const swift::misc::CVariant &param) override;
44
46 void setSubscription(const QString &channel, const swift::misc::CVariantList &filters) override;
47
49 void requestPeerSubscriptions() override;
50
52 void submitRequest(const QString &channel, const swift::misc::CVariant &param, quint32 token) override;
53
55 void advertise(const QString &channel) override;
56
58 void withdraw(const QString &channel) override;
60
61 private:
62 void requestPeerSubscriptions(const QString &channel);
63
64 CHub *m_hub = nullptr;
65 QMap<QString, CVariantList> m_subscriptions;
66 QSet<QString> m_handlingChannels;
67 };
68 } // namespace shared_state::dbus
69} // namespace swift::misc
70
71#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:69
Value object encapsulating a list of variants.
Definition variantlist.h:29
void postEvent(const QString &channel, const swift::misc::CVariant &param)
Client posts an event to the server.
void advertise(const QString &channel)
Client advertises that it can handle requests for the given channel.
void requestPeerSubscriptions()
Client requests to be notified of all other clients' subscriptions.
CDuplex(CHub *hub, const CIdentifier &client, CDBusServer *server, QObject *parent=nullptr)
Constructor.
void setSubscription(const QString &channel, const swift::misc::CVariantList &filters)
Client announces its subscription to an event channel.
void submitRequest(const QString &channel, const swift::misc::CVariant &param, quint32 token)
Client submits a request to the server. Reply is returned via a future.
void withdraw(const QString &channel)
Client advertises that it can no longer handle requests for the given channel.
Server side implementation of IHub.
Definition hubimpl.h:27
IDuplex(QObject *parent=nullptr)
Constructor.
Definition duplex.cpp:10
#define SWIFT_MISC_DUPLEX_INTERFACE
DBus interface for sharedstate hub.
Definition duplex.h:19
Free functions in swift::misc.
QObject(QObject *parent)
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
QObject * parent() const const
#define SWIFT_MISC_EXPORT
Export a class or function from the library.