Merge pull request #276 from yang-g/master
Update c++ examples to API changes.
This commit is contained in:
commit
bcd57fc78d
|
|
@ -252,8 +252,7 @@ Now we can use the channel to create our stub using the `NewStub` method provide
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
public:
|
public:
|
||||||
RouteGuideClient(std::shared_ptr<ChannelInterface> channel,
|
RouteGuideClient(std::shared_ptr<Channel> channel, const std::string& db)
|
||||||
const std::string& db)
|
|
||||||
: stub_(RouteGuide::NewStub(channel)) {
|
: stub_(RouteGuide::NewStub(channel)) {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,18 +37,15 @@
|
||||||
|
|
||||||
#include <grpc/grpc.h>
|
#include <grpc/grpc.h>
|
||||||
#include <grpc/support/log.h>
|
#include <grpc/support/log.h>
|
||||||
#include <grpc++/async_unary_call.h>
|
#include <grpc++/channel.h>
|
||||||
#include <grpc++/channel_arguments.h>
|
|
||||||
#include <grpc++/channel_interface.h>
|
|
||||||
#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++/credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include "helloworld.grpc.pb.h"
|
#include "helloworld.grpc.pb.h"
|
||||||
|
|
||||||
|
using grpc::Channel;
|
||||||
using grpc::ChannelArguments;
|
using grpc::ChannelArguments;
|
||||||
using grpc::ChannelInterface;
|
|
||||||
using grpc::ClientAsyncResponseReader;
|
using grpc::ClientAsyncResponseReader;
|
||||||
using grpc::ClientContext;
|
using grpc::ClientContext;
|
||||||
using grpc::CompletionQueue;
|
using grpc::CompletionQueue;
|
||||||
|
|
@ -59,7 +56,7 @@ using helloworld::Greeter;
|
||||||
|
|
||||||
class GreeterClient {
|
class GreeterClient {
|
||||||
public:
|
public:
|
||||||
explicit GreeterClient(std::shared_ptr<ChannelInterface> channel)
|
explicit GreeterClient(std::shared_ptr<Channel> channel)
|
||||||
: stub_(Greeter::NewStub(channel)) {}
|
: stub_(Greeter::NewStub(channel)) {}
|
||||||
|
|
||||||
std::string SayHello(const std::string& user) {
|
std::string SayHello(const std::string& user) {
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,11 @@
|
||||||
|
|
||||||
#include <grpc/grpc.h>
|
#include <grpc/grpc.h>
|
||||||
#include <grpc/support/log.h>
|
#include <grpc/support/log.h>
|
||||||
#include <grpc++/async_unary_call.h>
|
|
||||||
#include <grpc++/completion_queue.h>
|
#include <grpc++/completion_queue.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 <grpc++/server_credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include "helloworld.grpc.pb.h"
|
#include "helloworld.grpc.pb.h"
|
||||||
|
|
||||||
using grpc::Server;
|
using grpc::Server;
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,14 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <grpc/grpc.h>
|
#include <grpc/grpc.h>
|
||||||
#include <grpc++/channel_arguments.h>
|
#include <grpc++/channel.h>
|
||||||
#include <grpc++/channel_interface.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++/credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include "helloworld.grpc.pb.h"
|
#include "helloworld.grpc.pb.h"
|
||||||
|
|
||||||
|
using grpc::Channel;
|
||||||
using grpc::ChannelArguments;
|
using grpc::ChannelArguments;
|
||||||
using grpc::ChannelInterface;
|
|
||||||
using grpc::ClientContext;
|
using grpc::ClientContext;
|
||||||
using grpc::Status;
|
using grpc::Status;
|
||||||
using helloworld::HelloRequest;
|
using helloworld::HelloRequest;
|
||||||
|
|
@ -54,7 +52,7 @@ using helloworld::Greeter;
|
||||||
|
|
||||||
class GreeterClient {
|
class GreeterClient {
|
||||||
public:
|
public:
|
||||||
GreeterClient(std::shared_ptr<ChannelInterface> channel)
|
GreeterClient(std::shared_ptr<Channel> channel)
|
||||||
: stub_(Greeter::NewStub(channel)) {}
|
: stub_(Greeter::NewStub(channel)) {}
|
||||||
|
|
||||||
std::string SayHello(const std::string& user) {
|
std::string SayHello(const std::string& user) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#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++/server_credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include "helloworld.grpc.pb.h"
|
#include "helloworld.grpc.pb.h"
|
||||||
|
|
||||||
using grpc::Server;
|
using grpc::Server;
|
||||||
|
|
|
||||||
|
|
@ -39,18 +39,15 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <grpc/grpc.h>
|
#include <grpc/grpc.h>
|
||||||
#include <grpc++/channel_arguments.h>
|
#include <grpc++/channel.h>
|
||||||
#include <grpc++/channel_interface.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++/credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include <grpc++/stream.h>
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "route_guide.grpc.pb.h"
|
#include "route_guide.grpc.pb.h"
|
||||||
|
|
||||||
|
using grpc::Channel;
|
||||||
using grpc::ChannelArguments;
|
using grpc::ChannelArguments;
|
||||||
using grpc::ChannelInterface;
|
|
||||||
using grpc::ClientContext;
|
using grpc::ClientContext;
|
||||||
using grpc::ClientReader;
|
using grpc::ClientReader;
|
||||||
using grpc::ClientReaderWriter;
|
using grpc::ClientReaderWriter;
|
||||||
|
|
@ -88,8 +85,7 @@ RouteNote MakeRouteNote(const std::string& message,
|
||||||
|
|
||||||
class RouteGuideClient {
|
class RouteGuideClient {
|
||||||
public:
|
public:
|
||||||
RouteGuideClient(std::shared_ptr<ChannelInterface> channel,
|
RouteGuideClient(std::shared_ptr<Channel> channel, const std::string& db)
|
||||||
const std::string& db)
|
|
||||||
: stub_(RouteGuide::NewStub(channel)) {
|
: stub_(RouteGuide::NewStub(channel)) {
|
||||||
examples::ParseDb(db, &feature_list_);
|
examples::ParseDb(db, &feature_list_);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@
|
||||||
#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++/server_credentials.h>
|
||||||
#include <grpc++/status.h>
|
|
||||||
#include <grpc++/stream.h>
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "route_guide.grpc.pb.h"
|
#include "route_guide.grpc.pb.h"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue