Go to the documentation of this file.
19 #ifndef GRPCPP_GENERIC_GENERIC_STUB_H
20 #define GRPCPP_GENERIC_GENERIC_STUB_H
36 typedef ::grpc_impl::ClientAsyncReaderWriter<ByteBuffer, ByteBuffer>
38 typedef ::grpc_impl::ClientAsyncResponseReader<ByteBuffer>
44 template <
class RequestType,
class ResponseType>
48 : channel_(channel) {}
58 return CallInternal(channel_.get(), context, method, cq,
false,
nullptr);
65 std::unique_ptr<::grpc_impl::ClientAsyncResponseReader<ResponseType>>
68 return std::unique_ptr<
71 ResponseType>::Create(channel_.get(), cq,
75 context, request,
false));
88 return CallInternal(channel_.get(), context, method, cq,
true, tag);
91 #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
92 void UnaryCall(
ClientContext* context,
const std::string& method,
95 const RequestType* request, ResponseType* response,
97 UnaryCallInternal(context, method, request, response,
98 std::move(on_completion));
106 const RequestType* request, ResponseType* response,
108 PrepareUnaryCallInternal(context, method, request, response, reactor);
114 void PrepareBidiStreamingCall(
115 ClientContext* context,
const std::string& method,
117 PrepareBidiStreamingCallInternal(context, method, reactor);
131 const RequestType* request, ResponseType* response,
133 stub_->UnaryCallInternal(context, method, request, response,
134 std::move(on_completion));
142 const RequestType* request, ResponseType* response,
144 stub_->PrepareUnaryCallInternal(context, method, request, response,
154 stub_->PrepareBidiStreamingCallInternal(context, method, reactor);
167 std::shared_ptr<grpc::ChannelInterface> channel_;
169 void UnaryCallInternal(
ClientContext* context,
const std::string& method,
170 const RequestType* request, ResponseType* response,
176 context, request, response, std::move(on_completion));
179 void PrepareUnaryCallInternal(ClientContext* context,
180 const std::string& method,
181 const RequestType* request,
182 ResponseType* response,
189 context, request, response, reactor);
192 void PrepareBidiStreamingCallInternal(
193 ClientContext* context,
const std::string& method,
207 bool start,
void* tag) {
208 return std::unique_ptr<
215 context, start, tag));
223 #endif // GRPCPP_GENERIC_GENERIC_STUB_H
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
std::unique_ptr< ::grpc_impl::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.
Definition: generic_stub.h:86
TemplatedGenericStub(std::shared_ptr< grpc::ChannelInterface > channel)
Definition: generic_stub.h:47
::grpc_impl::ClientAsyncReaderWriter< ByteBuffer, ByteBuffer > GenericClientAsyncReaderWriter
Definition: generic_stub.h:34
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:130
void CallbackUnaryCall(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::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
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
@ BIDI_STREAMING
Definition: rpc_method.h:35
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
ClientUnaryReactor is a reactor-style interface for a unary RPC.
Definition: client_callback_impl.h:426
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
std::unique_ptr< ::grpc_impl::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.
Definition: generic_stub.h:56
@ 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:511
Generic stubs provide a type-unaware interface to call gRPC methods by name.
Definition: generic_stub.h:45
NOTE: class experimental_type is not part of the public API of this class TODO(vjpai): Move these con...
Definition: generic_stub.h:124
Definition: async_unary_call_impl.h:70
TemplatedGenericStub< grpc::ByteBuffer, grpc::ByteBuffer > GenericStub
Definition: generic_stub.h:219
experimental_type experimental()
NOTE: The function experimental() is not stable public API.
Definition: generic_stub.h:164
static void Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context, const Request *request, Response *response, ClientUnaryReactor *reactor)
Definition: client_callback_impl.h:1180
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:99
::grpc_impl::ClientAsyncResponseReader< ByteBuffer > GenericClientAsyncResponseReader
Definition: generic_stub.h:39
static ClientAsyncReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, ::grpc::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context, bool start, void *tag)
Create a stream object.
Definition: async_stream_impl.h:493
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:151
Descriptor of an RPC method.
Definition: rpc_method.h:29
experimental_type(TemplatedGenericStub *stub)
Definition: generic_stub.h:126
std::unique_ptr<::grpc_impl::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.
Definition: generic_stub.h:66
static void Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context, ClientBidiReactor< Request, Response > *reactor)
Definition: client_callback_impl.h:691
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:141