GRPC C++  1.13.0-dev
generic_stub.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_GENERIC_GENERIC_STUB_H
20 #define GRPCPP_GENERIC_GENERIC_STUB_H
21 
25 
26 namespace grpc {
27 
32 
35 class GenericStub final {
36  public:
37  explicit GenericStub(std::shared_ptr<ChannelInterface> channel)
38  : channel_(channel) {}
39 
44  std::unique_ptr<GenericClientAsyncReaderWriter> PrepareCall(
45  ClientContext* context, const grpc::string& method, CompletionQueue* cq);
46 
51  std::unique_ptr<GenericClientAsyncResponseReader> PrepareUnaryCall(
52  ClientContext* context, const grpc::string& method,
53  const ByteBuffer& request, CompletionQueue* cq);
54 
61  std::unique_ptr<GenericClientAsyncReaderWriter> Call(
62  ClientContext* context, const grpc::string& method, CompletionQueue* cq,
63  void* tag);
64 
65  private:
66  std::shared_ptr<ChannelInterface> channel_;
67 };
68 
69 } // namespace grpc
70 
71 #endif // GRPCPP_GENERIC_GENERIC_STUB_H
Async client-side interface for bi-directional streaming, where the outgoing message stream going to ...
Definition: async_stream.h:491
std::string string
Definition: config.h:35
std::unique_ptr< GenericClientAsyncResponseReader > PrepareUnaryCall(ClientContext *context, const grpc::string &method, const ByteBuffer &request, CompletionQueue *cq)
Setup a unary call to a named method method using context, and don&#39;t start it.
Async API for client-side unary RPCs, where the message response received from the server is of type ...
Definition: async_unary_call.h:98
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:162
std::unique_ptr< GenericClientAsyncReaderWriter > 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.
ClientAsyncResponseReader< ByteBuffer > GenericClientAsyncResponseReader
Definition: generic_stub.h:31
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:94
ClientAsyncReaderWriter< ByteBuffer, ByteBuffer > GenericClientAsyncReaderWriter
Definition: generic_stub.h:28
Generic stubs provide a type-unsafe interface to call gRPC methods by name.
Definition: generic_stub.h:35
GenericStub(std::shared_ptr< ChannelInterface > channel)
Definition: generic_stub.h:37
A sequence of bytes.
Definition: byte_buffer.h:53
std::unique_ptr< GenericClientAsyncReaderWriter > PrepareCall(ClientContext *context, const grpc::string &method, CompletionQueue *cq)
Setup a call to a named method method using context, but don&#39;t start it.