QGrpcClientBase Class
QGrpcClientBase 类是生成的客户端接口的基础。更多
头文件: | #include <QGrpcClientBase> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc) target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
自 | Qt 6.5 |
继承: | QObject |
公共函数
virtual | ~QGrpcClientBase() override |
bool | attachChannel(std::shared_ptr<QAbstractGrpcChannel> channel) |
(since 6.7) std::shared_ptr<QAbstractGrpcChannel> | channel() const |
信号
(since 6.7) void | channelChanged() |
详细说明
QGrpcClientBase 类为服务定义中生成的客户端接口提供了一组通用功能。 gRPC™服务定义的生成客户端接口提供了一套通用功能。
不应直接调用该类的 RPC 方法。
注意: 对非const 成员函数执行线程安全。这些函数必须在创建对象的thread 中调用。
成员函数文档
[override virtual noexcept]
QGrpcClientBase::~QGrpcClientBase()
bool QGrpcClientBase::attachChannel(std::shared_ptr<QAbstractGrpcChannel> channel)
将channel 连接到客户端,作为gRPC 操作的传输层。如果通道连接成功,则返回true
;否则,返回false
。
请求和响应信息将以通道支持的格式序列化。
注意: 警告:Qt GRPC 不保证通道级的线程安全。您必须在与QGrpcClientBase 相同的线程上调用与通道相关的函数。
注: channel 属性的设置函数。
[since 6.7]
std::shared_ptr<QAbstractGrpcChannel> QGrpcClientBase::channel() const
返回连接到此客户端的频道。
注: 属性通道的获取函数。
此函数在 Qt 6.7 中引入。
[signal, since 6.7]
void QGrpcClientBase::channelChanged()
表示有新通道连接到客户端。
注: 用于属性channel 的通知信号。
此函数在 Qt 6.7 中引入。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.