1 | // Copyright (C) 2022 The Qt Company Ltd. |
2 | // Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com> |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
4 | |
5 | #ifndef QABSTRACTGRPCCHANNEL_H |
6 | #define QABSTRACTGRPCCHANNEL_H |
7 | |
8 | #include <QtCore/QString> |
9 | #include <QtCore/QThread> |
10 | #include <QtCore/qbytearray.h> |
11 | #include <QtGrpc/qgrpccalloptions.h> |
12 | #include <QtGrpc/qgrpcstatus.h> |
13 | #include <QtGrpc/qtgrpcglobal.h> |
14 | |
15 | #include <memory> |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | class QAbstractGrpcClient; |
20 | class QAbstractProtobufSerializer; |
21 | struct QAbstractGrpcChannelPrivate; |
22 | class QGrpcStream; |
23 | class QGrpcCallReply; |
24 | |
25 | class Q_GRPC_EXPORT QAbstractGrpcChannel |
26 | { |
27 | public: |
28 | virtual QGrpcStatus call(QLatin1StringView method, QLatin1StringView service, |
29 | QByteArrayView args, QByteArray &ret, |
30 | const QGrpcCallOptions &options = QGrpcCallOptions()) = 0; |
31 | virtual std::shared_ptr<QGrpcCallReply> call( |
32 | QLatin1StringView method, QLatin1StringView service, QByteArrayView args, |
33 | const QGrpcCallOptions &options = QGrpcCallOptions()) = 0; |
34 | virtual std::shared_ptr<QGrpcStream> startStream( |
35 | QLatin1StringView method, QLatin1StringView service, QByteArrayView arg, |
36 | const QGrpcCallOptions &options = QGrpcCallOptions()) = 0; |
37 | virtual std::shared_ptr<QAbstractProtobufSerializer> serializer() const = 0; |
38 | |
39 | protected: |
40 | friend class QAbstractGrpcClient; |
41 | QAbstractGrpcChannel(); |
42 | virtual ~QAbstractGrpcChannel(); |
43 | |
44 | private: |
45 | Q_DISABLE_COPY(QAbstractGrpcChannel) |
46 | std::unique_ptr<QAbstractGrpcChannelPrivate> dPtr; |
47 | }; |
48 | |
49 | QT_END_NAMESPACE |
50 | |
51 | #endif // QABSTRACTGRPCCHANNEL_H |
52 | |