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

特性

  • (從 6.7 起) channel : std::shared_ptr<QAbstractGrpcChannel>

公共函數

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.

特性文檔編製

[since 6.7] channel : std::shared_ptr < QAbstractGrpcChannel >

This property holds the channel attached to this client. The channel is used as the transport layer for gRPC operations.

該特性在 Qt 6.7 引入。

訪問函數:

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

通知程序信號:

void channelChanged ()

另請參閱 attachChannel ().

成員函數文檔編製

[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 got attached to the client.

注意: 通知程序信號對於特性 channel .

該函數在 Qt 6.7 引入。