more cleanup

This commit is contained in:
Yang Gao 2015-02-23 14:26:28 -08:00
parent 178fdf82e1
commit dbc06dd84c
3 changed files with 10 additions and 10 deletions

View File

@ -65,6 +65,7 @@ std::string GetDbFileContent(int argc, char** argv) {
}
void ParseDb(const std::string& db, std::vector<Feature>* feature_list) {
feature_list->clear();
}

View File

@ -87,8 +87,11 @@ RouteNote MakeRouteNote(const std::string& message,
class RouteGuideClient {
public:
RouteGuideClient(std::shared_ptr<ChannelInterface> channel)
: stub_(RouteGuide::NewStub(channel)) {}
RouteGuideClient(std::shared_ptr<ChannelInterface> channel,
const std::string& db)
: stub_(RouteGuide::NewStub(channel)) {
examples::ParseDb(db, &feature_list_);
}
void GetFeature() {
Point point;
@ -201,10 +204,6 @@ class RouteGuideClient {
void Shutdown() { stub_.reset(); }
void FillFeatureList(const std::string& db) {
examples::ParseDb(db, &feature_list_);
}
private:
bool GetOneFeature(const Point& point, Feature* feature) {
@ -238,10 +237,10 @@ class RouteGuideClient {
int main(int argc, char** argv) {
grpc_init();
RouteGuideClient guide(
grpc::CreateChannel("localhost:50051", ChannelArguments()));
std::string db = examples::GetDbFileContent(argc, argv);
guide.FillFeatureList(db);
RouteGuideClient guide(
grpc::CreateChannel("localhost:50051", ChannelArguments()),
db);
guide.GetFeature();
guide.ListFeatures();

View File

@ -100,7 +100,7 @@ std::string GetFeatureName(const Point& point,
class RouteGuideImpl final : public RouteGuide::Service {
public:
RouteGuideImpl(const std::string& db) {
explicit RouteGuideImpl(const std::string& db) {
examples::ParseDb(db, &feature_list_);
}