QGrpcClientBase Class

The QGrpcClientBase class serves as base for generated client interfaces. 更多...

头: #include <QGrpcClientBase>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
继承: QObject

公共函数

virtual ~QGrpcClientBase () override
bool attachChannel (std::shared_ptr<QAbstractGrpcChannel> channel )
(从 6.7 起) std::shared_ptr<QAbstractGrpcChannel> channel () const

信号

(从 6.7 起) void channelChanged ()

详细描述

The QGrpcClientBase class provides a common set of functionalities for the generated client interface of the gRPC service definition.

The RPC methods of this class should not be called directly.

注意: Thread safety is enforced for the non-const member functions. These functions must be called from the same thread in which the object was created.

成员函数文档编制

[override virtual noexcept] QGrpcClientBase:: ~QGrpcClientBase ()

销毁 QGrpcClientBase .

bool QGrpcClientBase:: attachChannel ( std::shared_ptr < QAbstractGrpcChannel > channel )

Attaches channel to the client as transport layer for gRPC operations. Returns true if the channel successfully attached; otherwise, returns false .

Request and response messages will be serialized in a format that the channel supports.

注意: 警告 : Qt GRPC doesn't guarantee thread safety on the channel level. You have to invoke the channel-related functions on the same thread as QGrpcClientBase .

注意: setter 函数对于特性 channel .

[since 6.7] std::shared_ptr < QAbstractGrpcChannel > QGrpcClientBase:: channel () const

Returns the channel attached to this client.

注意: Getter function for property channel.

该函数在 Qt 6.7 引入。

[signal, since 6.7] void QGrpcClientBase:: channelChanged ()

Indicates that a new channel is attached to the client.

注意: 通知程序信号对于特性 channel .

该函数在 Qt 6.7 引入。