From 9a72021cc6c32837869be7fab406ec620d91f595 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 31 Aug 2015 13:14:13 -0700 Subject: [PATCH 1/3] fix c++ proto --- examples/protos/route_guide.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/protos/route_guide.proto b/examples/protos/route_guide.proto index bfde5f1ead6..7a70040e1ce 100644 --- a/examples/protos/route_guide.proto +++ b/examples/protos/route_guide.proto @@ -32,7 +32,7 @@ syntax = "proto3"; option java_package = "ex.grpc"; option objc_class_prefix = "RTG"; -package examples; +package routeguide; // Interface exported by the server. service RouteGuide { From b2a30c196e587e9eca495294db0800db4d60df2d Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 31 Aug 2015 12:43:41 -0700 Subject: [PATCH 2/3] fix cpp --- examples/cpp/route_guide/helper.cc | 4 ++-- examples/cpp/route_guide/helper.h | 4 ++-- .../cpp/route_guide/route_guide_client.cc | 21 +++++++++---------- .../cpp/route_guide/route_guide_server.cc | 18 ++++++++-------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/examples/cpp/route_guide/helper.cc b/examples/cpp/route_guide/helper.cc index c2415afdf72..f76990f6fce 100644 --- a/examples/cpp/route_guide/helper.cc +++ b/examples/cpp/route_guide/helper.cc @@ -40,7 +40,7 @@ #include #include "route_guide.grpc.pb.h" -namespace examples { +namespace routeguide { std::string GetDbFileContent(int argc, char** argv) { std::string db_path; @@ -174,5 +174,5 @@ void ParseDb(const std::string& db, std::vector* feature_list) { } -} // namespace examples +} // namespace routeguide diff --git a/examples/cpp/route_guide/helper.h b/examples/cpp/route_guide/helper.h index 65c93c1d347..db36596f90c 100644 --- a/examples/cpp/route_guide/helper.h +++ b/examples/cpp/route_guide/helper.h @@ -37,14 +37,14 @@ #include #include -namespace examples { +namespace routeguide { class Feature; std::string GetDbFileContent(int argc, char** argv); void ParseDb(const std::string& db, std::vector* feature_list); -} // namespace examples +} // namespace routeguide #endif // GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_ diff --git a/examples/cpp/route_guide/route_guide_client.cc b/examples/cpp/route_guide/route_guide_client.cc index 814def27f35..10864229a24 100644 --- a/examples/cpp/route_guide/route_guide_client.cc +++ b/examples/cpp/route_guide/route_guide_client.cc @@ -53,12 +53,12 @@ using grpc::ClientReader; using grpc::ClientReaderWriter; using grpc::ClientWriter; using grpc::Status; -using examples::Point; -using examples::Feature; -using examples::Rectangle; -using examples::RouteSummary; -using examples::RouteNote; -using examples::RouteGuide; +using routeguide::Point; +using routeguide::Feature; +using routeguide::Rectangle; +using routeguide::RouteSummary; +using routeguide::RouteNote; +using routeguide::RouteGuide; Point MakePoint(long latitude, long longitude) { Point p; @@ -87,7 +87,7 @@ class RouteGuideClient { public: RouteGuideClient(std::shared_ptr channel, const std::string& db) : stub_(RouteGuide::NewStub(channel)) { - examples::ParseDb(db, &feature_list_); + routeguide::ParseDb(db, &feature_list_); } void GetFeature() { @@ -100,7 +100,7 @@ class RouteGuideClient { } void ListFeatures() { - examples::Rectangle rect; + routeguide::Rectangle rect; Feature feature; ClientContext context; @@ -233,10 +233,9 @@ class RouteGuideClient { int main(int argc, char** argv) { // Expect only arg: --db_path=path/to/route_guide_db.json. - std::string db = examples::GetDbFileContent(argc, argv); + std::string db = routeguide::GetDbFileContent(argc, argv); RouteGuideClient guide( - grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(), - ChannelArguments()), + grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials()), db); std::cout << "-------------- GetFeature --------------" << std::endl; diff --git a/examples/cpp/route_guide/route_guide_server.cc b/examples/cpp/route_guide/route_guide_server.cc index b37539299a3..aa808321a1a 100644 --- a/examples/cpp/route_guide/route_guide_server.cc +++ b/examples/cpp/route_guide/route_guide_server.cc @@ -53,12 +53,12 @@ using grpc::ServerReader; using grpc::ServerReaderWriter; using grpc::ServerWriter; using grpc::Status; -using examples::Point; -using examples::Feature; -using examples::Rectangle; -using examples::RouteSummary; -using examples::RouteNote; -using examples::RouteGuide; +using routeguide::Point; +using routeguide::Feature; +using routeguide::Rectangle; +using routeguide::RouteSummary; +using routeguide::RouteNote; +using routeguide::RouteGuide; using std::chrono::system_clock; @@ -99,7 +99,7 @@ std::string GetFeatureName(const Point& point, class RouteGuideImpl final : public RouteGuide::Service { public: explicit RouteGuideImpl(const std::string& db) { - examples::ParseDb(db, &feature_list_); + routeguide::ParseDb(db, &feature_list_); } Status GetFeature(ServerContext* context, const Point* point, @@ -110,7 +110,7 @@ class RouteGuideImpl final : public RouteGuide::Service { } Status ListFeatures(ServerContext* context, - const examples::Rectangle* rectangle, + const routeguide::Rectangle* rectangle, ServerWriter* writer) override { auto lo = rectangle->lo(); auto hi = rectangle->hi(); @@ -195,7 +195,7 @@ void RunServer(const std::string& db_path) { int main(int argc, char** argv) { // Expect only arg: --db_path=path/to/route_guide_db.json. - std::string db = examples::GetDbFileContent(argc, argv); + std::string db = routeguide::GetDbFileContent(argc, argv); RunServer(db); return 0; From e69909a7e7d6186b904b7d0eea88beb7d49fb157 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 31 Aug 2015 13:27:58 -0700 Subject: [PATCH 3/3] fix build --- examples/cpp/helloworld/greeter_async_client.cc | 4 ++-- examples/cpp/helloworld/greeter_async_server.cc | 2 +- examples/cpp/helloworld/greeter_client.cc | 5 ++--- examples/cpp/helloworld/greeter_server.cc | 2 +- examples/cpp/route_guide/route_guide_client.cc | 2 +- examples/cpp/route_guide/route_guide_server.cc | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/cpp/helloworld/greeter_async_client.cc b/examples/cpp/helloworld/greeter_async_client.cc index d99f89b1359..ace5c4a2730 100644 --- a/examples/cpp/helloworld/greeter_async_client.cc +++ b/examples/cpp/helloworld/greeter_async_client.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include "helloworld.grpc.pb.h" using grpc::Channel; @@ -89,7 +89,7 @@ class GreeterClient { int main(int argc, char** argv) { GreeterClient greeter(grpc::CreateChannel( - "localhost:50051", grpc::InsecureCredentials(), ChannelArguments())); + "localhost:50051", grpc::InsecureCredentials())); std::string user("world"); std::string reply = greeter.SayHello(user); std::cout << "Greeter received: " << reply << std::endl; diff --git a/examples/cpp/helloworld/greeter_async_server.cc b/examples/cpp/helloworld/greeter_async_server.cc index b8a0dbf0e2e..189c3afe6dc 100644 --- a/examples/cpp/helloworld/greeter_async_server.cc +++ b/examples/cpp/helloworld/greeter_async_server.cc @@ -39,10 +39,10 @@ #include #include #include +#include #include #include #include -#include #include "helloworld.grpc.pb.h" using grpc::Server; diff --git a/examples/cpp/helloworld/greeter_client.cc b/examples/cpp/helloworld/greeter_client.cc index dd0358ac95d..d29e12d4a83 100644 --- a/examples/cpp/helloworld/greeter_client.cc +++ b/examples/cpp/helloworld/greeter_client.cc @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include "helloworld.grpc.pb.h" using grpc::Channel; @@ -75,8 +75,7 @@ class GreeterClient { int main(int argc, char** argv) { GreeterClient greeter( - grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials(), - ChannelArguments())); + grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials())); std::string user("world"); std::string reply = greeter.SayHello(user); std::cout << "Greeter received: " << reply << std::endl; diff --git a/examples/cpp/helloworld/greeter_server.cc b/examples/cpp/helloworld/greeter_server.cc index c1efdf563c4..b434752d874 100644 --- a/examples/cpp/helloworld/greeter_server.cc +++ b/examples/cpp/helloworld/greeter_server.cc @@ -36,10 +36,10 @@ #include #include +#include #include #include #include -#include #include "helloworld.grpc.pb.h" using grpc::Server; diff --git a/examples/cpp/route_guide/route_guide_client.cc b/examples/cpp/route_guide/route_guide_client.cc index 10864229a24..27628da2785 100644 --- a/examples/cpp/route_guide/route_guide_client.cc +++ b/examples/cpp/route_guide/route_guide_client.cc @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include "helper.h" #include "route_guide.grpc.pb.h" diff --git a/examples/cpp/route_guide/route_guide_server.cc b/examples/cpp/route_guide/route_guide_server.cc index aa808321a1a..2be57428628 100644 --- a/examples/cpp/route_guide/route_guide_server.cc +++ b/examples/cpp/route_guide/route_guide_server.cc @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include "helper.h" #include "route_guide.grpc.pb.h"