The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

641 lines
21 KiB

// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: helloworld.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "helloworld.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.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>
#include <grpc++/async_unary_call.h>
#include <grpc++/channel_interface.h>
#include <grpc++/impl/client_unary_call.h>
#include <grpc++/impl/rpc_method.h>
#include <grpc++/impl/rpc_service_method.h>
#include <grpc++/impl/service_type.h>
#include <grpc++/stream.h>
// @@protoc_insertion_point(includes)
namespace helloworld {
namespace {
const ::google::protobuf::Descriptor* HelloRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
HelloRequest_reflection_ = NULL;
const ::google::protobuf::Descriptor* HelloReply_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
HelloReply_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_helloworld_2eproto() {
protobuf_AddDesc_helloworld_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"helloworld.proto");
GOOGLE_CHECK(file != NULL);
HelloRequest_descriptor_ = file->message_type(0);
static const int HelloRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloRequest, name_),
};
HelloRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
HelloRequest_descriptor_,
HelloRequest::default_instance_,
HelloRequest_offsets_,
-1,
-1,
-1,
sizeof(HelloRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloRequest, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloRequest, _is_default_instance_));
HelloReply_descriptor_ = file->message_type(1);
static const int HelloReply_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloReply, message_),
};
HelloReply_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
HelloReply_descriptor_,
HelloReply::default_instance_,
HelloReply_offsets_,
-1,
-1,
-1,
sizeof(HelloReply),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloReply, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(HelloReply, _is_default_instance_));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_helloworld_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
HelloRequest_descriptor_, &HelloRequest::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
HelloReply_descriptor_, &HelloReply::default_instance());
}
} // namespace
void protobuf_ShutdownFile_helloworld_2eproto() {
delete HelloRequest::default_instance_;
delete HelloRequest_reflection_;
delete HelloReply::default_instance_;
delete HelloReply_reflection_;
}
void protobuf_AddDesc_helloworld_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\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\"\000B\t\n\007ex.grpcb\006proto3", 185);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"helloworld.proto", &protobuf_RegisterTypes);
HelloRequest::default_instance_ = new HelloRequest();
HelloReply::default_instance_ = new HelloReply();
HelloRequest::default_instance_->InitAsDefaultInstance();
HelloReply::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_helloworld_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_helloworld_2eproto {
StaticDescriptorInitializer_helloworld_2eproto() {
protobuf_AddDesc_helloworld_2eproto();
}
} static_descriptor_initializer_helloworld_2eproto_;
namespace {
static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD;
static void MergeFromFail(int line) {
GOOGLE_CHECK(false) << __FILE__ << ":" << line;
}
} // namespace
// ===================================================================
#ifndef _MSC_VER
const int HelloRequest::kNameFieldNumber;
#endif // !_MSC_VER
HelloRequest::HelloRequest()
: ::google::protobuf::Message() , _internal_metadata_(NULL) {
SharedCtor();
// @@protoc_insertion_point(constructor:helloworld.HelloRequest)
}
void HelloRequest::InitAsDefaultInstance() {
_is_default_instance_ = true;
}
HelloRequest::HelloRequest(const HelloRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:helloworld.HelloRequest)
}
void HelloRequest::SharedCtor() {
_is_default_instance_ = false;
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
HelloRequest::~HelloRequest() {
// @@protoc_insertion_point(destructor:helloworld.HelloRequest)
SharedDtor();
}
void HelloRequest::SharedDtor() {
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != default_instance_) {
}
}
void HelloRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* HelloRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return HelloRequest_descriptor_;
}
const HelloRequest& HelloRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_helloworld_2eproto();
return *default_instance_;
}
HelloRequest* HelloRequest::default_instance_ = NULL;
HelloRequest* HelloRequest::New(::google::protobuf::Arena* arena) const {
HelloRequest* n = new HelloRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void HelloRequest::Clear() {
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool HelloRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:helloworld.HelloRequest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE,
"helloworld.HelloRequest.name");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
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)
// optional string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"helloworld.HelloRequest.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// @@protoc_insertion_point(serialize_end:helloworld.HelloRequest)
}
::google::protobuf::uint8* HelloRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloRequest)
// optional string name = 1;
if (this->name().size() > 0) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"helloworld.HelloRequest.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloRequest)
return target;
}
int HelloRequest::ByteSize() const {
int total_size = 0;
// optional string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void HelloRequest::MergeFrom(const ::google::protobuf::Message& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const HelloRequest* source =
::google::protobuf::internal::dynamic_cast_if_available<const HelloRequest*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void HelloRequest::MergeFrom(const HelloRequest& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
if (from.name().size() > 0) {
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
}
}
void HelloRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void HelloRequest::CopyFrom(const HelloRequest& from) {
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) {
name_.Swap(&other->name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata HelloRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = HelloRequest_descriptor_;
metadata.reflection = HelloRequest_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int HelloReply::kMessageFieldNumber;
#endif // !_MSC_VER
HelloReply::HelloReply()
: ::google::protobuf::Message() , _internal_metadata_(NULL) {
SharedCtor();
// @@protoc_insertion_point(constructor:helloworld.HelloReply)
}
void HelloReply::InitAsDefaultInstance() {
_is_default_instance_ = true;
}
HelloReply::HelloReply(const HelloReply& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:helloworld.HelloReply)
}
void HelloReply::SharedCtor() {
_is_default_instance_ = false;
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
HelloReply::~HelloReply() {
// @@protoc_insertion_point(destructor:helloworld.HelloReply)
SharedDtor();
}
void HelloReply::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != default_instance_) {
}
}
void HelloReply::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* HelloReply::descriptor() {
protobuf_AssignDescriptorsOnce();
return HelloReply_descriptor_;
}
const HelloReply& HelloReply::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_helloworld_2eproto();
return *default_instance_;
}
HelloReply* HelloReply::default_instance_ = NULL;
HelloReply* HelloReply::New(::google::protobuf::Arena* arena) const {
HelloReply* n = new HelloReply;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void HelloReply::Clear() {
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool HelloReply::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:helloworld.HelloReply)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string message = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormat::PARSE,
"helloworld.HelloReply.message");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
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)
// optional string message = 1;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"helloworld.HelloReply.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->message(), output);
}
// @@protoc_insertion_point(serialize_end:helloworld.HelloReply)
}
::google::protobuf::uint8* HelloReply::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:helloworld.HelloReply)
// optional string message = 1;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"helloworld.HelloReply.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->message(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:helloworld.HelloReply)
return target;
}
int HelloReply::ByteSize() const {
int total_size = 0;
// optional string message = 1;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void HelloReply::MergeFrom(const ::google::protobuf::Message& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const HelloReply* source =
::google::protobuf::internal::dynamic_cast_if_available<const HelloReply*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void HelloReply::MergeFrom(const HelloReply& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
}
void HelloReply::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void HelloReply::CopyFrom(const HelloReply& from) {
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) {
message_.Swap(&other->message_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata HelloReply::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = HelloReply_descriptor_;
metadata.reflection = HelloReply_reflection_;
return metadata;
}
static const char* Greeter_method_names[] = {
"/helloworld.Greeter/sayHello",
};
Greeter::Stub* Greeter::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) {
Greeter::Stub* stub = new Greeter::Stub();
stub->set_channel(channel);
return stub;
};
::grpc::Status Greeter::Stub::sayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) {
return ::grpc::BlockingUnaryCall(channel(),::grpc::RpcMethod(Greeter_method_names[0]), context, request, response);
}
::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>* Greeter::Stub::sayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq, void* tag) {
return new ::grpc::ClientAsyncResponseReader< ::helloworld::HelloReply>(channel(), cq, ::grpc::RpcMethod(Greeter_method_names[0]), context, request, tag);
}
Greeter::AsyncService::AsyncService(::grpc::CompletionQueue* cq) : ::grpc::AsynchronousService(cq, Greeter_method_names, 1) {}
Greeter::Service::~Service() {
delete service_;
}
::grpc::Status Greeter::Service::sayHello(::grpc::ServerContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response) {
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED);
}
void Greeter::AsyncService::RequestsayHello(::grpc::ServerContext* context, ::helloworld::HelloRequest* request, ::grpc::ServerAsyncResponseWriter< ::helloworld::HelloReply>* response, ::grpc::CompletionQueue* cq, void* tag) {
AsynchronousService::RequestAsyncUnary(0, context, request, response, cq, tag);
}
::grpc::RpcService* Greeter::Service::service() {
if (service_ != nullptr) {
return service_;
}
service_ = new ::grpc::RpcService();
service_->AddMethod(new ::grpc::RpcServiceMethod(
Greeter_method_names[0],
::grpc::RpcMethod::NORMAL_RPC,
new ::grpc::RpcMethodHandler< Greeter::Service, ::helloworld::HelloRequest, ::helloworld::HelloReply>(
std::function< ::grpc::Status(Greeter::Service*, ::grpc::ServerContext*, const ::helloworld::HelloRequest*, ::helloworld::HelloReply*)>(&Greeter::Service::sayHello), this),
new ::helloworld::HelloRequest, new ::helloworld::HelloReply));
return service_;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace helloworld
// @@protoc_insertion_point(global_scope)