GRPC C++  1.62.0
Public Member Functions
grpc::TemplatedGenericStub< RequestType, ResponseType > Class Template Referencefinal

Generic stubs provide a type-unaware interface to call gRPC methods by name. More...

#include <generic_stub.h>

Public Member Functions

 TemplatedGenericStub (std::shared_ptr< grpc::ChannelInterface > channel)
 
std::unique_ptr< ClientAsyncReaderWriter< RequestType, ResponseType > > PrepareCall (ClientContext *context, const std::string &method, grpc::CompletionQueue *cq)
 Setup a call to a named method method using context, but don't start it. More...
 
std::unique_ptr< ClientAsyncResponseReader< ResponseType > > PrepareUnaryCall (ClientContext *context, const std::string &method, const RequestType &request, grpc::CompletionQueue *cq)
 Setup a unary call to a named method method using context, and don't start it. More...
 
std::unique_ptr< ClientAsyncReaderWriter< RequestType, ResponseType > > Call (ClientContext *context, const std::string &method, grpc::CompletionQueue *cq, void *tag)
 DEPRECATED for multi-threaded use Begin a call to a named method method using context. More...
 
void UnaryCall (ClientContext *context, const std::string &method, StubOptions options, const RequestType *request, ResponseType *response, std::function< void(grpc::Status)> on_completion)
 Setup and start a unary call to a named method method using context and specifying the request and response buffers. More...
 
void PrepareUnaryCall (ClientContext *context, const std::string &method, StubOptions options, const RequestType *request, ResponseType *response, ClientUnaryReactor *reactor)
 Setup a unary call to a named method method using context and specifying the request and response buffers. More...
 
void PrepareBidiStreamingCall (ClientContext *context, const std::string &method, StubOptions options, ClientBidiReactor< RequestType, ResponseType > *reactor)
 Setup a call to a named method method using context and tied to reactor . More...
 

Detailed Description

template<class RequestType, class ResponseType>
class grpc::TemplatedGenericStub< RequestType, ResponseType >

Generic stubs provide a type-unaware interface to call gRPC methods by name.

In practice, the Request and Response types should be basic types like grpc::ByteBuffer or proto::MessageLite (the base protobuf).

Constructor & Destructor Documentation

◆ TemplatedGenericStub()

template<class RequestType , class ResponseType >
grpc::TemplatedGenericStub< RequestType, ResponseType >::TemplatedGenericStub ( std::shared_ptr< grpc::ChannelInterface channel)
inlineexplicit

Member Function Documentation

◆ Call()

template<class RequestType , class ResponseType >
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType> > grpc::TemplatedGenericStub< RequestType, ResponseType >::Call ( ClientContext context,
const std::string &  method,
grpc::CompletionQueue cq,
void *  tag 
)
inline

DEPRECATED for multi-threaded use Begin a call to a named method method using context.

A tag tag will be delivered to cq when the call has been started (i.e, initial metadata has been sent). The return value only indicates whether or not registration of the call succeeded (i.e. the call won't proceed if the return value is nullptr).

◆ PrepareBidiStreamingCall()

template<class RequestType , class ResponseType >
void grpc::TemplatedGenericStub< RequestType, ResponseType >::PrepareBidiStreamingCall ( ClientContext context,
const std::string &  method,
StubOptions  options,
ClientBidiReactor< RequestType, ResponseType > *  reactor 
)
inline

Setup a call to a named method method using context and tied to reactor .

Like any other bidi streaming RPC, it will not be activated until StartCall is invoked on its reactor.

◆ PrepareCall()

template<class RequestType , class ResponseType >
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType> > grpc::TemplatedGenericStub< RequestType, ResponseType >::PrepareCall ( ClientContext context,
const std::string &  method,
grpc::CompletionQueue cq 
)
inline

Setup a call to a named method method using context, but don't start it.

Let it be started explicitly with StartCall and a tag. The return value only indicates whether or not registration of the call succeeded (i.e. the call won't proceed if the return value is nullptr).

◆ PrepareUnaryCall() [1/2]

template<class RequestType , class ResponseType >
std::unique_ptr<ClientAsyncResponseReader<ResponseType> > grpc::TemplatedGenericStub< RequestType, ResponseType >::PrepareUnaryCall ( ClientContext context,
const std::string &  method,
const RequestType &  request,
grpc::CompletionQueue cq 
)
inline

Setup a unary call to a named method method using context, and don't start it.

Let it be started explicitly with StartCall. The return value only indicates whether or not registration of the call succeeded (i.e. the call won't proceed if the return value is nullptr).

◆ PrepareUnaryCall() [2/2]

template<class RequestType , class ResponseType >
void grpc::TemplatedGenericStub< RequestType, ResponseType >::PrepareUnaryCall ( ClientContext context,
const std::string &  method,
StubOptions  options,
const RequestType *  request,
ResponseType *  response,
ClientUnaryReactor reactor 
)
inline

Setup a unary call to a named method method using context and specifying the request and response buffers.

Like any other reactor-based RPC, it will not be activated until StartCall is invoked on its reactor.

◆ UnaryCall()

template<class RequestType , class ResponseType >
void grpc::TemplatedGenericStub< RequestType, ResponseType >::UnaryCall ( ClientContext context,
const std::string &  method,
StubOptions  options,
const RequestType *  request,
ResponseType *  response,
std::function< void(grpc::Status)>  on_completion 
)
inline

Setup and start a unary call to a named method method using context and specifying the request and response buffers.


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