swift
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 
15 namespace 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  {
28  Q_OBJECT
29  Q_CLASSINFO("D-Bus Interface", SWIFT_MISC_HUB_INTERFACE)
30 
31  public:
33  CHub(CDBusServer *server, QObject *parent = nullptr);
34 
36  virtual ~CHub() override;
37 
39  const auto &clients() const { return m_clients; }
40 
43  virtual bool isConnected() const override { return true; }
44  virtual std::pair<QSharedPointer<IDuplex>, QFuture<bool>> getDuplex(const CIdentifier &) override;
46 
47  public slots:
50 
52  virtual bool openDuplex(const swift::misc::CIdentifier &client) override;
53 
55  virtual void closeDuplex(const swift::misc::CIdentifier &client) override;
57 
58  protected:
61  virtual 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 IHub.
Definition: hubimpl.h:27
const auto & clients() const
Returns a range containing all duplex objects.
Definition: hubimpl.h:39
virtual bool isConnected() const
Create a duplex object for the identified process.
Definition: hubimpl.h:43
Abstract interface for the hub in a star topology.
Definition: hub.h:37
#define SWIFT_MISC_HUB_INTERFACE
DBus interface for sharedstate hub.
Definition: hub.h:17
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.