Go to the documentation of this file.
19 #ifndef GRPCPP_GENERIC_GENERIC_STUB_H
20 #define GRPCPP_GENERIC_GENERIC_STUB_H
37 typedef ::grpc_impl::ClientAsyncReaderWriter<ByteBuffer, ByteBuffer>
39 typedef ::grpc_impl::ClientAsyncResponseReader<ByteBuffer>
45 template <
class RequestType,
class ResponseType>
49 : channel_(channel) {}
59 return CallInternal(channel_.get(), context, method, cq,
false,
nullptr);
66 std::unique_ptr<::grpc_impl::ClientAsyncResponseReader<ResponseType>>
68 const RequestType& request,
70 return std::unique_ptr<
73 ResponseType>::Create(channel_.get(), cq,
77 context, request,
false));
90 return CallInternal(channel_.get(), context, method, cq,
true, tag);
93 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
94 void UnaryCall(
ClientContext* context,
const std::string& method,
97 const RequestType* request, ResponseType* response,
99 UnaryCallInternal(context, method, request, response,
100 std::move(on_completion));
108 const RequestType* request, ResponseType* response,
110 PrepareUnaryCallInternal(context, method, request, response, reactor);
116 void PrepareBidiStreamingCall(
119 PrepareBidiStreamingCallInternal(context, method, reactor);
133 const RequestType* request, ResponseType* response,
135 stub_->UnaryCallInternal(context, method, request, response,
136 std::move(on_completion));
144 const RequestType* request, ResponseType* response,
146 stub_->PrepareUnaryCallInternal(context, method, request, response,
156 stub_->PrepareBidiStreamingCallInternal(context, method, reactor);
169 std::shared_ptr<grpc::ChannelInterface> channel_;
171 void UnaryCallInternal(
ClientContext* context,
const std::string& method,
172 const RequestType* request, ResponseType* response,
178 context, request, response, std::move(on_completion));
182 const std::string& method,
183 const RequestType* request,
184 ResponseType* response,
191 context, request, response, reactor);
194 void PrepareBidiStreamingCallInternal(
209 bool start,
void* tag) {
210 return std::unique_ptr<
217 context, start, tag));
225 #endif // GRPCPP_GENERIC_GENERIC_STUB_H
std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter< RequestType, ResponseType > > PrepareCall(ClientContext *context, const std::string &method, ::grpc_impl::CompletionQueue *cq)
Setup a call to a named method method using context, but don't start it.
Definition: generic_stub.h:57
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
TemplatedGenericStub(std::shared_ptr< grpc::ChannelInterface > channel)
Definition: generic_stub.h:48
::grpc_impl::ClientAsyncReaderWriter< ByteBuffer, ByteBuffer > GenericClientAsyncReaderWriter
Definition: generic_stub.h:38
void UnaryCall(ClientContext *context, const std::string &method, 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 re...
Definition: generic_stub.h:132
ClientBidiReactor is the interface for a bidirectional streaming RPC.
Definition: client_callback_impl.h:131
Did it work? If it didn't, why?
Definition: status.h:31
Async API for client-side unary RPCs, where the message response received from the server is of type ...
Definition: async_unary_call_impl.h:94
std::unique_ptr< ::grpc_impl::ClientAsyncReaderWriter< RequestType, ResponseType > > Call(ClientContext *context, const std::string &method, ::grpc_impl::CompletionQueue *cq, void *tag)
DEPRECATED for multi-threaded use Begin a call to a named method method using context.
Definition: generic_stub.h:88
@ BIDI_STREAMING
Definition: rpc_method.h:35
ClientUnaryReactor is a reactor-style interface for a unary RPC.
Definition: client_callback_impl.h:426
static ClientAsyncReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, bool start, void *tag)
Create a stream object.
Definition: async_stream_impl.h:495
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
@ NORMAL_RPC
Definition: rpc_method.h:32
Async client-side interface for bi-directional streaming, where the outgoing message stream going to ...
Definition: async_stream_impl.h:513
static void Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const Request *request, Response *response, ClientUnaryReactor *reactor)
Definition: client_callback_impl.h:1183
Generic stubs provide a type-unaware interface to call gRPC methods by name.
Definition: generic_stub.h:46
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue_impl.h:103
static void Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, ClientBidiReactor< Request, Response > *reactor)
Definition: client_callback_impl.h:691
NOTE: class experimental_type is not part of the public API of this class TODO(vjpai): Move these con...
Definition: generic_stub.h:126
Definition: async_unary_call_impl.h:70
TemplatedGenericStub< grpc::ByteBuffer, grpc::ByteBuffer > GenericStub
Definition: generic_stub.h:221
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: generic_stub.h:166
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
::grpc_impl::ClientAsyncResponseReader< ByteBuffer > GenericClientAsyncResponseReader
Definition: generic_stub.h:40
void CallbackUnaryCall(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const InputMessage *request, OutputMessage *result, std::function< void(::grpc::Status)> on_completion)
Perform a callback-based unary call TODO(vjpai): Combine as much as possible with the blocking unary ...
Definition: client_callback_impl.h:46
void PrepareBidiStreamingCall(ClientContext *context, const std::string &method, ::grpc_impl::ClientBidiReactor< RequestType, ResponseType > *reactor)
Setup a call to a named method method using context and tied to reactor .
Definition: generic_stub.h:153
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
::grpc_impl::ClientContext ClientContext
Definition: client_context.h:26
Descriptor of an RPC method.
Definition: rpc_method.h:29
experimental_type(TemplatedGenericStub *stub)
Definition: generic_stub.h:128
std::unique_ptr<::grpc_impl::ClientAsyncResponseReader< ResponseType > > PrepareUnaryCall(ClientContext *context, const std::string &method, const RequestType &request, ::grpc_impl::CompletionQueue *cq)
Setup a unary call to a named method method using context, and don't start it.
Definition: generic_stub.h:67
void PrepareUnaryCall(ClientContext *context, const std::string &method, const RequestType *request, ResponseType *response, ::grpc_impl::ClientUnaryReactor *reactor)
Setup a unary call to a named method method using context and specifying the request and response buf...
Definition: generic_stub.h:143