|  | @@ -22,6 +22,7 @@
 | 
	
		
			
				|  |  |  #include <functional>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #include <grpcpp/client_context.h>
 | 
	
		
			
				|  |  | +#include <grpcpp/impl/rpc_method.h>
 | 
	
		
			
				|  |  |  #include <grpcpp/support/async_stream_impl.h>
 | 
	
		
			
				|  |  |  #include <grpcpp/support/async_unary_call_impl.h>
 | 
	
		
			
				|  |  |  #include <grpcpp/support/byte_buffer.h>
 | 
	
	
		
			
				|  | @@ -50,16 +51,24 @@ class GenericStub final {
 | 
	
		
			
				|  |  |    /// 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).
 | 
	
		
			
				|  |  |    std::unique_ptr<grpc::GenericClientAsyncReaderWriter> PrepareCall(
 | 
	
		
			
				|  |  | -      grpc::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -      CompletionQueue* cq);
 | 
	
		
			
				|  |  | +      ClientContext* context, const grpc::string& method, CompletionQueue* cq) {
 | 
	
		
			
				|  |  | +    return CallInternal(channel_.get(), context, method, cq, false, nullptr);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /// Setup a unary call to a named method \a method using \a 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).
 | 
	
		
			
				|  |  |    std::unique_ptr<grpc::GenericClientAsyncResponseReader> PrepareUnaryCall(
 | 
	
		
			
				|  |  | -      grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -      const grpc::ByteBuffer& request, CompletionQueue* cq);
 | 
	
		
			
				|  |  | +      ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +      const grpc::ByteBuffer& request, CompletionQueue* cq) {
 | 
	
		
			
				|  |  | +    return std::unique_ptr<grpc::GenericClientAsyncResponseReader>(
 | 
	
		
			
				|  |  | +        internal::ClientAsyncResponseReaderFactory<grpc::ByteBuffer>::Create(
 | 
	
		
			
				|  |  | +            channel_.get(), cq,
 | 
	
		
			
				|  |  | +            grpc::internal::RpcMethod(method.c_str(),
 | 
	
		
			
				|  |  | +                                      grpc::internal::RpcMethod::NORMAL_RPC),
 | 
	
		
			
				|  |  | +            context, request, false));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    /// DEPRECATED for multi-threaded use
 | 
	
		
			
				|  |  |    /// Begin a call to a named method \a method using \a context.
 | 
	
	
		
			
				|  | @@ -68,13 +77,15 @@ class GenericStub final {
 | 
	
		
			
				|  |  |    /// 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).
 | 
	
		
			
				|  |  |    std::unique_ptr<grpc::GenericClientAsyncReaderWriter> Call(
 | 
	
		
			
				|  |  | -      grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -      CompletionQueue* cq, void* tag);
 | 
	
		
			
				|  |  | +      ClientContext* context, const grpc::string& method, CompletionQueue* cq,
 | 
	
		
			
				|  |  | +      void* tag) {
 | 
	
		
			
				|  |  | +    return CallInternal(channel_.get(), context, method, cq, true, tag);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
 | 
	
		
			
				|  |  |    /// Setup and start a unary call to a named method \a method using
 | 
	
		
			
				|  |  |    /// \a context and specifying the \a request and \a response buffers.
 | 
	
		
			
				|  |  | -  void UnaryCall(grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +  void UnaryCall(ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  |                   const grpc::ByteBuffer* request, grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  |                   std::function<void(grpc::Status)> on_completion) {
 | 
	
		
			
				|  |  |      UnaryCallInternal(context, method, request, response,
 | 
	
	
		
			
				|  | @@ -85,11 +96,10 @@ class GenericStub final {
 | 
	
		
			
				|  |  |    /// \a context and specifying the \a request and \a response buffers.
 | 
	
		
			
				|  |  |    /// Like any other reactor-based RPC, it will not be activated until
 | 
	
		
			
				|  |  |    /// StartCall is invoked on its reactor.
 | 
	
		
			
				|  |  | -  void PrepareUnaryCall(grpc_impl::ClientContext* context,
 | 
	
		
			
				|  |  | -                        const grpc::string& method,
 | 
	
		
			
				|  |  | +  void PrepareUnaryCall(ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  |                          const grpc::ByteBuffer* request,
 | 
	
		
			
				|  |  |                          grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  | -                        grpc_impl::ClientUnaryReactor* reactor) {
 | 
	
		
			
				|  |  | +                        ClientUnaryReactor* reactor) {
 | 
	
		
			
				|  |  |      PrepareUnaryCallInternal(context, method, request, response, reactor);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -97,9 +107,8 @@ class GenericStub final {
 | 
	
		
			
				|  |  |    /// \a reactor . Like any other bidi streaming RPC, it will not be activated
 | 
	
		
			
				|  |  |    /// until StartCall is invoked on its reactor.
 | 
	
		
			
				|  |  |    void PrepareBidiStreamingCall(
 | 
	
		
			
				|  |  | -      grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -      grpc_impl::ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>*
 | 
	
		
			
				|  |  | -          reactor) {
 | 
	
		
			
				|  |  | +      ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +      ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>* reactor) {
 | 
	
		
			
				|  |  |      PrepareBidiStreamingCallInternal(context, method, reactor);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  #endif
 | 
	
	
		
			
				|  | @@ -113,9 +122,8 @@ class GenericStub final {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /// Setup and start a unary call to a named method \a method using
 | 
	
		
			
				|  |  |      /// \a context and specifying the \a request and \a response buffers.
 | 
	
		
			
				|  |  | -    void UnaryCall(grpc_impl::ClientContext* context,
 | 
	
		
			
				|  |  | -                   const grpc::string& method, const grpc::ByteBuffer* request,
 | 
	
		
			
				|  |  | -                   grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  | +    void UnaryCall(ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +                   const grpc::ByteBuffer* request, grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  |                     std::function<void(grpc::Status)> on_completion) {
 | 
	
		
			
				|  |  |        stub_->UnaryCallInternal(context, method, request, response,
 | 
	
		
			
				|  |  |                                 std::move(on_completion));
 | 
	
	
		
			
				|  | @@ -125,11 +133,10 @@ class GenericStub final {
 | 
	
		
			
				|  |  |      /// \a context and specifying the \a request and \a response buffers.
 | 
	
		
			
				|  |  |      /// Like any other reactor-based RPC, it will not be activated until
 | 
	
		
			
				|  |  |      /// StartCall is invoked on its reactor.
 | 
	
		
			
				|  |  | -    void PrepareUnaryCall(grpc_impl::ClientContext* context,
 | 
	
		
			
				|  |  | -                          const grpc::string& method,
 | 
	
		
			
				|  |  | +    void PrepareUnaryCall(ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  |                            const grpc::ByteBuffer* request,
 | 
	
		
			
				|  |  |                            grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  | -                          grpc_impl::ClientUnaryReactor* reactor) {
 | 
	
		
			
				|  |  | +                          ClientUnaryReactor* reactor) {
 | 
	
		
			
				|  |  |        stub_->PrepareUnaryCallInternal(context, method, request, response,
 | 
	
		
			
				|  |  |                                        reactor);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -138,9 +145,8 @@ class GenericStub final {
 | 
	
		
			
				|  |  |      /// \a reactor . Like any other bidi streaming RPC, it will not be activated
 | 
	
		
			
				|  |  |      /// until StartCall is invoked on its reactor.
 | 
	
		
			
				|  |  |      void PrepareBidiStreamingCall(
 | 
	
		
			
				|  |  | -        grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -        grpc_impl::ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>*
 | 
	
		
			
				|  |  | -            reactor) {
 | 
	
		
			
				|  |  | +        ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +        ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>* reactor) {
 | 
	
		
			
				|  |  |        stub_->PrepareBidiStreamingCallInternal(context, method, reactor);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -156,22 +162,53 @@ class GenericStub final {
 | 
	
		
			
				|  |  |   private:
 | 
	
		
			
				|  |  |    std::shared_ptr<grpc::ChannelInterface> channel_;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  void UnaryCallInternal(grpc_impl::ClientContext* context,
 | 
	
		
			
				|  |  | -                         const grpc::string& method,
 | 
	
		
			
				|  |  | +  void UnaryCallInternal(ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  |                           const grpc::ByteBuffer* request,
 | 
	
		
			
				|  |  |                           grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  | -                         std::function<void(grpc::Status)> on_completion);
 | 
	
		
			
				|  |  | +                         std::function<void(grpc::Status)> on_completion) {
 | 
	
		
			
				|  |  | +    internal::CallbackUnaryCall(
 | 
	
		
			
				|  |  | +        channel_.get(),
 | 
	
		
			
				|  |  | +        grpc::internal::RpcMethod(method.c_str(),
 | 
	
		
			
				|  |  | +                                  grpc::internal::RpcMethod::NORMAL_RPC),
 | 
	
		
			
				|  |  | +        context, request, response, std::move(on_completion));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  void PrepareUnaryCallInternal(grpc_impl::ClientContext* context,
 | 
	
		
			
				|  |  | +  void PrepareUnaryCallInternal(ClientContext* context,
 | 
	
		
			
				|  |  |                                  const grpc::string& method,
 | 
	
		
			
				|  |  |                                  const grpc::ByteBuffer* request,
 | 
	
		
			
				|  |  |                                  grpc::ByteBuffer* response,
 | 
	
		
			
				|  |  | -                                grpc_impl::ClientUnaryReactor* reactor);
 | 
	
		
			
				|  |  | +                                ClientUnaryReactor* reactor) {
 | 
	
		
			
				|  |  | +    internal::ClientCallbackUnaryFactory::Create<grpc::ByteBuffer,
 | 
	
		
			
				|  |  | +                                                 grpc::ByteBuffer>(
 | 
	
		
			
				|  |  | +        channel_.get(),
 | 
	
		
			
				|  |  | +        grpc::internal::RpcMethod(method.c_str(),
 | 
	
		
			
				|  |  | +                                  grpc::internal::RpcMethod::NORMAL_RPC),
 | 
	
		
			
				|  |  | +        context, request, response, reactor);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    void PrepareBidiStreamingCallInternal(
 | 
	
		
			
				|  |  | -      grpc_impl::ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | -      grpc_impl::ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>*
 | 
	
		
			
				|  |  | -          reactor);
 | 
	
		
			
				|  |  | +      ClientContext* context, const grpc::string& method,
 | 
	
		
			
				|  |  | +      ClientBidiReactor<grpc::ByteBuffer, grpc::ByteBuffer>* reactor) {
 | 
	
		
			
				|  |  | +    internal::ClientCallbackReaderWriterFactory<grpc::ByteBuffer,
 | 
	
		
			
				|  |  | +                                                grpc::ByteBuffer>::
 | 
	
		
			
				|  |  | +        Create(channel_.get(),
 | 
	
		
			
				|  |  | +               grpc::internal::RpcMethod(
 | 
	
		
			
				|  |  | +                   method.c_str(), grpc::internal::RpcMethod::BIDI_STREAMING),
 | 
	
		
			
				|  |  | +               context, reactor);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  std::unique_ptr<grpc::GenericClientAsyncReaderWriter> CallInternal(
 | 
	
		
			
				|  |  | +      grpc::ChannelInterface* channel, ClientContext* context,
 | 
	
		
			
				|  |  | +      const grpc::string& method, CompletionQueue* cq, bool start, void* tag) {
 | 
	
		
			
				|  |  | +    return std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
 | 
	
		
			
				|  |  | +        internal::ClientAsyncReaderWriterFactory<grpc::ByteBuffer,
 | 
	
		
			
				|  |  | +                                                 grpc::ByteBuffer>::
 | 
	
		
			
				|  |  | +            Create(
 | 
	
		
			
				|  |  | +                channel, cq,
 | 
	
		
			
				|  |  | +                grpc::internal::RpcMethod(
 | 
	
		
			
				|  |  | +                    method.c_str(), grpc::internal::RpcMethod::BIDI_STREAMING),
 | 
	
		
			
				|  |  | +                context, start, tag));
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }  // namespace grpc_impl
 |