swift
Loading...
Searching...
No Matches
hubimpl.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_HUBIMPL_H
7#define SWIFT_MISC_SHAREDSTATE_DBUS_HUBIMPL_H
8
9#include <QMap>
10#include <QSharedPointer>
11
12#include "misc/identifier.h"
14
15namespace swift::misc
16{
17 class CDBusServer;
18
19 namespace shared_state::dbus
20 {
21 class CDuplex;
22
26 class SWIFT_MISC_EXPORT CHub final : public IHub
27 {
29 Q_CLASSINFO("D-Bus Interface", SWIFT_MISC_HUB_INTERFACE)
30
31 public:
33 CHub(CDBusServer *server, QObject *parent = nullptr);
34
36 ~CHub() override;
37
39 const auto &clients() const { return m_clients; }
40
43 bool isConnected() const override { return true; }
44 std::pair<QSharedPointer<IDuplex>, QFuture<bool>> getDuplex(const CIdentifier &) override;
46
47 public slots:
50
52 bool openDuplex(const swift::misc::CIdentifier &client) override;
53
55 void closeDuplex(const swift::misc::CIdentifier &client) override;
57
58 protected:
61 QFuture<bool> openDuplexAsync(const CIdentifier &client) override;
63
64 private:
65 CDBusServer *m_server = nullptr;
67 };
68 } // namespace shared_state::dbus
69} // namespace swift::misc
70
71#endif // SWIFT_MISC_SHAREDSTATE_DBUS_HUBIMPL_H
Custom DBusServer.
Definition dbusserver.h:34
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition identifier.h:29
Server side implementation of IDuplex.
Definition dupleximpl.h:27
bool isConnected() const
Create a duplex object for the identified process.
Definition hubimpl.h:43
CHub(CDBusServer *server, QObject *parent=nullptr)
Constructor.
Definition hubimpl.cpp:14
const auto & clients() const
Returns a range containing all duplex objects.
Definition hubimpl.h:39
IHub(QObject *parent=nullptr)
Constructor.
Definition hub.cpp:15
#define SWIFT_MISC_HUB_INTERFACE
DBus interface for sharedstate hub.
Definition hub.h:17
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.