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#include "qabstractgrpcchannel.h"
6#include "qabstractgrpcchannel_p.h"
7
8QT_BEGIN_NAMESPACE
9
10/*!
11 \class QAbstractGrpcChannel
12 \inmodule QtGrpc
13 \brief The QAbstractGrpcChannel class is interface that represents common
14 gRPC channel functionality.
15
16 You may implement this interface to create your own channels for gRPC transport.
17 QGrpcChannel or QGrpcHttp2Channel, which are full implementations of
18 QAbstractGrpcChannel are recommended to use.
19*/
20
21/*!
22 \fn virtual QGrpcStatus QAbstractGrpcChannel::call(QLatin1StringView method, QLatin1StringView service,
23 QByteArrayView args, QByteArray &ret, const QGrpcCallOptions &options = QGrpcCallOptions()) = 0
24
25 This pure virtual function synchronously calls the RPC method concatenated
26 from the \a method and \a service parameters with the given \a args
27 and writes the result to the output parameter \a ret.
28 Uses \a options argument to set additional parameter for the call.
29
30 You may reimplement this function in a subclass to define your own call
31 mechanism behavior. QGrpcChannel or QGrpcHttp2Channel, which are full
32 implementations of QAbstractGrpcChannel are recommended to use.
33*/
34
35/*!
36 \fn virtual std::shared_ptr<QGrpcCallReply> QAbstractGrpcChannel::call(QLatin1StringView method,
37 QLatin1StringView service, QByteArrayView args, const QGrpcCallOptions &options = QGrpcCallOptions()) = 0
38
39 This pure virtual function asynchronously calls the RPC method combined
40 with the \a method and \a service parameters with the given \a args
41 and returns an asynchronous response in the form of QGrpcCallReply.
42 Uses \a options argument to set additional parameter for the call.
43
44 You may reimplement this function in a subclass to define your own call
45 mechanism behavior. QGrpcChannel or QGrpcHttp2Channel, which are full
46 implementations of QAbstractGrpcChannel are recommended to use.
47*/
48
49/*!
50 \fn virtual std::shared_ptr<QGrpcStream> QAbstractGrpcChannel::startStream(QLatin1StringView method,
51 QLatin1StringView service, QByteArrayView arg, const QGrpcCallOptions &options = QGrpcCallOptions()) = 0
52
53 This pure virtual function creates and starts a stream to the RPC method.
54
55 The RPC method name is constructed by concatenating the \a method
56 and \a service parameters and called with the \a arg argument.
57 Returns a shared pointer to the QGrpcStream. Uses \a options argument
58 to set additional parameter for the stream.
59
60 You may reimplement this function in a subclass to define your own stream
61 mechanism behavior. QGrpcChannel or QGrpcHttp2Channel, which are full
62 implementations of QAbstractGrpcChannel are recommended to use.
63*/
64
65/*!
66 \fn virtual std::shared_ptr<QAbstractProtobufSerializer> QAbstractGrpcChannel::serializer() const = 0
67
68 This pure virtual function shall return a shared pointer
69 to QAbstractProtobufSerializer.
70
71 This function is called to obtain the QAbstractProtobufSerializer used
72 to perform serialization and deserialization of the message.
73*/
74
75QAbstractGrpcChannel::QAbstractGrpcChannel() : dPtr(std::make_unique<QAbstractGrpcChannelPrivate>())
76{
77}
78QAbstractGrpcChannel::~QAbstractGrpcChannel() = default;
79
80QT_END_NAMESPACE
81

source code of qtgrpc/src/grpc/qabstractgrpcchannel.cpp