Merge pull request #3164 from yang-g/route_guide_cpp

Change route_guide.proto package name and fix build
pull/3174/head
Nicolas Noble 9 years ago
commit 87d09e3aa4
  1. 2
      examples/cpp/helloworld/greeter_async_client.cc
  2. 2
      examples/cpp/helloworld/greeter_async_server.cc
  3. 2
      examples/cpp/helloworld/greeter_client.cc
  4. 2
      examples/cpp/helloworld/greeter_server.cc
  5. 4
      examples/cpp/route_guide/helper.cc
  6. 4
      examples/cpp/route_guide/helper.h
  7. 20
      examples/cpp/route_guide/route_guide_client.cc
  8. 20
      examples/cpp/route_guide/route_guide_server.cc
  9. 2
      examples/protos/route_guide.proto

@ -41,7 +41,7 @@
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
#include <grpc++/completion_queue.h> #include <grpc++/completion_queue.h>
#include <grpc++/create_channel.h> #include <grpc++/create_channel.h>
#include <grpc++/credentials.h> #include <grpc++/security/credentials.h>
#include "helloworld.grpc.pb.h" #include "helloworld.grpc.pb.h"
using grpc::Channel; using grpc::Channel;

@ -39,10 +39,10 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc++/completion_queue.h> #include <grpc++/completion_queue.h>
#include <grpc++/security/server_credentials.h>
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
#include <grpc++/server_context.h> #include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
#include "helloworld.grpc.pb.h" #include "helloworld.grpc.pb.h"
using grpc::Server; using grpc::Server;

@ -39,7 +39,7 @@
#include <grpc++/channel.h> #include <grpc++/channel.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
#include <grpc++/create_channel.h> #include <grpc++/create_channel.h>
#include <grpc++/credentials.h> #include <grpc++/security/credentials.h>
#include "helloworld.grpc.pb.h" #include "helloworld.grpc.pb.h"
using grpc::Channel; using grpc::Channel;

@ -36,10 +36,10 @@
#include <string> #include <string>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc++/security/server_credentials.h>
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
#include <grpc++/server_context.h> #include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
#include "helloworld.grpc.pb.h" #include "helloworld.grpc.pb.h"
using grpc::Server; using grpc::Server;

@ -40,7 +40,7 @@
#include <vector> #include <vector>
#include "route_guide.grpc.pb.h" #include "route_guide.grpc.pb.h"
namespace examples { namespace routeguide {
std::string GetDbFileContent(int argc, char** argv) { std::string GetDbFileContent(int argc, char** argv) {
std::string db_path; std::string db_path;
@ -174,5 +174,5 @@ void ParseDb(const std::string& db, std::vector<Feature>* feature_list) {
} }
} // namespace examples } // namespace routeguide

@ -37,14 +37,14 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace examples { namespace routeguide {
class Feature; class Feature;
std::string GetDbFileContent(int argc, char** argv); std::string GetDbFileContent(int argc, char** argv);
void ParseDb(const std::string& db, std::vector<Feature>* feature_list); void ParseDb(const std::string& db, std::vector<Feature>* feature_list);
} // namespace examples } // namespace routeguide
#endif // GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_ #endif // GRPC_COMMON_CPP_ROUTE_GUIDE_HELPER_H_

@ -42,7 +42,7 @@
#include <grpc++/channel.h> #include <grpc++/channel.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
#include <grpc++/create_channel.h> #include <grpc++/create_channel.h>
#include <grpc++/credentials.h> #include <grpc++/security/credentials.h>
#include "helper.h" #include "helper.h"
#include "route_guide.grpc.pb.h" #include "route_guide.grpc.pb.h"
@ -52,12 +52,12 @@ using grpc::ClientReader;
using grpc::ClientReaderWriter; using grpc::ClientReaderWriter;
using grpc::ClientWriter; using grpc::ClientWriter;
using grpc::Status; using grpc::Status;
using examples::Point; using routeguide::Point;
using examples::Feature; using routeguide::Feature;
using examples::Rectangle; using routeguide::Rectangle;
using examples::RouteSummary; using routeguide::RouteSummary;
using examples::RouteNote; using routeguide::RouteNote;
using examples::RouteGuide; using routeguide::RouteGuide;
Point MakePoint(long latitude, long longitude) { Point MakePoint(long latitude, long longitude) {
Point p; Point p;
@ -86,7 +86,7 @@ class RouteGuideClient {
public: public:
RouteGuideClient(std::shared_ptr<Channel> channel, const std::string& db) RouteGuideClient(std::shared_ptr<Channel> channel, const std::string& db)
: stub_(RouteGuide::NewStub(channel)) { : stub_(RouteGuide::NewStub(channel)) {
examples::ParseDb(db, &feature_list_); routeguide::ParseDb(db, &feature_list_);
} }
void GetFeature() { void GetFeature() {
@ -99,7 +99,7 @@ class RouteGuideClient {
} }
void ListFeatures() { void ListFeatures() {
examples::Rectangle rect; routeguide::Rectangle rect;
Feature feature; Feature feature;
ClientContext context; ClientContext context;
@ -232,7 +232,7 @@ class RouteGuideClient {
int main(int argc, char** argv) { int main(int argc, char** argv) {
// Expect only arg: --db_path=path/to/route_guide_db.json. // 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( RouteGuideClient guide(
grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials()), grpc::CreateChannel("localhost:50051", grpc::InsecureCredentials()),
db); db);

@ -42,7 +42,7 @@
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
#include <grpc++/server_context.h> #include <grpc++/server_context.h>
#include <grpc++/server_credentials.h> #include <grpc++/security/server_credentials.h>
#include "helper.h" #include "helper.h"
#include "route_guide.grpc.pb.h" #include "route_guide.grpc.pb.h"
@ -53,12 +53,12 @@ using grpc::ServerReader;
using grpc::ServerReaderWriter; using grpc::ServerReaderWriter;
using grpc::ServerWriter; using grpc::ServerWriter;
using grpc::Status; using grpc::Status;
using examples::Point; using routeguide::Point;
using examples::Feature; using routeguide::Feature;
using examples::Rectangle; using routeguide::Rectangle;
using examples::RouteSummary; using routeguide::RouteSummary;
using examples::RouteNote; using routeguide::RouteNote;
using examples::RouteGuide; using routeguide::RouteGuide;
using std::chrono::system_clock; using std::chrono::system_clock;
@ -99,7 +99,7 @@ std::string GetFeatureName(const Point& point,
class RouteGuideImpl final : public RouteGuide::Service { class RouteGuideImpl final : public RouteGuide::Service {
public: public:
explicit RouteGuideImpl(const std::string& db) { explicit RouteGuideImpl(const std::string& db) {
examples::ParseDb(db, &feature_list_); routeguide::ParseDb(db, &feature_list_);
} }
Status GetFeature(ServerContext* context, const Point* point, Status GetFeature(ServerContext* context, const Point* point,
@ -110,7 +110,7 @@ class RouteGuideImpl final : public RouteGuide::Service {
} }
Status ListFeatures(ServerContext* context, Status ListFeatures(ServerContext* context,
const examples::Rectangle* rectangle, const routeguide::Rectangle* rectangle,
ServerWriter<Feature>* writer) override { ServerWriter<Feature>* writer) override {
auto lo = rectangle->lo(); auto lo = rectangle->lo();
auto hi = rectangle->hi(); auto hi = rectangle->hi();
@ -195,7 +195,7 @@ void RunServer(const std::string& db_path) {
int main(int argc, char** argv) { int main(int argc, char** argv) {
// Expect only arg: --db_path=path/to/route_guide_db.json. // 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); RunServer(db);
return 0; return 0;

@ -32,7 +32,7 @@ syntax = "proto3";
option java_package = "ex.grpc"; option java_package = "ex.grpc";
option objc_class_prefix = "RTG"; option objc_class_prefix = "RTG";
package examples; package routeguide;
// Interface exported by the server. // Interface exported by the server.
service RouteGuide { service RouteGuide {

Loading…
Cancel
Save