Go to the documentation of this file.
19 #ifndef GRPCPP_GENERIC_GENERIC_STUB_IMPL_H
20 #define GRPCPP_GENERIC_GENERIC_STUB_IMPL_H
34 typedef ::grpc_impl::ClientAsyncReaderWriter<ByteBuffer, ByteBuffer>
36 typedef ::grpc_impl::ClientAsyncResponseReader<ByteBuffer>
45 template <
class RequestType,
class ResponseType>
49 : channel_(channel) {}
55 std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
58 return CallInternal(channel_.get(), context, method, cq,
false,
nullptr);
68 return std::unique_ptr<ClientAsyncResponseReader<ResponseType>>(
73 context, request,
false));
82 std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
Call(
85 return CallInternal(channel_.get(), context, method, cq,
true, tag);
88 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
92 const RequestType* request, ResponseType* response,
94 UnaryCallInternal(context, method, request, response,
95 std::move(on_completion));
103 const RequestType* request, ResponseType* response,
105 PrepareUnaryCallInternal(context, method, request, response, reactor);
111 void PrepareBidiStreamingCall(
113 ClientBidiReactor<RequestType, ResponseType>* reactor) {
114 PrepareBidiStreamingCallInternal(context, method, reactor);
128 const RequestType* request, ResponseType* response,
130 stub_->UnaryCallInternal(context, method, request, response,
131 std::move(on_completion));
139 const RequestType* request, ResponseType* response,
141 stub_->PrepareUnaryCallInternal(context, method, request, response,
151 stub_->PrepareBidiStreamingCallInternal(context, method, reactor);
164 std::shared_ptr<grpc::ChannelInterface> channel_;
167 const RequestType* request, ResponseType* response,
173 context, request, response, std::move(on_completion));
178 const RequestType* request,
179 ResponseType* response,
181 internal::ClientCallbackUnaryFactory::Create<RequestType, ResponseType>(
185 context, request, response, reactor);
188 void PrepareBidiStreamingCallInternal(
190 ClientBidiReactor<RequestType, ResponseType>* reactor) {
198 std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
202 return std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>(
208 context, start, tag));
216 #endif // GRPCPP_GENERIC_GENERIC_STUB_IMPL_H
void PrepareUnaryCall(ClientContext *context, const grpc::string &method, const RequestType *request, ResponseType *response, ClientUnaryReactor *reactor)
Setup a unary call to a named method method using context and specifying the request and response buf...
Definition: generic_stub_impl.h:138
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
::grpc_impl::ClientAsyncReaderWriter< ByteBuffer, ByteBuffer > GenericClientAsyncReaderWriter
Definition: generic_stub_impl.h:35
ClientBidiReactor is the interface for a bidirectional streaming RPC.
Definition: client_callback_impl.h:108
Did it work? If it didn't, why?
Definition: status.h:31
std::unique_ptr< ClientAsyncResponseReader< ResponseType > > PrepareUnaryCall(ClientContext *context, const grpc::string &method, const RequestType &request, CompletionQueue *cq)
Setup a unary call to a named method method using context, and don't start it.
Definition: generic_stub_impl.h:65
Definition: rpc_method.h:35
std::unique_ptr< ClientAsyncReaderWriter< RequestType, ResponseType > > Call(ClientContext *context, const grpc::string &method, CompletionQueue *cq, void *tag)
DEPRECATED for multi-threaded use Begin a call to a named method method using context.
Definition: generic_stub_impl.h:82
experimental_type(TemplatedGenericStub *stub)
Definition: generic_stub_impl.h:123
ClientUnaryReactor is a reactor-style interface for a unary RPC.
Definition: client_callback_impl.h:402
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: generic_stub_impl.h:161
::grpc_impl::ClientUnaryReactor ClientUnaryReactor
Definition: client_callback.h:71
Generic stubs provide a type-unaware interface to call gRPC methods by name.
Definition: generic_stub_impl.h:46
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
TemplatedGenericStub(std::shared_ptr< grpc::ChannelInterface > channel)
Definition: generic_stub_impl.h:48
Definition: rpc_method.h:32
static ClientAsyncResponseReader< R > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const W &request, bool start)
Start a call and write the request out if start is set.
Definition: async_unary_call_impl.h:79
void PrepareBidiStreamingCall(ClientContext *context, const grpc::string &method, ClientBidiReactor< RequestType, ResponseType > *reactor)
Setup a call to a named method method using context and tied to reactor .
Definition: generic_stub_impl.h:148
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:627
void UnaryCall(ClientContext *context, const grpc::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_impl.h:127
std::string string
Definition: config.h:35
TemplatedGenericStub< grpc::ByteBuffer, grpc::ByteBuffer > GenericStub
Definition: generic_stub_impl.h:212
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_impl.h:37
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
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
NOTE: class experimental_type is not part of the public API of this class TODO(vjpai): Move these con...
Definition: generic_stub_impl.h:121
::grpc_impl::ClientContext ClientContext
Definition: client_context.h:26
Descriptor of an RPC method.
Definition: rpc_method.h:29
std::unique_ptr< ClientAsyncReaderWriter< RequestType, ResponseType > > PrepareCall(ClientContext *context, const grpc::string &method, CompletionQueue *cq)
Setup a call to a named method method using context, but don't start it.
Definition: generic_stub_impl.h:56