gRPC-haskell/examples/echo/echo-cpp/echo.pb.cc
Connor Clark ce56953b24 Various example/benchmarking code (#16)
* initial echo client/server examples

* registered and unregistered versions of the example client

* ignore pyc files

* cpp echo code, flag to build examples

* threaded server example
2016-06-03 10:34:09 -07:00

385 lines
12 KiB
C++

// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: echo.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "echo.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.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>
// @@protoc_insertion_point(includes)
namespace echo {
namespace {
const ::google::protobuf::Descriptor* EchoRequest_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
EchoRequest_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_echo_2eproto() {
protobuf_AddDesc_echo_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"echo.proto");
GOOGLE_CHECK(file != NULL);
EchoRequest_descriptor_ = file->message_type(0);
static const int EchoRequest_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EchoRequest, message_),
};
EchoRequest_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
EchoRequest_descriptor_,
EchoRequest::default_instance_,
EchoRequest_offsets_,
-1,
-1,
-1,
sizeof(EchoRequest),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EchoRequest, _internal_metadata_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EchoRequest, _is_default_instance_));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_echo_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
EchoRequest_descriptor_, &EchoRequest::default_instance());
}
} // namespace
void protobuf_ShutdownFile_echo_2eproto() {
delete EchoRequest::default_instance_;
delete EchoRequest_reflection_;
}
void protobuf_AddDesc_echo_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\necho.proto\022\004echo\"\036\n\013EchoRequest\022\017\n\007mes"
"sage\030\001 \001(\t28\n\004Echo\0220\n\006DoEcho\022\021.echo.Echo"
"Request\032\021.echo.EchoRequest\"\000b\006proto3", 116);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"echo.proto", &protobuf_RegisterTypes);
EchoRequest::default_instance_ = new EchoRequest();
EchoRequest::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_echo_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_echo_2eproto {
StaticDescriptorInitializer_echo_2eproto() {
protobuf_AddDesc_echo_2eproto();
}
} static_descriptor_initializer_echo_2eproto_;
namespace {
static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD;
static void MergeFromFail(int line) {
GOOGLE_CHECK(false) << __FILE__ << ":" << line;
}
} // namespace
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int EchoRequest::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
EchoRequest::EchoRequest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
SharedCtor();
// @@protoc_insertion_point(constructor:echo.EchoRequest)
}
void EchoRequest::InitAsDefaultInstance() {
_is_default_instance_ = true;
}
EchoRequest::EchoRequest(const EchoRequest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:echo.EchoRequest)
}
void EchoRequest::SharedCtor() {
_is_default_instance_ = false;
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
EchoRequest::~EchoRequest() {
// @@protoc_insertion_point(destructor:echo.EchoRequest)
SharedDtor();
}
void EchoRequest::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (this != default_instance_) {
}
}
void EchoRequest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EchoRequest::descriptor() {
protobuf_AssignDescriptorsOnce();
return EchoRequest_descriptor_;
}
const EchoRequest& EchoRequest::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_echo_2eproto();
return *default_instance_;
}
EchoRequest* EchoRequest::default_instance_ = NULL;
EchoRequest* EchoRequest::New(::google::protobuf::Arena* arena) const {
EchoRequest* n = new EchoRequest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void EchoRequest::Clear() {
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool EchoRequest::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:echo.EchoRequest)
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()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"echo.EchoRequest.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:echo.EchoRequest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:echo.EchoRequest)
return false;
#undef DO_
}
void EchoRequest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:echo.EchoRequest)
// optional string message = 1;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"echo.EchoRequest.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->message(), output);
}
// @@protoc_insertion_point(serialize_end:echo.EchoRequest)
}
::google::protobuf::uint8* EchoRequest::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:echo.EchoRequest)
// optional string message = 1;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), this->message().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"echo.EchoRequest.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->message(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:echo.EchoRequest)
return target;
}
int EchoRequest::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 EchoRequest::MergeFrom(const ::google::protobuf::Message& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const EchoRequest* source =
::google::protobuf::internal::DynamicCastToGenerated<const EchoRequest>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void EchoRequest::MergeFrom(const EchoRequest& from) {
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
}
void EchoRequest::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void EchoRequest::CopyFrom(const EchoRequest& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool EchoRequest::IsInitialized() const {
return true;
}
void EchoRequest::Swap(EchoRequest* other) {
if (other == this) return;
InternalSwap(other);
}
void EchoRequest::InternalSwap(EchoRequest* other) {
message_.Swap(&other->message_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata EchoRequest::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = EchoRequest_descriptor_;
metadata.reflection = EchoRequest_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// EchoRequest
// optional string message = 1;
void EchoRequest::clear_message() {
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
const ::std::string& EchoRequest::message() const {
// @@protoc_insertion_point(field_get:echo.EchoRequest.message)
return message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void EchoRequest::set_message(const ::std::string& value) {
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:echo.EchoRequest.message)
}
void EchoRequest::set_message(const char* value) {
message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:echo.EchoRequest.message)
}
void EchoRequest::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:echo.EchoRequest.message)
}
::std::string* EchoRequest::mutable_message() {
// @@protoc_insertion_point(field_mutable:echo.EchoRequest.message)
return message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* EchoRequest::release_message() {
return message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void EchoRequest::set_allocated_message(::std::string* message) {
if (message != NULL) {
} else {
}
message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), message);
// @@protoc_insertion_point(field_set_allocated:echo.EchoRequest.message)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace echo
// @@protoc_insertion_point(global_scope)