mirror of https://github.com/grpc/grpc.git
parent
9bd5b3778a
commit
63e73e428f
14 changed files with 1666 additions and 0 deletions
@ -0,0 +1,96 @@ |
||||
#
|
||||
# Copyright 2018 gRPC authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
|
||||
SYSTEM ?= $(HOST_SYSTEM)
|
||||
CXX = g++
|
||||
CPPFLAGS += `pkg-config --cflags protobuf grpc`
|
||||
CXXFLAGS += -std=c++11
|
||||
ifeq ($(SYSTEM),Darwin) |
||||
LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
|
||||
-lgrpc++_reflection\
|
||||
-ldl
|
||||
else |
||||
LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
|
||||
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\
|
||||
-ldl
|
||||
endif |
||||
PROTOC = protoc
|
||||
GRPC_CPP_PLUGIN = grpc_cpp_plugin
|
||||
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
|
||||
PROTOS_PATH = ../../protos
|
||||
vpath %.proto $(PROTOS_PATH)
|
||||
all: system-check greeter_client greeter_server
|
||||
greeter_client: helloworld.pb.o helloworld.grpc.pb.o greeter_client.o
|
||||
$(CXX) $^ $(LDFLAGS) -o $@
|
||||
greeter_server: helloworld.pb.o helloworld.grpc.pb.o greeter_server.o
|
||||
$(CXX) $^ $(LDFLAGS) -o $@
|
||||
.PRECIOUS: %.grpc.pb.cc
|
||||
%.grpc.pb.cc: %.proto |
||||
$(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
|
||||
.PRECIOUS: %.pb.cc
|
||||
%.pb.cc: %.proto |
||||
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
|
||||
clean:
|
||||
rm -f *.o *.pb.cc *.pb.h greeter_client greeter_server
|
||||
# The following is to test your system and ensure a smoother experience.
|
||||
# They are by no means necessary to actually compile a grpc-enabled software.
|
||||
PROTOC_CMD = which $(PROTOC)
|
||||
PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q libprotoc.3
|
||||
PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
|
||||
HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
|
||||
ifeq ($(HAS_PROTOC),true) |
||||
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
|
||||
endif |
||||
HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
|
||||
SYSTEM_OK = false
|
||||
ifeq ($(HAS_VALID_PROTOC),true) |
||||
ifeq ($(HAS_PLUGIN),true) |
||||
SYSTEM_OK = true
|
||||
endif |
||||
endif |
||||
system-check:
|
||||
ifneq ($(HAS_VALID_PROTOC),true) |
||||
@echo " DEPENDENCY ERROR"
|
||||
@echo
|
||||
@echo "You don't have protoc 3.0.0 installed in your path."
|
||||
@echo "Please install Google protocol buffers 3.0.0 and its compiler."
|
||||
@echo "You can find it here:"
|
||||
@echo
|
||||
@echo " https://github.com/google/protobuf/releases/tag/v3.0.0"
|
||||
@echo
|
||||
@echo "Here is what I get when trying to evaluate your version of protoc:"
|
||||
@echo
|
||||
-$(PROTOC) --version
|
||||
@echo
|
||||
@echo
|
||||
endif |
||||
ifneq ($(HAS_PLUGIN),true) |
||||
@echo " DEPENDENCY ERROR"
|
||||
@echo
|
||||
@echo "You don't have the grpc c++ protobuf plugin installed in your path."
|
||||
@echo "Please install grpc. You can find it here:"
|
||||
@echo
|
||||
@echo " https://github.com/grpc/grpc"
|
||||
@echo
|
||||
@echo "Here is what I get when trying to detect if you have the plugin:"
|
||||
@echo
|
||||
-which $(GRPC_CPP_PLUGIN)
|
||||
@echo
|
||||
@echo
|
||||
endif |
||||
ifneq ($(SYSTEM_OK),true) |
||||
@false
|
||||
endif |
Binary file not shown.
@ -0,0 +1,95 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#include <iostream> |
||||
#include <memory> |
||||
#include <string> |
||||
|
||||
#include <grpcpp/grpcpp.h> |
||||
|
||||
#ifdef BAZEL_BUILD |
||||
#include "examples/protos/helloworld.grpc.pb.h" |
||||
#else |
||||
#include "helloworld.grpc.pb.h" |
||||
#endif |
||||
|
||||
using grpc::Channel; |
||||
using grpc::ClientContext; |
||||
using grpc::Status; |
||||
using helloworld::HelloRequest; |
||||
using helloworld::HelloReply; |
||||
using helloworld::Greeter; |
||||
|
||||
class CustomHeaderClient { |
||||
public: |
||||
CustomHeaderClient(std::shared_ptr<Channel> channel) |
||||
: stub_(Greeter::NewStub(channel)) {} |
||||
|
||||
// Assembles the client's payload, sends it and presents the response back
|
||||
// from the server.
|
||||
std::string SayHello(const std::string& user) { |
||||
// Data we are sending to the server.
|
||||
HelloRequest request; |
||||
request.set_name(user); |
||||
|
||||
// Container for the data we expect from the server.
|
||||
HelloReply reply; |
||||
|
||||
// Context for the client. It could be used to convey extra information to
|
||||
// the server and/or tweak certain RPC behaviors.
|
||||
ClientContext context; |
||||
|
||||
// Setting custom metadata to be sent to the server
|
||||
context.AddMetadata("custom-header", "Custom Value"); |
||||
|
||||
// Setting custom binary metadata
|
||||
char bytes[8] = {'\0', '\1', '\2', '\3', |
||||
'\4', '\5', '\6', '\7'}; |
||||
context.AddMetadata("custom-bin", grpc::string(bytes, 8)); |
||||
|
||||
// The actual RPC.
|
||||
Status status = stub_->SayHello(&context, request, &reply); |
||||
|
||||
// Act upon its status.
|
||||
if (status.ok()) { |
||||
std::cout << "Client received initial metadata from server: " << context.GetServerInitialMetadata().find("custom-server-metadata")->second << std::endl; |
||||
std::cout << "Client received trailing metadata from server: " << context.GetServerTrailingMetadata().find("custom-trailing-metadata")->second << std::endl; |
||||
return reply.message(); |
||||
} else { |
||||
std::cout << status.error_code() << ": " << status.error_message() |
||||
<< std::endl; |
||||
return "RPC failed"; |
||||
} |
||||
} |
||||
|
||||
private: |
||||
std::unique_ptr<Greeter::Stub> stub_; |
||||
}; |
||||
|
||||
int main(int argc, char** argv) { |
||||
// Instantiate the client. It requires a channel, out of which the actual RPCs
|
||||
// are created. This channel models a connection to an endpoint (in this case,
|
||||
// localhost at port 50051). We indicate that the channel isn't authenticated
|
||||
// (use of InsecureChannelCredentials()).
|
||||
CustomHeaderClient greeter(grpc::CreateChannel( |
||||
"localhost:50051", grpc::InsecureChannelCredentials())); |
||||
std::string user("world"); |
||||
std::string reply = greeter.SayHello(user); |
||||
std::cout << "Client received message: " << reply << std::endl; |
||||
return 0; |
||||
} |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,82 @@ |
||||
/*
|
||||
* |
||||
* Copyright 2015 gRPC authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
* |
||||
*/ |
||||
|
||||
#include <iostream> |
||||
#include <memory> |
||||
#include <string> |
||||
|
||||
#include <grpcpp/grpcpp.h> |
||||
|
||||
#ifdef BAZEL_BUILD |
||||
#include "examples/protos/helloworld.grpc.pb.h" |
||||
#else |
||||
#include "helloworld.grpc.pb.h" |
||||
#endif |
||||
|
||||
using grpc::Server; |
||||
using grpc::ServerBuilder; |
||||
using grpc::ServerContext; |
||||
using grpc::Status; |
||||
using helloworld::HelloRequest; |
||||
using helloworld::HelloReply; |
||||
using helloworld::Greeter; |
||||
|
||||
// Logic and data behind the server's behavior.
|
||||
class GreeterServiceImpl final : public Greeter::Service { |
||||
Status SayHello(ServerContext* context, const HelloRequest* request, |
||||
HelloReply* reply) override { |
||||
std::string prefix("Hello "); |
||||
|
||||
// Get the client's initial metadata
|
||||
std::cout << "Client metadata: " << std::endl; |
||||
const std::multimap<grpc::string_ref, grpc::string_ref> metadata = context->client_metadata(); |
||||
for (auto iter = metadata.begin(); iter != metadata.end(); ++iter) { |
||||
std::cout << "Header key: " << iter->first << " , value: " << iter->second << std::endl; |
||||
} |
||||
|
||||
context->AddInitialMetadata("custom-server-metadata", "initial metadata value"); |
||||
context->AddTrailingMetadata("custom-trailing-metadata", "trailing metadata value"); |
||||
reply->set_message(prefix + request->name()); |
||||
return Status::OK; |
||||
} |
||||
}; |
||||
|
||||
void RunServer() { |
||||
std::string server_address("0.0.0.0:50051"); |
||||
GreeterServiceImpl service; |
||||
|
||||
ServerBuilder builder; |
||||
// Listen on the given address without any authentication mechanism.
|
||||
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); |
||||
// Register "service" as the instance through which we'll communicate with
|
||||
// clients. In this case it corresponds to an *synchronous* service.
|
||||
builder.RegisterService(&service); |
||||
// Finally assemble the server.
|
||||
std::unique_ptr<Server> server(builder.BuildAndStart()); |
||||
std::cout << "Server listening on " << server_address << std::endl; |
||||
|
||||
// Wait for the server to shutdown. Note that some other thread must be
|
||||
// responsible for shutting down the server for this call to ever return.
|
||||
server->Wait(); |
||||
} |
||||
|
||||
int main(int argc, char** argv) { |
||||
RunServer(); |
||||
|
||||
return 0; |
||||
} |
Binary file not shown.
@ -0,0 +1,70 @@ |
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: helloworld.proto
|
||||
|
||||
#include "helloworld.pb.h" |
||||
#include "helloworld.grpc.pb.h" |
||||
|
||||
#include <functional> |
||||
#include <grpcpp/impl/codegen/async_stream.h> |
||||
#include <grpcpp/impl/codegen/async_unary_call.h> |
||||
#include <grpcpp/impl/codegen/channel_interface.h> |
||||
#include <grpcpp/impl/codegen/client_unary_call.h> |
||||
#include <grpcpp/impl/codegen/client_callback.h> |
||||
#include <grpcpp/impl/codegen/method_handler_impl.h> |
||||
#include <grpcpp/impl/codegen/rpc_service_method.h> |
||||
#include <grpcpp/impl/codegen/service_type.h> |
||||
#include <grpcpp/impl/codegen/sync_stream.h> |
||||
namespace helloworld { |
||||
|
||||
static const char* Greeter_method_names[] = { |
||||
"/helloworld.Greeter/SayHello", |
||||
}; |
||||
|
||||
std::unique_ptr< Greeter::Stub> Greeter::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { |
||||
(void)options; |
||||
std::unique_ptr< Greeter::Stub> stub(new Greeter::Stub(channel)); |
||||
return stub; |
||||
} |
||||
|
||||
Greeter::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) |
||||
: channel_(channel), rpcmethod_SayHello_(Greeter_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) |
||||
{} |
||||
|
||||
::grpc::Status Greeter::Stub::SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) { |
||||
return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_SayHello_, context, request, response); |
||||
} |
||||
|
||||
void Greeter::Stub::experimental_async::SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response, std::function<void(::grpc::Status)> f) { |
||||
return ::grpc::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_SayHello_, context, request, response, std::move(f)); |
||||
} |
||||
|
||||
::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* Greeter::Stub::AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return ::grpc::internal::ClientAsyncResponseReaderFactory< ::helloworld::HelloReply>::Create(channel_.get(), cq, rpcmethod_SayHello_, context, request, true); |
||||
} |
||||
|
||||
::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* Greeter::Stub::PrepareAsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return ::grpc::internal::ClientAsyncResponseReaderFactory< ::helloworld::HelloReply>::Create(channel_.get(), cq, rpcmethod_SayHello_, context, request, false); |
||||
} |
||||
|
||||
Greeter::Service::Service() { |
||||
AddMethod(new ::grpc::internal::RpcServiceMethod( |
||||
Greeter_method_names[0], |
||||
::grpc::internal::RpcMethod::NORMAL_RPC, |
||||
new ::grpc::internal::RpcMethodHandler< Greeter::Service, ::helloworld::HelloRequest, ::helloworld::HelloReply>( |
||||
std::mem_fn(&Greeter::Service::SayHello), this))); |
||||
} |
||||
|
||||
Greeter::Service::~Service() { |
||||
} |
||||
|
||||
::grpc::Status Greeter::Service::SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) { |
||||
(void) context; |
||||
(void) request; |
||||
(void) response; |
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||
} |
||||
|
||||
|
||||
} // namespace helloworld
|
||||
|
@ -0,0 +1,197 @@ |
||||
// Generated by the gRPC C++ plugin.
|
||||
// If you make any local change, they will be lost.
|
||||
// source: helloworld.proto
|
||||
// Original file comments:
|
||||
// Copyright 2015 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef GRPC_helloworld_2eproto__INCLUDED |
||||
#define GRPC_helloworld_2eproto__INCLUDED |
||||
|
||||
#include "helloworld.pb.h" |
||||
|
||||
#include <functional> |
||||
#include <grpcpp/impl/codegen/async_generic_service.h> |
||||
#include <grpcpp/impl/codegen/async_stream.h> |
||||
#include <grpcpp/impl/codegen/async_unary_call.h> |
||||
#include <grpcpp/impl/codegen/method_handler_impl.h> |
||||
#include <grpcpp/impl/codegen/proto_utils.h> |
||||
#include <grpcpp/impl/codegen/rpc_method.h> |
||||
#include <grpcpp/impl/codegen/service_type.h> |
||||
#include <grpcpp/impl/codegen/status.h> |
||||
#include <grpcpp/impl/codegen/stub_options.h> |
||||
#include <grpcpp/impl/codegen/sync_stream.h> |
||||
|
||||
namespace grpc { |
||||
class CompletionQueue; |
||||
class Channel; |
||||
class ServerCompletionQueue; |
||||
class ServerContext; |
||||
} // namespace grpc
|
||||
|
||||
namespace helloworld { |
||||
|
||||
// The greeting service definition.
|
||||
class Greeter final { |
||||
public: |
||||
static constexpr char const* service_full_name() { |
||||
return "helloworld.Greeter"; |
||||
} |
||||
class StubInterface { |
||||
public: |
||||
virtual ~StubInterface() {} |
||||
// Sends a greeting
|
||||
virtual ::grpc::Status SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) = 0; |
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>> AsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>>(AsyncSayHelloRaw(context, request, cq)); |
||||
} |
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>> PrepareAsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>>(PrepareAsyncSayHelloRaw(context, request, cq)); |
||||
} |
||||
class experimental_async_interface { |
||||
public: |
||||
virtual ~experimental_async_interface() {} |
||||
// Sends a greeting
|
||||
virtual void SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response, std::function<void(::grpc::Status)>) = 0; |
||||
}; |
||||
virtual class experimental_async_interface* experimental_async() { return nullptr; } |
||||
private: |
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>* AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0; |
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>* PrepareAsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0; |
||||
}; |
||||
class Stub final : public StubInterface { |
||||
public: |
||||
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); |
||||
::grpc::Status SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) override; |
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>> AsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>>(AsyncSayHelloRaw(context, request, cq)); |
||||
} |
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>> PrepareAsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) { |
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>>(PrepareAsyncSayHelloRaw(context, request, cq)); |
||||
} |
||||
class experimental_async final : |
||||
public StubInterface::experimental_async_interface { |
||||
public: |
||||
void SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response, std::function<void(::grpc::Status)>) override; |
||||
private: |
||||
friend class Stub; |
||||
explicit experimental_async(Stub* stub): stub_(stub) { } |
||||
Stub* stub() { return stub_; } |
||||
Stub* stub_; |
||||
}; |
||||
class experimental_async_interface* experimental_async() override { return &async_stub_; } |
||||
|
||||
private: |
||||
std::shared_ptr< ::grpc::ChannelInterface> channel_; |
||||
class experimental_async async_stub_{this}; |
||||
::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) override; |
||||
::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* PrepareAsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) override; |
||||
const ::grpc::internal::RpcMethod rpcmethod_SayHello_; |
||||
}; |
||||
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); |
||||
|
||||
class Service : public ::grpc::Service { |
||||
public: |
||||
Service(); |
||||
virtual ~Service(); |
||||
// Sends a greeting
|
||||
virtual ::grpc::Status SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response); |
||||
}; |
||||
template <class BaseClass> |
||||
class WithAsyncMethod_SayHello : public BaseClass { |
||||
private: |
||||
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||
public: |
||||
WithAsyncMethod_SayHello() { |
||||
::grpc::Service::MarkMethodAsync(0); |
||||
} |
||||
~WithAsyncMethod_SayHello() override { |
||||
BaseClassMustBeDerivedFromService(this); |
||||
} |
||||
// disable synchronous version of this method
|
||||
::grpc::Status SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) override { |
||||
abort(); |
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||
} |
||||
void RequestSayHello(::grpc::ServerContext* context, ::helloworld::HelloRequest* request, ::grpc::ServerAsyncResponseWriter< ::helloworld::HelloReply>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { |
||||
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); |
||||
} |
||||
}; |
||||
typedef WithAsyncMethod_SayHello<Service > AsyncService; |
||||
template <class BaseClass> |
||||
class WithGenericMethod_SayHello : public BaseClass { |
||||
private: |
||||
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||
public: |
||||
WithGenericMethod_SayHello() { |
||||
::grpc::Service::MarkMethodGeneric(0); |
||||
} |
||||
~WithGenericMethod_SayHello() override { |
||||
BaseClassMustBeDerivedFromService(this); |
||||
} |
||||
// disable synchronous version of this method
|
||||
::grpc::Status SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) override { |
||||
abort(); |
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||
} |
||||
}; |
||||
template <class BaseClass> |
||||
class WithRawMethod_SayHello : public BaseClass { |
||||
private: |
||||
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||
public: |
||||
WithRawMethod_SayHello() { |
||||
::grpc::Service::MarkMethodRaw(0); |
||||
} |
||||
~WithRawMethod_SayHello() override { |
||||
BaseClassMustBeDerivedFromService(this); |
||||
} |
||||
// disable synchronous version of this method
|
||||
::grpc::Status SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) override { |
||||
abort(); |
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||
} |
||||
void RequestSayHello(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { |
||||
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); |
||||
} |
||||
}; |
||||
template <class BaseClass> |
||||
class WithStreamedUnaryMethod_SayHello : public BaseClass { |
||||
private: |
||||
void BaseClassMustBeDerivedFromService(const Service *service) {} |
||||
public: |
||||
WithStreamedUnaryMethod_SayHello() { |
||||
::grpc::Service::MarkMethodStreamed(0, |
||||
new ::grpc::internal::StreamedUnaryHandler< ::helloworld::HelloRequest, ::helloworld::HelloReply>(std::bind(&WithStreamedUnaryMethod_SayHello<BaseClass>::StreamedSayHello, this, std::placeholders::_1, std::placeholders::_2))); |
||||
} |
||||
~WithStreamedUnaryMethod_SayHello() override { |
||||
BaseClassMustBeDerivedFromService(this); |
||||
} |
||||
// disable regular version of this method
|
||||
::grpc::Status SayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) override { |
||||
abort(); |
||||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); |
||||
} |
||||
// replace default version of method with streamed unary
|
||||
virtual ::grpc::Status StreamedSayHello(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::helloworld::HelloRequest,::helloworld::HelloReply>* server_unary_streamer) = 0; |
||||
}; |
||||
typedef WithStreamedUnaryMethod_SayHello<Service > StreamedUnaryService; |
||||
typedef Service SplitStreamedService; |
||||
typedef WithStreamedUnaryMethod_SayHello<Service > StreamedService; |
||||
}; |
||||
|
||||
} // namespace helloworld
|
||||
|
||||
|
||||
#endif // GRPC_helloworld_2eproto__INCLUDED
|
Binary file not shown.
@ -0,0 +1,638 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
#include "helloworld.pb.h" |
||||
|
||||
#include <algorithm> |
||||
|
||||
#include <google/protobuf/stubs/common.h> |
||||
#include <google/protobuf/stubs/port.h> |
||||
#include <google/protobuf/io/coded_stream.h> |
||||
#include <google/protobuf/wire_format_lite_inl.h> |
||||
#include <google/protobuf/descriptor.h> |
||||
#include <google/protobuf/generated_message_reflection.h> |
||||
#include <google/protobuf/reflection_ops.h> |
||||
#include <google/protobuf/wire_format.h> |
||||
// This is a temporary google only hack
|
||||
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS |
||||
#include "third_party/protobuf/version.h" |
||||
#endif |
||||
// @@protoc_insertion_point(includes)
|
||||
|
||||
namespace helloworld { |
||||
class HelloRequestDefaultTypeInternal { |
||||
public: |
||||
::google::protobuf::internal::ExplicitlyConstructed<HelloRequest> |
||||
_instance; |
||||
} _HelloRequest_default_instance_; |
||||
class HelloReplyDefaultTypeInternal { |
||||
public: |
||||
::google::protobuf::internal::ExplicitlyConstructed<HelloReply> |
||||
_instance; |
||||
} _HelloReply_default_instance_; |
||||
} // namespace helloworld
|
||||
namespace protobuf_helloworld_2eproto { |
||||
static void InitDefaultsHelloRequest() { |
||||
GOOGLE_PROTOBUF_VERIFY_VERSION; |
||||
|
||||
{ |
||||
void* ptr = &::helloworld::_HelloRequest_default_instance_; |
||||
new (ptr) ::helloworld::HelloRequest(); |
||||
::google::protobuf::internal::OnShutdownDestroyMessage(ptr); |
||||
} |
||||
::helloworld::HelloRequest::InitAsDefaultInstance(); |
||||
} |
||||
|
||||
::google::protobuf::internal::SCCInfo<0> scc_info_HelloRequest = |
||||
{{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsHelloRequest}, {}}; |
||||
|
||||
static void InitDefaultsHelloReply() { |
||||
GOOGLE_PROTOBUF_VERIFY_VERSION; |
||||
|
||||
{ |
||||
void* ptr = &::helloworld::_HelloReply_default_instance_; |
||||
new (ptr) ::helloworld::HelloReply(); |
||||
::google::protobuf::internal::OnShutdownDestroyMessage(ptr); |
||||
} |
||||
::helloworld::HelloReply::InitAsDefaultInstance(); |
||||
} |
||||
|
||||
::google::protobuf::internal::SCCInfo<0> scc_info_HelloReply = |
||||
{{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsHelloReply}, {}}; |
||||
|
||||
void InitDefaults() { |
||||
::google::protobuf::internal::InitSCC(&scc_info_HelloRequest.base); |
||||
::google::protobuf::internal::InitSCC(&scc_info_HelloReply.base); |
||||
} |
||||
|
||||
::google::protobuf::Metadata file_level_metadata[2]; |
||||
|
||||
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { |
||||
~0u, // no _has_bits_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::helloworld::HelloRequest, _internal_metadata_), |
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::helloworld::HelloRequest, name_), |
||||
~0u, // no _has_bits_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::helloworld::HelloReply, _internal_metadata_), |
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::helloworld::HelloReply, message_), |
||||
}; |
||||
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { |
||||
{ 0, -1, sizeof(::helloworld::HelloRequest)}, |
||||
{ 6, -1, sizeof(::helloworld::HelloReply)}, |
||||
}; |
||||
|
||||
static ::google::protobuf::Message const * const file_default_instances[] = { |
||||
reinterpret_cast<const ::google::protobuf::Message*>(&::helloworld::_HelloRequest_default_instance_), |
||||
reinterpret_cast<const ::google::protobuf::Message*>(&::helloworld::_HelloReply_default_instance_), |
||||
}; |
||||
|
||||
void protobuf_AssignDescriptors() { |
||||
AddDescriptors(); |
||||
AssignDescriptors( |
||||
"helloworld.proto", schemas, file_default_instances, TableStruct::offsets, |
||||
file_level_metadata, NULL, NULL); |
||||
} |
||||
|
||||
void protobuf_AssignDescriptorsOnce() { |
||||
static ::google::protobuf::internal::once_flag once; |
||||
::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); |
||||
} |
||||
|
||||
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; |
||||
void protobuf_RegisterTypes(const ::std::string&) { |
||||
protobuf_AssignDescriptorsOnce(); |
||||
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2); |
||||
} |
||||
|
||||
void AddDescriptorsImpl() { |
||||
InitDefaults(); |
||||
static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { |
||||
"\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" |
||||
"equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" |
||||
"ssage\030\001 \001(\t2I\n\007Greeter\022>\n\010SayHello\022\030.hel" |
||||
"loworld.HelloRequest\032\026.helloworld.HelloR" |
||||
"eply\"\000B6\n\033io.grpc.examples.helloworldB\017H" |
||||
"elloWorldProtoP\001\242\002\003HLWb\006proto3" |
||||
}; |
||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile( |
||||
descriptor, 230); |
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( |
||||
"helloworld.proto", &protobuf_RegisterTypes); |
||||
} |
||||
|
||||
void AddDescriptors() { |
||||
static ::google::protobuf::internal::once_flag once; |
||||
::google::protobuf::internal::call_once(once, AddDescriptorsImpl); |
||||
} |
||||
// Force AddDescriptors() to be called at dynamic initialization time.
|
||||
struct StaticDescriptorInitializer { |
||||
StaticDescriptorInitializer() { |
||||
AddDescriptors(); |
||||
} |
||||
} static_descriptor_initializer; |
||||
} // namespace protobuf_helloworld_2eproto
|
||||
namespace helloworld { |
||||
|
||||
// ===================================================================
|
||||
|
||||
void HelloRequest::InitAsDefaultInstance() { |
||||
} |
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1900 |
||||
const int HelloRequest::kNameFieldNumber; |
||||
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
|
||||
|
||||
HelloRequest::HelloRequest() |
||||
: ::google::protobuf::Message(), _internal_metadata_(NULL) { |
||||
::google::protobuf::internal::InitSCC( |
||||
&protobuf_helloworld_2eproto::scc_info_HelloRequest.base); |
||||
SharedCtor(); |
||||
// @@protoc_insertion_point(constructor:helloworld.HelloRequest)
|
||||
} |
||||
HelloRequest::HelloRequest(const HelloRequest& from) |
||||
: ::google::protobuf::Message(), |
||||
_internal_metadata_(NULL) { |
||||
_internal_metadata_.MergeFrom(from._internal_metadata_); |
||||
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
if (from.name().size() > 0) { |
||||
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); |
||||
} |
||||
// @@protoc_insertion_point(copy_constructor:helloworld.HelloRequest)
|
||||
} |
||||
|
||||
void HelloRequest::SharedCtor() { |
||||
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
|
||||
HelloRequest::~HelloRequest() { |
||||
// @@protoc_insertion_point(destructor:helloworld.HelloRequest)
|
||||
SharedDtor(); |
||||
} |
||||
|
||||
void HelloRequest::SharedDtor() { |
||||
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
|
||||
void HelloRequest::SetCachedSize(int size) const { |
||||
_cached_size_.Set(size); |
||||
} |
||||
const ::google::protobuf::Descriptor* HelloRequest::descriptor() { |
||||
::protobuf_helloworld_2eproto::protobuf_AssignDescriptorsOnce(); |
||||
return ::protobuf_helloworld_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; |
||||
} |
||||
|
||||
const HelloRequest& HelloRequest::default_instance() { |
||||
::google::protobuf::internal::InitSCC(&protobuf_helloworld_2eproto::scc_info_HelloRequest.base); |
||||
return *internal_default_instance(); |
||||
} |
||||
|
||||
|
||||
void HelloRequest::Clear() { |
||||
// @@protoc_insertion_point(message_clear_start:helloworld.HelloRequest)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits; |
||||
|
||||
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
_internal_metadata_.Clear(); |
||||
} |
||||
|
||||
bool HelloRequest::MergePartialFromCodedStream( |
||||
::google::protobuf::io::CodedInputStream* input) { |
||||
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure |
||||
::google::protobuf::uint32 tag; |
||||
// @@protoc_insertion_point(parse_start:helloworld.HelloRequest)
|
||||
for (;;) { |
||||
::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); |
||||
tag = p.first; |
||||
if (!p.second) goto handle_unusual; |
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { |
||||
// string name = 1;
|
||||
case 1: { |
||||
if (static_cast< ::google::protobuf::uint8>(tag) == |
||||
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { |
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString( |
||||
input, this->mutable_name())); |
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->name().data(), static_cast<int>(this->name().length()), |
||||
::google::protobuf::internal::WireFormatLite::PARSE, |
||||
"helloworld.HelloRequest.name")); |
||||
} else { |
||||
goto handle_unusual; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
default: { |
||||
handle_unusual: |
||||
if (tag == 0) { |
||||
goto success; |
||||
} |
||||
DO_(::google::protobuf::internal::WireFormat::SkipField( |
||||
input, tag, _internal_metadata_.mutable_unknown_fields())); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
success: |
||||
// @@protoc_insertion_point(parse_success:helloworld.HelloRequest)
|
||||
return true; |
||||
failure: |
||||
// @@protoc_insertion_point(parse_failure:helloworld.HelloRequest)
|
||||
return false; |
||||
#undef DO_ |
||||
} |
||||
|
||||
void HelloRequest::SerializeWithCachedSizes( |
||||
::google::protobuf::io::CodedOutputStream* output) const { |
||||
// @@protoc_insertion_point(serialize_start:helloworld.HelloRequest)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
// string name = 1;
|
||||
if (this->name().size() > 0) { |
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->name().data(), static_cast<int>(this->name().length()), |
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE, |
||||
"helloworld.HelloRequest.name"); |
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( |
||||
1, this->name(), output); |
||||
} |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); |
||||
} |
||||
// @@protoc_insertion_point(serialize_end:helloworld.HelloRequest)
|
||||
} |
||||
|
||||
::google::protobuf::uint8* HelloRequest::InternalSerializeWithCachedSizesToArray( |
||||
bool deterministic, ::google::protobuf::uint8* target) const { |
||||
(void)deterministic; // Unused
|
||||
// @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloRequest)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
// string name = 1;
|
||||
if (this->name().size() > 0) { |
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->name().data(), static_cast<int>(this->name().length()), |
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE, |
||||
"helloworld.HelloRequest.name"); |
||||
target = |
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray( |
||||
1, this->name(), target); |
||||
} |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); |
||||
} |
||||
// @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloRequest)
|
||||
return target; |
||||
} |
||||
|
||||
size_t HelloRequest::ByteSizeLong() const { |
||||
// @@protoc_insertion_point(message_byte_size_start:helloworld.HelloRequest)
|
||||
size_t total_size = 0; |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
total_size += |
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); |
||||
} |
||||
// string name = 1;
|
||||
if (this->name().size() > 0) { |
||||
total_size += 1 + |
||||
::google::protobuf::internal::WireFormatLite::StringSize( |
||||
this->name()); |
||||
} |
||||
|
||||
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); |
||||
SetCachedSize(cached_size); |
||||
return total_size; |
||||
} |
||||
|
||||
void HelloRequest::MergeFrom(const ::google::protobuf::Message& from) { |
||||
// @@protoc_insertion_point(generalized_merge_from_start:helloworld.HelloRequest)
|
||||
GOOGLE_DCHECK_NE(&from, this); |
||||
const HelloRequest* source = |
||||
::google::protobuf::internal::DynamicCastToGenerated<const HelloRequest>( |
||||
&from); |
||||
if (source == NULL) { |
||||
// @@protoc_insertion_point(generalized_merge_from_cast_fail:helloworld.HelloRequest)
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this); |
||||
} else { |
||||
// @@protoc_insertion_point(generalized_merge_from_cast_success:helloworld.HelloRequest)
|
||||
MergeFrom(*source); |
||||
} |
||||
} |
||||
|
||||
void HelloRequest::MergeFrom(const HelloRequest& from) { |
||||
// @@protoc_insertion_point(class_specific_merge_from_start:helloworld.HelloRequest)
|
||||
GOOGLE_DCHECK_NE(&from, this); |
||||
_internal_metadata_.MergeFrom(from._internal_metadata_); |
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
if (from.name().size() > 0) { |
||||
|
||||
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); |
||||
} |
||||
} |
||||
|
||||
void HelloRequest::CopyFrom(const ::google::protobuf::Message& from) { |
||||
// @@protoc_insertion_point(generalized_copy_from_start:helloworld.HelloRequest)
|
||||
if (&from == this) return; |
||||
Clear(); |
||||
MergeFrom(from); |
||||
} |
||||
|
||||
void HelloRequest::CopyFrom(const HelloRequest& from) { |
||||
// @@protoc_insertion_point(class_specific_copy_from_start:helloworld.HelloRequest)
|
||||
if (&from == this) return; |
||||
Clear(); |
||||
MergeFrom(from); |
||||
} |
||||
|
||||
bool HelloRequest::IsInitialized() const { |
||||
return true; |
||||
} |
||||
|
||||
void HelloRequest::Swap(HelloRequest* other) { |
||||
if (other == this) return; |
||||
InternalSwap(other); |
||||
} |
||||
void HelloRequest::InternalSwap(HelloRequest* other) { |
||||
using std::swap; |
||||
name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), |
||||
GetArenaNoVirtual()); |
||||
_internal_metadata_.Swap(&other->_internal_metadata_); |
||||
} |
||||
|
||||
::google::protobuf::Metadata HelloRequest::GetMetadata() const { |
||||
protobuf_helloworld_2eproto::protobuf_AssignDescriptorsOnce(); |
||||
return ::protobuf_helloworld_2eproto::file_level_metadata[kIndexInFileMessages]; |
||||
} |
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
void HelloReply::InitAsDefaultInstance() { |
||||
} |
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1900 |
||||
const int HelloReply::kMessageFieldNumber; |
||||
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
|
||||
|
||||
HelloReply::HelloReply() |
||||
: ::google::protobuf::Message(), _internal_metadata_(NULL) { |
||||
::google::protobuf::internal::InitSCC( |
||||
&protobuf_helloworld_2eproto::scc_info_HelloReply.base); |
||||
SharedCtor(); |
||||
// @@protoc_insertion_point(constructor:helloworld.HelloReply)
|
||||
} |
||||
HelloReply::HelloReply(const HelloReply& from) |
||||
: ::google::protobuf::Message(), |
||||
_internal_metadata_(NULL) { |
||||
_internal_metadata_.MergeFrom(from._internal_metadata_); |
||||
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
if (from.message().size() > 0) { |
||||
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_); |
||||
} |
||||
// @@protoc_insertion_point(copy_constructor:helloworld.HelloReply)
|
||||
} |
||||
|
||||
void HelloReply::SharedCtor() { |
||||
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
|
||||
HelloReply::~HelloReply() { |
||||
// @@protoc_insertion_point(destructor:helloworld.HelloReply)
|
||||
SharedDtor(); |
||||
} |
||||
|
||||
void HelloReply::SharedDtor() { |
||||
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
|
||||
void HelloReply::SetCachedSize(int size) const { |
||||
_cached_size_.Set(size); |
||||
} |
||||
const ::google::protobuf::Descriptor* HelloReply::descriptor() { |
||||
::protobuf_helloworld_2eproto::protobuf_AssignDescriptorsOnce(); |
||||
return ::protobuf_helloworld_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; |
||||
} |
||||
|
||||
const HelloReply& HelloReply::default_instance() { |
||||
::google::protobuf::internal::InitSCC(&protobuf_helloworld_2eproto::scc_info_HelloReply.base); |
||||
return *internal_default_instance(); |
||||
} |
||||
|
||||
|
||||
void HelloReply::Clear() { |
||||
// @@protoc_insertion_point(message_clear_start:helloworld.HelloReply)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits; |
||||
|
||||
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
_internal_metadata_.Clear(); |
||||
} |
||||
|
||||
bool HelloReply::MergePartialFromCodedStream( |
||||
::google::protobuf::io::CodedInputStream* input) { |
||||
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure |
||||
::google::protobuf::uint32 tag; |
||||
// @@protoc_insertion_point(parse_start:helloworld.HelloReply)
|
||||
for (;;) { |
||||
::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); |
||||
tag = p.first; |
||||
if (!p.second) goto handle_unusual; |
||||
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { |
||||
// string message = 1;
|
||||
case 1: { |
||||
if (static_cast< ::google::protobuf::uint8>(tag) == |
||||
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { |
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadString( |
||||
input, this->mutable_message())); |
||||
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->message().data(), static_cast<int>(this->message().length()), |
||||
::google::protobuf::internal::WireFormatLite::PARSE, |
||||
"helloworld.HelloReply.message")); |
||||
} else { |
||||
goto handle_unusual; |
||||
} |
||||
break; |
||||
} |
||||
|
||||
default: { |
||||
handle_unusual: |
||||
if (tag == 0) { |
||||
goto success; |
||||
} |
||||
DO_(::google::protobuf::internal::WireFormat::SkipField( |
||||
input, tag, _internal_metadata_.mutable_unknown_fields())); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
success: |
||||
// @@protoc_insertion_point(parse_success:helloworld.HelloReply)
|
||||
return true; |
||||
failure: |
||||
// @@protoc_insertion_point(parse_failure:helloworld.HelloReply)
|
||||
return false; |
||||
#undef DO_ |
||||
} |
||||
|
||||
void HelloReply::SerializeWithCachedSizes( |
||||
::google::protobuf::io::CodedOutputStream* output) const { |
||||
// @@protoc_insertion_point(serialize_start:helloworld.HelloReply)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
// string message = 1;
|
||||
if (this->message().size() > 0) { |
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->message().data(), static_cast<int>(this->message().length()), |
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE, |
||||
"helloworld.HelloReply.message"); |
||||
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( |
||||
1, this->message(), output); |
||||
} |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); |
||||
} |
||||
// @@protoc_insertion_point(serialize_end:helloworld.HelloReply)
|
||||
} |
||||
|
||||
::google::protobuf::uint8* HelloReply::InternalSerializeWithCachedSizesToArray( |
||||
bool deterministic, ::google::protobuf::uint8* target) const { |
||||
(void)deterministic; // Unused
|
||||
// @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloReply)
|
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
// string message = 1;
|
||||
if (this->message().size() > 0) { |
||||
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( |
||||
this->message().data(), static_cast<int>(this->message().length()), |
||||
::google::protobuf::internal::WireFormatLite::SERIALIZE, |
||||
"helloworld.HelloReply.message"); |
||||
target = |
||||
::google::protobuf::internal::WireFormatLite::WriteStringToArray( |
||||
1, this->message(), target); |
||||
} |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); |
||||
} |
||||
// @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloReply)
|
||||
return target; |
||||
} |
||||
|
||||
size_t HelloReply::ByteSizeLong() const { |
||||
// @@protoc_insertion_point(message_byte_size_start:helloworld.HelloReply)
|
||||
size_t total_size = 0; |
||||
|
||||
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { |
||||
total_size += |
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( |
||||
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); |
||||
} |
||||
// string message = 1;
|
||||
if (this->message().size() > 0) { |
||||
total_size += 1 + |
||||
::google::protobuf::internal::WireFormatLite::StringSize( |
||||
this->message()); |
||||
} |
||||
|
||||
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); |
||||
SetCachedSize(cached_size); |
||||
return total_size; |
||||
} |
||||
|
||||
void HelloReply::MergeFrom(const ::google::protobuf::Message& from) { |
||||
// @@protoc_insertion_point(generalized_merge_from_start:helloworld.HelloReply)
|
||||
GOOGLE_DCHECK_NE(&from, this); |
||||
const HelloReply* source = |
||||
::google::protobuf::internal::DynamicCastToGenerated<const HelloReply>( |
||||
&from); |
||||
if (source == NULL) { |
||||
// @@protoc_insertion_point(generalized_merge_from_cast_fail:helloworld.HelloReply)
|
||||
::google::protobuf::internal::ReflectionOps::Merge(from, this); |
||||
} else { |
||||
// @@protoc_insertion_point(generalized_merge_from_cast_success:helloworld.HelloReply)
|
||||
MergeFrom(*source); |
||||
} |
||||
} |
||||
|
||||
void HelloReply::MergeFrom(const HelloReply& from) { |
||||
// @@protoc_insertion_point(class_specific_merge_from_start:helloworld.HelloReply)
|
||||
GOOGLE_DCHECK_NE(&from, this); |
||||
_internal_metadata_.MergeFrom(from._internal_metadata_); |
||||
::google::protobuf::uint32 cached_has_bits = 0; |
||||
(void) cached_has_bits; |
||||
|
||||
if (from.message().size() > 0) { |
||||
|
||||
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_); |
||||
} |
||||
} |
||||
|
||||
void HelloReply::CopyFrom(const ::google::protobuf::Message& from) { |
||||
// @@protoc_insertion_point(generalized_copy_from_start:helloworld.HelloReply)
|
||||
if (&from == this) return; |
||||
Clear(); |
||||
MergeFrom(from); |
||||
} |
||||
|
||||
void HelloReply::CopyFrom(const HelloReply& from) { |
||||
// @@protoc_insertion_point(class_specific_copy_from_start:helloworld.HelloReply)
|
||||
if (&from == this) return; |
||||
Clear(); |
||||
MergeFrom(from); |
||||
} |
||||
|
||||
bool HelloReply::IsInitialized() const { |
||||
return true; |
||||
} |
||||
|
||||
void HelloReply::Swap(HelloReply* other) { |
||||
if (other == this) return; |
||||
InternalSwap(other); |
||||
} |
||||
void HelloReply::InternalSwap(HelloReply* other) { |
||||
using std::swap; |
||||
message_.Swap(&other->message_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), |
||||
GetArenaNoVirtual()); |
||||
_internal_metadata_.Swap(&other->_internal_metadata_); |
||||
} |
||||
|
||||
::google::protobuf::Metadata HelloReply::GetMetadata() const { |
||||
protobuf_helloworld_2eproto::protobuf_AssignDescriptorsOnce(); |
||||
return ::protobuf_helloworld_2eproto::file_level_metadata[kIndexInFileMessages]; |
||||
} |
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace helloworld
|
||||
namespace google { |
||||
namespace protobuf { |
||||
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::helloworld::HelloRequest* Arena::CreateMaybeMessage< ::helloworld::HelloRequest >(Arena* arena) { |
||||
return Arena::CreateInternal< ::helloworld::HelloRequest >(arena); |
||||
} |
||||
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::helloworld::HelloReply* Arena::CreateMaybeMessage< ::helloworld::HelloReply >(Arena* arena) { |
||||
return Arena::CreateInternal< ::helloworld::HelloReply >(arena); |
||||
} |
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -0,0 +1,419 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: helloworld.proto
|
||||
|
||||
#ifndef PROTOBUF_INCLUDED_helloworld_2eproto |
||||
#define PROTOBUF_INCLUDED_helloworld_2eproto |
||||
|
||||
#include <string> |
||||
|
||||
#include <google/protobuf/stubs/common.h> |
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION < 3006001 |
||||
#error This file was generated by a newer version of protoc which is |
||||
#error incompatible with your Protocol Buffer headers. Please update |
||||
#error your headers. |
||||
#endif |
||||
#if 3006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION |
||||
#error This file was generated by an older version of protoc which is |
||||
#error incompatible with your Protocol Buffer headers. Please |
||||
#error regenerate this file with a newer version of protoc. |
||||
#endif |
||||
|
||||
#include <google/protobuf/io/coded_stream.h> |
||||
#include <google/protobuf/arena.h> |
||||
#include <google/protobuf/arenastring.h> |
||||
#include <google/protobuf/generated_message_table_driven.h> |
||||
#include <google/protobuf/generated_message_util.h> |
||||
#include <google/protobuf/inlined_string_field.h> |
||||
#include <google/protobuf/metadata.h> |
||||
#include <google/protobuf/message.h> |
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export |
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export |
||||
#include <google/protobuf/unknown_field_set.h> |
||||
// @@protoc_insertion_point(includes)
|
||||
#define PROTOBUF_INTERNAL_EXPORT_protobuf_helloworld_2eproto |
||||
|
||||
namespace protobuf_helloworld_2eproto { |
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct { |
||||
static const ::google::protobuf::internal::ParseTableField entries[]; |
||||
static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; |
||||
static const ::google::protobuf::internal::ParseTable schema[2]; |
||||
static const ::google::protobuf::internal::FieldMetadata field_metadata[]; |
||||
static const ::google::protobuf::internal::SerializationTable serialization_table[]; |
||||
static const ::google::protobuf::uint32 offsets[]; |
||||
}; |
||||
void AddDescriptors(); |
||||
} // namespace protobuf_helloworld_2eproto
|
||||
namespace helloworld { |
||||
class HelloReply; |
||||
class HelloReplyDefaultTypeInternal; |
||||
extern HelloReplyDefaultTypeInternal _HelloReply_default_instance_; |
||||
class HelloRequest; |
||||
class HelloRequestDefaultTypeInternal; |
||||
extern HelloRequestDefaultTypeInternal _HelloRequest_default_instance_; |
||||
} // namespace helloworld
|
||||
namespace google { |
||||
namespace protobuf { |
||||
template<> ::helloworld::HelloReply* Arena::CreateMaybeMessage<::helloworld::HelloReply>(Arena*); |
||||
template<> ::helloworld::HelloRequest* Arena::CreateMaybeMessage<::helloworld::HelloRequest>(Arena*); |
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
namespace helloworld { |
||||
|
||||
// ===================================================================
|
||||
|
||||
class HelloRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:helloworld.HelloRequest) */ { |
||||
public: |
||||
HelloRequest(); |
||||
virtual ~HelloRequest(); |
||||
|
||||
HelloRequest(const HelloRequest& from); |
||||
|
||||
inline HelloRequest& operator=(const HelloRequest& from) { |
||||
CopyFrom(from); |
||||
return *this; |
||||
} |
||||
#if LANG_CXX11 |
||||
HelloRequest(HelloRequest&& from) noexcept |
||||
: HelloRequest() { |
||||
*this = ::std::move(from); |
||||
} |
||||
|
||||
inline HelloRequest& operator=(HelloRequest&& from) noexcept { |
||||
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { |
||||
if (this != &from) InternalSwap(&from); |
||||
} else { |
||||
CopyFrom(from); |
||||
} |
||||
return *this; |
||||
} |
||||
#endif |
||||
static const ::google::protobuf::Descriptor* descriptor(); |
||||
static const HelloRequest& default_instance(); |
||||
|
||||
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
|
||||
static inline const HelloRequest* internal_default_instance() { |
||||
return reinterpret_cast<const HelloRequest*>( |
||||
&_HelloRequest_default_instance_); |
||||
} |
||||
static constexpr int kIndexInFileMessages = |
||||
0; |
||||
|
||||
void Swap(HelloRequest* other); |
||||
friend void swap(HelloRequest& a, HelloRequest& b) { |
||||
a.Swap(&b); |
||||
} |
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
inline HelloRequest* New() const final { |
||||
return CreateMaybeMessage<HelloRequest>(NULL); |
||||
} |
||||
|
||||
HelloRequest* New(::google::protobuf::Arena* arena) const final { |
||||
return CreateMaybeMessage<HelloRequest>(arena); |
||||
} |
||||
void CopyFrom(const ::google::protobuf::Message& from) final; |
||||
void MergeFrom(const ::google::protobuf::Message& from) final; |
||||
void CopyFrom(const HelloRequest& from); |
||||
void MergeFrom(const HelloRequest& from); |
||||
void Clear() final; |
||||
bool IsInitialized() const final; |
||||
|
||||
size_t ByteSizeLong() const final; |
||||
bool MergePartialFromCodedStream( |
||||
::google::protobuf::io::CodedInputStream* input) final; |
||||
void SerializeWithCachedSizes( |
||||
::google::protobuf::io::CodedOutputStream* output) const final; |
||||
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( |
||||
bool deterministic, ::google::protobuf::uint8* target) const final; |
||||
int GetCachedSize() const final { return _cached_size_.Get(); } |
||||
|
||||
private: |
||||
void SharedCtor(); |
||||
void SharedDtor(); |
||||
void SetCachedSize(int size) const final; |
||||
void InternalSwap(HelloRequest* other); |
||||
private: |
||||
inline ::google::protobuf::Arena* GetArenaNoVirtual() const { |
||||
return NULL; |
||||
} |
||||
inline void* MaybeArenaPtr() const { |
||||
return NULL; |
||||
} |
||||
public: |
||||
|
||||
::google::protobuf::Metadata GetMetadata() const final; |
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// string name = 1;
|
||||
void clear_name(); |
||||
static const int kNameFieldNumber = 1; |
||||
const ::std::string& name() const; |
||||
void set_name(const ::std::string& value); |
||||
#if LANG_CXX11 |
||||
void set_name(::std::string&& value); |
||||
#endif |
||||
void set_name(const char* value); |
||||
void set_name(const char* value, size_t size); |
||||
::std::string* mutable_name(); |
||||
::std::string* release_name(); |
||||
void set_allocated_name(::std::string* name); |
||||
|
||||
// @@protoc_insertion_point(class_scope:helloworld.HelloRequest)
|
||||
private: |
||||
|
||||
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; |
||||
::google::protobuf::internal::ArenaStringPtr name_; |
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_; |
||||
friend struct ::protobuf_helloworld_2eproto::TableStruct; |
||||
}; |
||||
// -------------------------------------------------------------------
|
||||
|
||||
class HelloReply : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:helloworld.HelloReply) */ { |
||||
public: |
||||
HelloReply(); |
||||
virtual ~HelloReply(); |
||||
|
||||
HelloReply(const HelloReply& from); |
||||
|
||||
inline HelloReply& operator=(const HelloReply& from) { |
||||
CopyFrom(from); |
||||
return *this; |
||||
} |
||||
#if LANG_CXX11 |
||||
HelloReply(HelloReply&& from) noexcept |
||||
: HelloReply() { |
||||
*this = ::std::move(from); |
||||
} |
||||
|
||||
inline HelloReply& operator=(HelloReply&& from) noexcept { |
||||
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { |
||||
if (this != &from) InternalSwap(&from); |
||||
} else { |
||||
CopyFrom(from); |
||||
} |
||||
return *this; |
||||
} |
||||
#endif |
||||
static const ::google::protobuf::Descriptor* descriptor(); |
||||
static const HelloReply& default_instance(); |
||||
|
||||
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
|
||||
static inline const HelloReply* internal_default_instance() { |
||||
return reinterpret_cast<const HelloReply*>( |
||||
&_HelloReply_default_instance_); |
||||
} |
||||
static constexpr int kIndexInFileMessages = |
||||
1; |
||||
|
||||
void Swap(HelloReply* other); |
||||
friend void swap(HelloReply& a, HelloReply& b) { |
||||
a.Swap(&b); |
||||
} |
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
inline HelloReply* New() const final { |
||||
return CreateMaybeMessage<HelloReply>(NULL); |
||||
} |
||||
|
||||
HelloReply* New(::google::protobuf::Arena* arena) const final { |
||||
return CreateMaybeMessage<HelloReply>(arena); |
||||
} |
||||
void CopyFrom(const ::google::protobuf::Message& from) final; |
||||
void MergeFrom(const ::google::protobuf::Message& from) final; |
||||
void CopyFrom(const HelloReply& from); |
||||
void MergeFrom(const HelloReply& from); |
||||
void Clear() final; |
||||
bool IsInitialized() const final; |
||||
|
||||
size_t ByteSizeLong() const final; |
||||
bool MergePartialFromCodedStream( |
||||
::google::protobuf::io::CodedInputStream* input) final; |
||||
void SerializeWithCachedSizes( |
||||
::google::protobuf::io::CodedOutputStream* output) const final; |
||||
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( |
||||
bool deterministic, ::google::protobuf::uint8* target) const final; |
||||
int GetCachedSize() const final { return _cached_size_.Get(); } |
||||
|
||||
private: |
||||
void SharedCtor(); |
||||
void SharedDtor(); |
||||
void SetCachedSize(int size) const final; |
||||
void InternalSwap(HelloReply* other); |
||||
private: |
||||
inline ::google::protobuf::Arena* GetArenaNoVirtual() const { |
||||
return NULL; |
||||
} |
||||
inline void* MaybeArenaPtr() const { |
||||
return NULL; |
||||
} |
||||
public: |
||||
|
||||
::google::protobuf::Metadata GetMetadata() const final; |
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
// string message = 1;
|
||||
void clear_message(); |
||||
static const int kMessageFieldNumber = 1; |
||||
const ::std::string& message() const; |
||||
void set_message(const ::std::string& value); |
||||
#if LANG_CXX11 |
||||
void set_message(::std::string&& value); |
||||
#endif |
||||
void set_message(const char* value); |
||||
void set_message(const char* value, size_t size); |
||||
::std::string* mutable_message(); |
||||
::std::string* release_message(); |
||||
void set_allocated_message(::std::string* message); |
||||
|
||||
// @@protoc_insertion_point(class_scope:helloworld.HelloReply)
|
||||
private: |
||||
|
||||
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; |
||||
::google::protobuf::internal::ArenaStringPtr message_; |
||||
mutable ::google::protobuf::internal::CachedSize _cached_size_; |
||||
friend struct ::protobuf_helloworld_2eproto::TableStruct; |
||||
}; |
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__ |
||||
#pragma GCC diagnostic push |
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing" |
||||
#endif // __GNUC__
|
||||
// HelloRequest
|
||||
|
||||
// string name = 1;
|
||||
inline void HelloRequest::clear_name() { |
||||
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline const ::std::string& HelloRequest::name() const { |
||||
// @@protoc_insertion_point(field_get:helloworld.HelloRequest.name)
|
||||
return name_.GetNoArena(); |
||||
} |
||||
inline void HelloRequest::set_name(const ::std::string& value) { |
||||
|
||||
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); |
||||
// @@protoc_insertion_point(field_set:helloworld.HelloRequest.name)
|
||||
} |
||||
#if LANG_CXX11 |
||||
inline void HelloRequest::set_name(::std::string&& value) { |
||||
|
||||
name_.SetNoArena( |
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); |
||||
// @@protoc_insertion_point(field_set_rvalue:helloworld.HelloRequest.name)
|
||||
} |
||||
#endif |
||||
inline void HelloRequest::set_name(const char* value) { |
||||
GOOGLE_DCHECK(value != NULL); |
||||
|
||||
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); |
||||
// @@protoc_insertion_point(field_set_char:helloworld.HelloRequest.name)
|
||||
} |
||||
inline void HelloRequest::set_name(const char* value, size_t size) { |
||||
|
||||
name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), |
||||
::std::string(reinterpret_cast<const char*>(value), size)); |
||||
// @@protoc_insertion_point(field_set_pointer:helloworld.HelloRequest.name)
|
||||
} |
||||
inline ::std::string* HelloRequest::mutable_name() { |
||||
|
||||
// @@protoc_insertion_point(field_mutable:helloworld.HelloRequest.name)
|
||||
return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline ::std::string* HelloRequest::release_name() { |
||||
// @@protoc_insertion_point(field_release:helloworld.HelloRequest.name)
|
||||
|
||||
return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline void HelloRequest::set_allocated_name(::std::string* name) { |
||||
if (name != NULL) { |
||||
|
||||
} else { |
||||
|
||||
} |
||||
name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); |
||||
// @@protoc_insertion_point(field_set_allocated:helloworld.HelloRequest.name)
|
||||
} |
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// HelloReply
|
||||
|
||||
// string message = 1;
|
||||
inline void HelloReply::clear_message() { |
||||
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline const ::std::string& HelloReply::message() const { |
||||
// @@protoc_insertion_point(field_get:helloworld.HelloReply.message)
|
||||
return message_.GetNoArena(); |
||||
} |
||||
inline void HelloReply::set_message(const ::std::string& value) { |
||||
|
||||
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); |
||||
// @@protoc_insertion_point(field_set:helloworld.HelloReply.message)
|
||||
} |
||||
#if LANG_CXX11 |
||||
inline void HelloReply::set_message(::std::string&& value) { |
||||
|
||||
message_.SetNoArena( |
||||
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); |
||||
// @@protoc_insertion_point(field_set_rvalue:helloworld.HelloReply.message)
|
||||
} |
||||
#endif |
||||
inline void HelloReply::set_message(const char* value) { |
||||
GOOGLE_DCHECK(value != NULL); |
||||
|
||||
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); |
||||
// @@protoc_insertion_point(field_set_char:helloworld.HelloReply.message)
|
||||
} |
||||
inline void HelloReply::set_message(const char* value, size_t size) { |
||||
|
||||
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), |
||||
::std::string(reinterpret_cast<const char*>(value), size)); |
||||
// @@protoc_insertion_point(field_set_pointer:helloworld.HelloReply.message)
|
||||
} |
||||
inline ::std::string* HelloReply::mutable_message() { |
||||
|
||||
// @@protoc_insertion_point(field_mutable:helloworld.HelloReply.message)
|
||||
return message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline ::std::string* HelloReply::release_message() { |
||||
// @@protoc_insertion_point(field_release:helloworld.HelloReply.message)
|
||||
|
||||
return message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); |
||||
} |
||||
inline void HelloReply::set_allocated_message(::std::string* message) { |
||||
if (message != NULL) { |
||||
|
||||
} else { |
||||
|
||||
} |
||||
message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), message); |
||||
// @@protoc_insertion_point(field_set_allocated:helloworld.HelloReply.message)
|
||||
} |
||||
|
||||
#ifdef __GNUC__ |
||||
#pragma GCC diagnostic pop |
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace helloworld
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#endif // PROTOBUF_INCLUDED_helloworld_2eproto
|
Binary file not shown.
Loading…
Reference in new issue