QGrpcClientInterceptorManager Class
Manages QGrpcClientInterceptor interceptors. More...
Header: | #include <QGrpcClientInterceptorManager> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc) target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
Since: | Qt 6.7 |
Status: | Technical Preview |
Public Functions
QGrpcClientInterceptorManager() | |
~QGrpcClientInterceptorManager() | |
void | registerInterceptor(std::shared_ptr<QGrpcClientInterceptor> next) |
void | registerInterceptors(std::vector<std::shared_ptr<QGrpcClientInterceptor>> nextInterceptors) |
void | run(QGrpcInterceptorContinuation<T> &finalCall, typename QGrpcInterceptorContinuation<T>::ReplyType response, std::shared_ptr<QGrpcChannelOperation> operation, size_t pos = 0) |
Detailed Description
The QGrpcClientInterceptorManager class provides methods for registering and executing QGrpcClientInterceptor interceptors.
See also Qt GRPC Client Interceptors.
Member Function Documentation
QGrpcClientInterceptorManager::QGrpcClientInterceptorManager()
The default constructor, creates QGrpcClientInterceptorManager object.
[noexcept]
QGrpcClientInterceptorManager::~QGrpcClientInterceptorManager()
The default destructor, destroyes QGrpcClientInterceptorManager object.
void QGrpcClientInterceptorManager::registerInterceptor(std::shared_ptr<QGrpcClientInterceptor> next)
Registers a QGrpcClientInterceptor interceptor.
Places the next interceptor at the beginning of the interceptor chain. Interceptors are executed in reverse order of registration. For instance,
manager.registerInterceptor(myInterceptor1); manager.registerInterceptor(myInterceptor2);
will result in:
myInterceptor2 -> myInterceptor1 -> Qt GRPC operation
order of execution.
void QGrpcClientInterceptorManager::registerInterceptors(std::vector<std::shared_ptr<QGrpcClientInterceptor>> nextInterceptors)
Registers multiple QGrpcClientInterceptor interceptors.
Adds the given interceptors to the start of the interceptor chain. While execution occurs in the reverse order of registration, the original order in the nextInterceptors vector is maintained, for example:
manager.registerInterceptor(myInterceptor1); manager.registerInterceptors({myInterceptor2, myInterceptor3});
will result in:
myInterceptor2 -> myInterceptor3 -> myInterceptor1 -> Qt GRPC operation
order of execution.
template <typename T> void QGrpcClientInterceptorManager::run(QGrpcInterceptorContinuation<T> &finalCall, typename QGrpcInterceptorContinuation<T>::ReplyType response, std::shared_ptr<QGrpcChannelOperation> operation, size_t pos = 0)
Executes the Qt GRPC interceptors in the chain for a specific QGrpcOperation type.
The process initiates with the interceptor located at position pos in the QGrpcClientInterceptor chain. Both response and operation parameters are relayed to the QGrpcClientInterceptor::intercept() method. Upon reaching the end of the interceptor chain, the finalCall is invoked.