QtProtobuf  0.6
Protobuf plugin to generate Qt classes
Public Member Functions | List of all members
QtProtobuf::QGrpcChannel Class Referencefinal

The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel interface. More...

#include <qgrpcchannel.h>

Inheritance diagram for QtProtobuf::QGrpcChannel:
Inheritance graph
[legend]
Collaboration diagram for QtProtobuf::QGrpcChannel:
Collaboration graph
[legend]

Public Member Functions

 QGrpcChannel (const QUrl &name, std::shared_ptr< grpc::ChannelCredentials > credentials)
 QGrpcChannel constructs QGrpcChannel. More...
 
QGrpcStatus call (const QString &method, const QString &service, const QByteArray &args, QByteArray &ret) override
 Calls method synchronously with given serialized message args and write result of call to ret. More...
 
void call (const QString &method, const QString &service, const QByteArray &args, QtProtobuf::QGrpcAsyncReply *reply) override
 Calls method asynchronously with given serialized messge args. More...
 
void subscribe (QGrpcSubscription *subscription, const QString &service, QAbstractGrpcClient *client) override
 Subscribes to server-side stream to receive updates for given method. More...
 
std::shared_ptr< QAbstractProtobufSerializerserializer () const override
 
- Public Member Functions inherited from QtProtobuf::QAbstractGrpcChannel
const QThread * thread () const
 

Detailed Description

The QGrpcChannel class is a gRPC-cpp native api implementation of QAbstractGrpcChannel interface.

QGrpcChannel accepts the same grpc::ChannelCredentials type that is required by native-api grpc::CreateChannel. See https://grpc.github.io/grpc/cpp/classgrpc__impl_1_1_channel_credentials.html.

Constructor & Destructor Documentation

◆ QGrpcChannel()

QtProtobuf::QGrpcChannel::QGrpcChannel ( const QUrl &  name,
std::shared_ptr< grpc::ChannelCredentials >  credentials 
)

QGrpcChannel constructs QGrpcChannel.

Parameters
nameuri used to establish channel connection
credentialsgrpc credientials object

Member Function Documentation

◆ call() [1/2]

QGrpcStatus QtProtobuf::QGrpcChannel::call ( const QString &  method,
const QString &  service,
const QByteArray &  args,
QByteArray &  ret 
)
overridevirtual

Calls method synchronously with given serialized message args and write result of call to ret.

Note
This method is synchronous, that means it doesn't return until call is completed or aborted by timeout if it's implemented in inherited channel.
This method should not be called directly.
Parameters
[in]methodremote method is called
[in]serviceservice identified in URL path format
[in]argsserialized argument message
[out]retoutput bytearray to collect returned message
Returns
returns gRPC QAbstractGrpcChannel::Status code for operation

Implements QtProtobuf::QAbstractGrpcChannel.

◆ call() [2/2]

void QtProtobuf::QGrpcChannel::call ( const QString &  method,
const QString &  service,
const QByteArray &  args,
QtProtobuf::QGrpcAsyncReply ret 
)
overridevirtual

Calls method asynchronously with given serialized messge args.

Result of method call is written to QGrpcAsyncReply.

Note
This method is asynchronous, that means it returns control imediately after it is called.
This method should not be called directly.
Parameters
[in]methodremote method is called
[in]serviceservice identified in URL path format
[in]argsserialized argument message
[out]retQGrpcAsyncReply that will be returned to end-point user to read data once call complete. QGrpcAsyncReply lifecycle is managed by QAbstractGrpcClient only.
See also
QGrpcAsyncReply for details

Implements QtProtobuf::QAbstractGrpcChannel.

◆ subscribe()

void QtProtobuf::QGrpcChannel::subscribe ( QGrpcSubscription subscription,
const QString &  service,
QAbstractGrpcClient client 
)
overridevirtual

Subscribes to server-side stream to receive updates for given method.

Note
This method should not be called directly.
Parameters
[in]methodremote method is called
[in]serviceservice identified in URL path format
[in]argsserialized argument message
[in]handlercallback that will be called when message recevied from the server-stream

Implements QtProtobuf::QAbstractGrpcChannel.


The documentation for this class was generated from the following files: