From 7c968086a99e3eff9d0bb1604f7a63600e606309 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 23 Feb 2015 22:59:58 -0800 Subject: [PATCH] CreateChannel API change syncup and regenerate files --- cpp/helloworld/greeter_client.cc | 2 +- cpp/helloworld/helloworld.pb.cc | 8 ++++---- cpp/helloworld/helloworld.pb.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cpp/helloworld/greeter_client.cc b/cpp/helloworld/greeter_client.cc index 3c2bbc20747..0eb4746c65b 100644 --- a/cpp/helloworld/greeter_client.cc +++ b/cpp/helloworld/greeter_client.cc @@ -80,7 +80,7 @@ int main(int argc, char** argv) { grpc_init(); GreeterClient greeter( - grpc::CreateChannel("localhost:50051", ChannelArguments())); + grpc::CreateChannelDeprecated("localhost:50051", ChannelArguments())); std::string user("world"); std::string reply = greeter.SayHello(user); std::cout << "Greeter received: " << reply << std::endl; diff --git a/cpp/helloworld/helloworld.pb.cc b/cpp/helloworld/helloworld.pb.cc index 9540f2c94c1..3675f5f857e 100644 --- a/cpp/helloworld/helloworld.pb.cc +++ b/cpp/helloworld/helloworld.pb.cc @@ -590,8 +590,8 @@ static const char* Greeter_method_names[] = { "/helloworld.Greeter/SayHello", }; -Greeter::Stub* Greeter::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) { - Greeter::Stub* stub = new Greeter::Stub(); +std::unique_ptr< Greeter::Stub> Greeter::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) { + std::unique_ptr< Greeter::Stub> stub(new Greeter::Stub()); stub->set_channel(channel); return stub; }; @@ -600,8 +600,8 @@ Greeter::Stub* Greeter::NewStub(const std::shared_ptr< ::grpc::ChannelInterface> return ::grpc::BlockingUnaryCall(channel(),::grpc::RpcMethod(Greeter_method_names[0]), context, request, response); } -::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* Greeter::Stub::SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq, void* tag) { - return new ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>(channel(), cq, ::grpc::RpcMethod(Greeter_method_names[0]), context, request, tag); +std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>> Greeter::Stub::SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>>(new ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>(channel(), cq, ::grpc::RpcMethod(Greeter_method_names[0]), context, request, tag)); } Greeter::AsyncService::AsyncService(::grpc::CompletionQueue* cq) : ::grpc::AsynchronousService(cq, Greeter_method_names, 1) {} diff --git a/cpp/helloworld/helloworld.pb.h b/cpp/helloworld/helloworld.pb.h index 1eb870166af..67ec7a29692 100644 --- a/cpp/helloworld/helloworld.pb.h +++ b/cpp/helloworld/helloworld.pb.h @@ -320,9 +320,9 @@ class Greeter final { class Stub final : public ::grpc::InternalStub { public: ::grpc::Status SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response); - ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq, void* tag); + std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>> SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq, void* tag); }; - static Stub* NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); class Service : public ::grpc::SynchronousService { public: