swift
Loading...
Searching...
No Matches
hub.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_HUB_H
7#define SWIFT_MISC_SHAREDSTATE_DBUS_HUB_H
8
9#include <QFuture>
10#include <QObject>
11#include <QSharedPointer>
12
15
17#define SWIFT_MISC_HUB_INTERFACE "org.swift_project.misc.sharedstate.hub"
18
20#define SWIFT_MISC_HUB_PATH "/org/swift_project/hub"
21
22class QDBusConnection;
23
24namespace swift::misc
25{
26 class CDBusServer;
27 class CIdentifier;
28
29 namespace shared_state::dbus
30 {
31 class IDuplex;
32
37 {
39 Q_CLASSINFO("D-Bus Interface", SWIFT_MISC_HUB_INTERFACE)
40
41 public:
43 static IHub *create(bool proxy, CDBusServer *server, const QDBusConnection &connection,
44 const QString &service, QObject *parent = nullptr);
45
47 virtual bool isConnected() const = 0;
48
50 virtual std::pair<QSharedPointer<IDuplex>, QFuture<bool>> getDuplex(const CIdentifier &) = 0;
51
52 public slots:
54 virtual bool openDuplex(const swift::misc::CIdentifier &client) = 0;
55
57 virtual void closeDuplex(const swift::misc::CIdentifier &client) = 0;
58
59 protected:
61 virtual QFuture<bool> openDuplexAsync(const CIdentifier &client) = 0;
62
64 IHub(QObject *parent = nullptr);
65 };
66 } // namespace shared_state::dbus
67} // namespace swift::misc
68
69#endif // SWIFT_MISC_SHAREDSTATE_DBUS_HUB_H
Custom DBusServer.
Definition dbusserver.h:34
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition identifier.h:29
virtual QFuture< bool > openDuplexAsync(const CIdentifier &client)=0
Create a duplex object and return status via future.
virtual bool openDuplex(const swift::misc::CIdentifier &client)=0
Create a duplex object for the identified process.
virtual bool isConnected() const =0
Is connected?
virtual void closeDuplex(const swift::misc::CIdentifier &client)=0
Destroy the duplex object for the identified process.
static IHub * create(bool proxy, CDBusServer *server, const QDBusConnection &connection, const QString &service, QObject *parent=nullptr)
Construct a new hub.
Definition hub.cpp:17
virtual std::pair< QSharedPointer< IDuplex >, QFuture< bool > > getDuplex(const CIdentifier &)=0
Get a duplex object for the calling process.
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.