From 01750862078d601c6c622ac535fb22f76c7baef3 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Thu, 9 Apr 2015 16:23:47 +0200 Subject: [PATCH] RPC Stuff, not working, yet --- Client/Client.cpp | 47 ++- Client/Client.vcxproj | 17 +- Client/Client.vcxproj.filters | 15 +- Client/proto/Messages.pb.cc | 726 ++++++++++++++++++++++++++++++++++ Client/proto/Messages.pb.h | 454 +++++++++++++++++++++ Client/proto/reply.pb.cc | 344 ---------------- Client/proto/reply.pb.h | 221 ----------- Client/proto/request.pb.cc | 344 ---------------- Client/proto/request.pb.h | 221 ----------- Server/Server.cpp | 61 ++- Server/Server.vcxproj | 17 +- Server/Server.vcxproj.filters | 15 +- Server/proto/Messages.pb.cc | 726 ++++++++++++++++++++++++++++++++++ Server/proto/Messages.pb.h | 454 +++++++++++++++++++++ Server/proto/reply.pb.cc | 344 ---------------- Server/proto/reply.pb.h | 221 ----------- Server/proto/request.pb.cc | 344 ---------------- Server/proto/request.pb.h | 221 ----------- proto/Messages.proto | 20 + proto/reply.proto | 7 - proto/request.proto | 7 - 21 files changed, 2490 insertions(+), 2336 deletions(-) create mode 100644 Client/proto/Messages.pb.cc create mode 100644 Client/proto/Messages.pb.h delete mode 100644 Client/proto/reply.pb.cc delete mode 100644 Client/proto/reply.pb.h delete mode 100644 Client/proto/request.pb.cc delete mode 100644 Client/proto/request.pb.h create mode 100644 Server/proto/Messages.pb.cc create mode 100644 Server/proto/Messages.pb.h delete mode 100644 Server/proto/reply.pb.cc delete mode 100644 Server/proto/reply.pb.h delete mode 100644 Server/proto/request.pb.cc delete mode 100644 Server/proto/request.pb.h create mode 100644 proto/Messages.proto delete mode 100644 proto/reply.proto delete mode 100644 proto/request.proto diff --git a/Client/Client.cpp b/Client/Client.cpp index 419f92f..9e2241d 100644 --- a/Client/Client.cpp +++ b/Client/Client.cpp @@ -1,10 +1,35 @@ #include #include +#include #include -#include "proto/request.pb.h" -#include "proto/reply.pb.h" +#include "proto/Messages.pb.h" + +class MyRpcChannel : public google::protobuf::RpcChannel +{ +private: + std::shared_ptr m_zmqContext; + std::shared_ptr m_zmqSocket; + +public: + MyRpcChannel(const std::string &connectString) + { + m_zmqContext = std::make_shared(1); + m_zmqSocket = std::make_shared(*m_zmqContext, ZMQ_REQ); + m_zmqSocket->connect(connectString.c_str()); + } + + virtual void CallMethod( + const google::protobuf::MethodDescriptor* method, + google::protobuf::RpcController* controller, + const google::protobuf::Message* request, + google::protobuf::Message* response, + google::protobuf::Closure* done) override + { + std::cout << "sending message type " << request->GetDescriptor()->full_name() << std::endl; + } +}; int main(int argc, char **argv) { @@ -14,9 +39,20 @@ int main(int argc, char **argv) zmq::socket_t socket(context, ZMQ_REQ); socket.connect("tcp://localhost:5555"); + MyRpcChannel channel("tcp://localhost:5555"); + Messages::PingService::Stub pingService(&channel); + + Messages::PingRequest pingRequest; + pingRequest.set_text("Ping"); + + Messages::PingReply pingReply; + + pingService.Ping(nullptr, &pingRequest, &pingReply, nullptr); + pingService.Ping2(nullptr, &pingRequest, &pingReply, nullptr); + while (true) { - Messages::Request requestMessage; + Messages::PingRequest requestMessage; requestMessage.set_text("Hello Server"); zmq::message_t request(requestMessage.ByteSize()); @@ -26,7 +62,7 @@ int main(int argc, char **argv) zmq::message_t reply; socket.recv(&reply); - Messages::Reply replyMessage; + Messages::PingReply replyMessage; replyMessage.ParseFromArray(reply.data(), reply.size()); std::cout << "Received reply: " << replyMessage.text() << std::endl; @@ -35,4 +71,5 @@ int main(int argc, char **argv) } return 0; -} \ No newline at end of file +} + diff --git a/Client/Client.vcxproj b/Client/Client.vcxproj index 26e1499..e989c39 100644 --- a/Client/Client.vcxproj +++ b/Client/Client.vcxproj @@ -85,20 +85,10 @@ - - + - - false - Document - false - proto\%(Filename).pb.h;proto\%(Filename).pb.cc - proto\%(Filename).pb.h;proto\%(Filename).pb.cc - $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) - $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) - - + false Document false @@ -109,8 +99,7 @@ - - + diff --git a/Client/Client.vcxproj.filters b/Client/Client.vcxproj.filters index 964518a..75ea4ff 100644 --- a/Client/Client.vcxproj.filters +++ b/Client/Client.vcxproj.filters @@ -21,26 +21,17 @@ Source Files - - proto - - + proto - - proto - - + proto - - proto - - + proto diff --git a/Client/proto/Messages.pb.cc b/Client/proto/Messages.pb.cc new file mode 100644 index 0000000..af445c2 --- /dev/null +++ b/Client/proto/Messages.pb.cc @@ -0,0 +1,726 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Messages.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "Messages.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace Messages { + +namespace { + +const ::google::protobuf::Descriptor* PingRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + PingRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* PingReply_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + PingReply_reflection_ = NULL; +const ::google::protobuf::ServiceDescriptor* PingService_descriptor_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_Messages_2eproto() { + protobuf_AddDesc_Messages_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "Messages.proto"); + GOOGLE_CHECK(file != NULL); + PingRequest_descriptor_ = file->message_type(0); + static const int PingRequest_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, text_), + }; + PingRequest_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + PingRequest_descriptor_, + PingRequest::default_instance_, + PingRequest_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(PingRequest)); + PingReply_descriptor_ = file->message_type(1); + static const int PingReply_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, text_), + }; + PingReply_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + PingReply_descriptor_, + PingReply::default_instance_, + PingReply_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(PingReply)); + PingService_descriptor_ = file->service(0); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_Messages_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + PingRequest_descriptor_, &PingRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + PingReply_descriptor_, &PingReply::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_Messages_2eproto() { + delete PingRequest::default_instance_; + delete PingRequest_reflection_; + delete PingReply::default_instance_; + delete PingReply_reflection_; +} + +void protobuf_AddDesc_Messages_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\016Messages.proto\022\010Messages\"\033\n\013PingReques" + "t\022\014\n\004text\030\001 \001(\t\"\031\n\tPingReply\022\014\n\004text\030\001 \001" + "(\t2v\n\013PingService\0222\n\004Ping\022\025.Messages.Pin" + "gRequest\032\023.Messages.PingReply\0223\n\005Ping2\022\025" + ".Messages.PingRequest\032\023.Messages.PingRep" + "lyB\003\200\001\001", 207); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "Messages.proto", &protobuf_RegisterTypes); + PingRequest::default_instance_ = new PingRequest(); + PingReply::default_instance_ = new PingReply(); + PingRequest::default_instance_->InitAsDefaultInstance(); + PingReply::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Messages_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_Messages_2eproto { + StaticDescriptorInitializer_Messages_2eproto() { + protobuf_AddDesc_Messages_2eproto(); + } +} static_descriptor_initializer_Messages_2eproto_; + +// =================================================================== + +#ifndef _MSC_VER +const int PingRequest::kTextFieldNumber; +#endif // !_MSC_VER + +PingRequest::PingRequest() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Messages.PingRequest) +} + +void PingRequest::InitAsDefaultInstance() { +} + +PingRequest::PingRequest(const PingRequest& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Messages.PingRequest) +} + +void PingRequest::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +PingRequest::~PingRequest() { + // @@protoc_insertion_point(destructor:Messages.PingRequest) + SharedDtor(); +} + +void PingRequest::SharedDtor() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (this != default_instance_) { + } +} + +void PingRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* PingRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingRequest_descriptor_; +} + +const PingRequest& PingRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Messages_2eproto(); + return *default_instance_; +} + +PingRequest* PingRequest::default_instance_ = NULL; + +PingRequest* PingRequest::New() const { + return new PingRequest; +} + +void PingRequest::Clear() { + if (has_text()) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool PingRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:Messages.PingRequest) + 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 text = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_text())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "text"); + } 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::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:Messages.PingRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:Messages.PingRequest) + return false; +#undef DO_ +} + +void PingRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:Messages.PingRequest) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->text(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:Messages.PingRequest) +} + +::google::protobuf::uint8* PingRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:Messages.PingRequest) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->text(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:Messages.PingRequest) + return target; +} + +int PingRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string text = 1; + if (has_text()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->text()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void PingRequest::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const PingRequest* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void PingRequest::MergeFrom(const PingRequest& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_text()) { + set_text(from.text()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void PingRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void PingRequest::CopyFrom(const PingRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool PingRequest::IsInitialized() const { + + return true; +} + +void PingRequest::Swap(PingRequest* other) { + if (other != this) { + std::swap(text_, other->text_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata PingRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = PingRequest_descriptor_; + metadata.reflection = PingRequest_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int PingReply::kTextFieldNumber; +#endif // !_MSC_VER + +PingReply::PingReply() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Messages.PingReply) +} + +void PingReply::InitAsDefaultInstance() { +} + +PingReply::PingReply(const PingReply& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Messages.PingReply) +} + +void PingReply::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +PingReply::~PingReply() { + // @@protoc_insertion_point(destructor:Messages.PingReply) + SharedDtor(); +} + +void PingReply::SharedDtor() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (this != default_instance_) { + } +} + +void PingReply::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* PingReply::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingReply_descriptor_; +} + +const PingReply& PingReply::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Messages_2eproto(); + return *default_instance_; +} + +PingReply* PingReply::default_instance_ = NULL; + +PingReply* PingReply::New() const { + return new PingReply; +} + +void PingReply::Clear() { + if (has_text()) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool PingReply::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:Messages.PingReply) + 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 text = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_text())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "text"); + } 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::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:Messages.PingReply) + return true; +failure: + // @@protoc_insertion_point(parse_failure:Messages.PingReply) + return false; +#undef DO_ +} + +void PingReply::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:Messages.PingReply) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->text(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:Messages.PingReply) +} + +::google::protobuf::uint8* PingReply::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:Messages.PingReply) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->text(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:Messages.PingReply) + return target; +} + +int PingReply::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string text = 1; + if (has_text()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->text()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void PingReply::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const PingReply* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void PingReply::MergeFrom(const PingReply& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_text()) { + set_text(from.text()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void PingReply::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void PingReply::CopyFrom(const PingReply& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool PingReply::IsInitialized() const { + + return true; +} + +void PingReply::Swap(PingReply* other) { + if (other != this) { + std::swap(text_, other->text_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata PingReply::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = PingReply_descriptor_; + metadata.reflection = PingReply_reflection_; + return metadata; +} + + +// =================================================================== + +PingService::~PingService() {} + +const ::google::protobuf::ServiceDescriptor* PingService::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingService_descriptor_; +} + +const ::google::protobuf::ServiceDescriptor* PingService::GetDescriptor() { + protobuf_AssignDescriptorsOnce(); + return PingService_descriptor_; +} + +void PingService::Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest*, + ::Messages::PingReply*, + ::google::protobuf::Closure* done) { + controller->SetFailed("Method Ping() not implemented."); + done->Run(); +} + +void PingService::Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest*, + ::Messages::PingReply*, + ::google::protobuf::Closure* done) { + controller->SetFailed("Method Ping2() not implemented."); + done->Run(); +} + +void PingService::CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done) { + GOOGLE_DCHECK_EQ(method->service(), PingService_descriptor_); + switch(method->index()) { + case 0: + Ping(controller, + ::google::protobuf::down_cast(request), + ::google::protobuf::down_cast< ::Messages::PingReply*>(response), + done); + break; + case 1: + Ping2(controller, + ::google::protobuf::down_cast(request), + ::google::protobuf::down_cast< ::Messages::PingReply*>(response), + done); + break; + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + break; + } +} + +const ::google::protobuf::Message& PingService::GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::Messages::PingRequest::default_instance(); + case 1: + return ::Messages::PingRequest::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *reinterpret_cast< ::google::protobuf::Message*>(NULL); + } +} + +const ::google::protobuf::Message& PingService::GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::Messages::PingReply::default_instance(); + case 1: + return ::Messages::PingReply::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *reinterpret_cast< ::google::protobuf::Message*>(NULL); + } +} + +PingService_Stub::PingService_Stub(::google::protobuf::RpcChannel* channel) + : channel_(channel), owns_channel_(false) {} +PingService_Stub::PingService_Stub( + ::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership) + : channel_(channel), + owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {} +PingService_Stub::~PingService_Stub() { + if (owns_channel_) delete channel_; +} + +void PingService_Stub::Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) { + channel_->CallMethod(descriptor()->method(0), + controller, request, response, done); +} +void PingService_Stub::Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) { + channel_->CallMethod(descriptor()->method(1), + controller, request, response, done); +} + +// @@protoc_insertion_point(namespace_scope) + +} // namespace Messages + +// @@protoc_insertion_point(global_scope) diff --git a/Client/proto/Messages.pb.h b/Client/proto/Messages.pb.h new file mode 100644 index 0000000..74869a8 --- /dev/null +++ b/Client/proto/Messages.pb.h @@ -0,0 +1,454 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Messages.proto + +#ifndef PROTOBUF_Messages_2eproto__INCLUDED +#define PROTOBUF_Messages_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2006000 +#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 2006001 < 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 +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace Messages { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_Messages_2eproto(); +void protobuf_AssignDesc_Messages_2eproto(); +void protobuf_ShutdownFile_Messages_2eproto(); + +class PingRequest; +class PingReply; + +// =================================================================== + +class PingRequest : public ::google::protobuf::Message { + public: + PingRequest(); + virtual ~PingRequest(); + + PingRequest(const PingRequest& from); + + inline PingRequest& operator=(const PingRequest& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const PingRequest& default_instance(); + + void Swap(PingRequest* other); + + // implements Message ---------------------------------------------- + + PingRequest* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const PingRequest& from); + void MergeFrom(const PingRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string text = 1; + inline bool has_text() const; + inline void clear_text(); + static const int kTextFieldNumber = 1; + inline const ::std::string& text() const; + inline void set_text(const ::std::string& value); + inline void set_text(const char* value); + inline void set_text(const char* value, size_t size); + inline ::std::string* mutable_text(); + inline ::std::string* release_text(); + inline void set_allocated_text(::std::string* text); + + // @@protoc_insertion_point(class_scope:Messages.PingRequest) + private: + inline void set_has_text(); + inline void clear_has_text(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* text_; + friend void protobuf_AddDesc_Messages_2eproto(); + friend void protobuf_AssignDesc_Messages_2eproto(); + friend void protobuf_ShutdownFile_Messages_2eproto(); + + void InitAsDefaultInstance(); + static PingRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class PingReply : public ::google::protobuf::Message { + public: + PingReply(); + virtual ~PingReply(); + + PingReply(const PingReply& from); + + inline PingReply& operator=(const PingReply& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const PingReply& default_instance(); + + void Swap(PingReply* other); + + // implements Message ---------------------------------------------- + + PingReply* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const PingReply& from); + void MergeFrom(const PingReply& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string text = 1; + inline bool has_text() const; + inline void clear_text(); + static const int kTextFieldNumber = 1; + inline const ::std::string& text() const; + inline void set_text(const ::std::string& value); + inline void set_text(const char* value); + inline void set_text(const char* value, size_t size); + inline ::std::string* mutable_text(); + inline ::std::string* release_text(); + inline void set_allocated_text(::std::string* text); + + // @@protoc_insertion_point(class_scope:Messages.PingReply) + private: + inline void set_has_text(); + inline void clear_has_text(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* text_; + friend void protobuf_AddDesc_Messages_2eproto(); + friend void protobuf_AssignDesc_Messages_2eproto(); + friend void protobuf_ShutdownFile_Messages_2eproto(); + + void InitAsDefaultInstance(); + static PingReply* default_instance_; +}; +// =================================================================== + +class PingService_Stub; + +class PingService : public ::google::protobuf::Service { + protected: + // This class should be treated as an abstract interface. + inline PingService() {}; + public: + virtual ~PingService(); + + typedef PingService_Stub Stub; + + static const ::google::protobuf::ServiceDescriptor* descriptor(); + + virtual void Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + virtual void Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + + // implements Service ---------------------------------------------- + + const ::google::protobuf::ServiceDescriptor* GetDescriptor(); + void CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done); + const ::google::protobuf::Message& GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const; + const ::google::protobuf::Message& GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PingService); +}; + +class PingService_Stub : public PingService { + public: + PingService_Stub(::google::protobuf::RpcChannel* channel); + PingService_Stub(::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership); + ~PingService_Stub(); + + inline ::google::protobuf::RpcChannel* channel() { return channel_; } + + // implements PingService ------------------------------------------ + + void Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + void Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + private: + ::google::protobuf::RpcChannel* channel_; + bool owns_channel_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PingService_Stub); +}; + + +// =================================================================== + + +// =================================================================== + +// PingRequest + +// optional string text = 1; +inline bool PingRequest::has_text() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void PingRequest::set_has_text() { + _has_bits_[0] |= 0x00000001u; +} +inline void PingRequest::clear_has_text() { + _has_bits_[0] &= ~0x00000001u; +} +inline void PingRequest::clear_text() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + clear_has_text(); +} +inline const ::std::string& PingRequest::text() const { + // @@protoc_insertion_point(field_get:Messages.PingRequest.text) + return *text_; +} +inline void PingRequest::set_text(const ::std::string& value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set:Messages.PingRequest.text) +} +inline void PingRequest::set_text(const char* value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set_char:Messages.PingRequest.text) +} +inline void PingRequest::set_text(const char* value, size_t size) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:Messages.PingRequest.text) +} +inline ::std::string* PingRequest::mutable_text() { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Messages.PingRequest.text) + return text_; +} +inline ::std::string* PingRequest::release_text() { + clear_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = text_; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void PingRequest::set_allocated_text(::std::string* text) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (text) { + set_has_text(); + text_ = text; + } else { + clear_has_text(); + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Messages.PingRequest.text) +} + +// ------------------------------------------------------------------- + +// PingReply + +// optional string text = 1; +inline bool PingReply::has_text() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void PingReply::set_has_text() { + _has_bits_[0] |= 0x00000001u; +} +inline void PingReply::clear_has_text() { + _has_bits_[0] &= ~0x00000001u; +} +inline void PingReply::clear_text() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + clear_has_text(); +} +inline const ::std::string& PingReply::text() const { + // @@protoc_insertion_point(field_get:Messages.PingReply.text) + return *text_; +} +inline void PingReply::set_text(const ::std::string& value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set:Messages.PingReply.text) +} +inline void PingReply::set_text(const char* value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set_char:Messages.PingReply.text) +} +inline void PingReply::set_text(const char* value, size_t size) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:Messages.PingReply.text) +} +inline ::std::string* PingReply::mutable_text() { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Messages.PingReply.text) + return text_; +} +inline ::std::string* PingReply::release_text() { + clear_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = text_; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void PingReply::set_allocated_text(::std::string* text) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (text) { + set_has_text(); + text_ = text; + } else { + clear_has_text(); + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Messages.PingReply.text) +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace Messages + +#ifndef SWIG +namespace google { +namespace protobuf { + + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_Messages_2eproto__INCLUDED diff --git a/Client/proto/reply.pb.cc b/Client/proto/reply.pb.cc deleted file mode 100644 index b0fe172..0000000 --- a/Client/proto/reply.pb.cc +++ /dev/null @@ -1,344 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: reply.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "reply.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -namespace { - -const ::google::protobuf::Descriptor* Reply_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Reply_reflection_ = NULL; - -} // namespace - - -void protobuf_AssignDesc_reply_2eproto() { - protobuf_AddDesc_reply_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "reply.proto"); - GOOGLE_CHECK(file != NULL); - Reply_descriptor_ = file->message_type(0); - static const int Reply_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, text_), - }; - Reply_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Reply_descriptor_, - Reply::default_instance_, - Reply_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Reply)); -} - -namespace { - -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_reply_2eproto); -} - -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Reply_descriptor_, &Reply::default_instance()); -} - -} // namespace - -void protobuf_ShutdownFile_reply_2eproto() { - delete Reply::default_instance_; - delete Reply_reflection_; -} - -void protobuf_AddDesc_reply_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\013reply.proto\022\010Messages\"\025\n\005Reply\022\014\n\004text" - "\030\001 \001(\t", 46); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "reply.proto", &protobuf_RegisterTypes); - Reply::default_instance_ = new Reply(); - Reply::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reply_2eproto); -} - -// Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_reply_2eproto { - StaticDescriptorInitializer_reply_2eproto() { - protobuf_AddDesc_reply_2eproto(); - } -} static_descriptor_initializer_reply_2eproto_; - -// =================================================================== - -#ifndef _MSC_VER -const int Reply::kTextFieldNumber; -#endif // !_MSC_VER - -Reply::Reply() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:Messages.Reply) -} - -void Reply::InitAsDefaultInstance() { -} - -Reply::Reply(const Reply& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:Messages.Reply) -} - -void Reply::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Reply::~Reply() { - // @@protoc_insertion_point(destructor:Messages.Reply) - SharedDtor(); -} - -void Reply::SharedDtor() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (this != default_instance_) { - } -} - -void Reply::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Reply::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Reply_descriptor_; -} - -const Reply& Reply::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reply_2eproto(); - return *default_instance_; -} - -Reply* Reply::default_instance_ = NULL; - -Reply* Reply::New() const { - return new Reply; -} - -void Reply::Clear() { - if (has_text()) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Reply::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:Messages.Reply) - 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 text = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_text())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "text"); - } 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::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:Messages.Reply) - return true; -failure: - // @@protoc_insertion_point(parse_failure:Messages.Reply) - return false; -#undef DO_ -} - -void Reply::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:Messages.Reply) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->text(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:Messages.Reply) -} - -::google::protobuf::uint8* Reply::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:Messages.Reply) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->text(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:Messages.Reply) - return target; -} - -int Reply::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string text = 1; - if (has_text()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->text()); - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Reply::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Reply* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Reply::MergeFrom(const Reply& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_text()) { - set_text(from.text()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Reply::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Reply::CopyFrom(const Reply& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Reply::IsInitialized() const { - - return true; -} - -void Reply::Swap(Reply* other) { - if (other != this) { - std::swap(text_, other->text_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Reply::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Reply_descriptor_; - metadata.reflection = Reply_reflection_; - return metadata; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -// @@protoc_insertion_point(global_scope) diff --git a/Client/proto/reply.pb.h b/Client/proto/reply.pb.h deleted file mode 100644 index 10b15ca..0000000 --- a/Client/proto/reply.pb.h +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: reply.proto - -#ifndef PROTOBUF_reply_2eproto__INCLUDED -#define PROTOBUF_reply_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 2006000 -#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 2006001 < 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 -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_reply_2eproto(); -void protobuf_AssignDesc_reply_2eproto(); -void protobuf_ShutdownFile_reply_2eproto(); - -class Reply; - -// =================================================================== - -class Reply : public ::google::protobuf::Message { - public: - Reply(); - virtual ~Reply(); - - Reply(const Reply& from); - - inline Reply& operator=(const Reply& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Reply& default_instance(); - - void Swap(Reply* other); - - // implements Message ---------------------------------------------- - - Reply* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Reply& from); - void MergeFrom(const Reply& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string text = 1; - inline bool has_text() const; - inline void clear_text(); - static const int kTextFieldNumber = 1; - inline const ::std::string& text() const; - inline void set_text(const ::std::string& value); - inline void set_text(const char* value); - inline void set_text(const char* value, size_t size); - inline ::std::string* mutable_text(); - inline ::std::string* release_text(); - inline void set_allocated_text(::std::string* text); - - // @@protoc_insertion_point(class_scope:Messages.Reply) - private: - inline void set_has_text(); - inline void clear_has_text(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* text_; - friend void protobuf_AddDesc_reply_2eproto(); - friend void protobuf_AssignDesc_reply_2eproto(); - friend void protobuf_ShutdownFile_reply_2eproto(); - - void InitAsDefaultInstance(); - static Reply* default_instance_; -}; -// =================================================================== - - -// =================================================================== - -// Reply - -// optional string text = 1; -inline bool Reply::has_text() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Reply::set_has_text() { - _has_bits_[0] |= 0x00000001u; -} -inline void Reply::clear_has_text() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Reply::clear_text() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - clear_has_text(); -} -inline const ::std::string& Reply::text() const { - // @@protoc_insertion_point(field_get:Messages.Reply.text) - return *text_; -} -inline void Reply::set_text(const ::std::string& value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set:Messages.Reply.text) -} -inline void Reply::set_text(const char* value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set_char:Messages.Reply.text) -} -inline void Reply::set_text(const char* value, size_t size) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:Messages.Reply.text) -} -inline ::std::string* Reply::mutable_text() { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:Messages.Reply.text) - return text_; -} -inline ::std::string* Reply::release_text() { - clear_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = text_; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void Reply::set_allocated_text(::std::string* text) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (text) { - set_has_text(); - text_ = text; - } else { - clear_has_text(); - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:Messages.Reply.text) -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -#ifndef SWIG -namespace google { -namespace protobuf { - - -} // namespace google -} // namespace protobuf -#endif // SWIG - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_reply_2eproto__INCLUDED diff --git a/Client/proto/request.pb.cc b/Client/proto/request.pb.cc deleted file mode 100644 index 73574a5..0000000 --- a/Client/proto/request.pb.cc +++ /dev/null @@ -1,344 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: request.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "request.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -namespace { - -const ::google::protobuf::Descriptor* Request_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Request_reflection_ = NULL; - -} // namespace - - -void protobuf_AssignDesc_request_2eproto() { - protobuf_AddDesc_request_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "request.proto"); - GOOGLE_CHECK(file != NULL); - Request_descriptor_ = file->message_type(0); - static const int Request_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, text_), - }; - Request_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Request_descriptor_, - Request::default_instance_, - Request_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Request)); -} - -namespace { - -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_request_2eproto); -} - -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Request_descriptor_, &Request::default_instance()); -} - -} // namespace - -void protobuf_ShutdownFile_request_2eproto() { - delete Request::default_instance_; - delete Request_reflection_; -} - -void protobuf_AddDesc_request_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\rrequest.proto\022\010Messages\"\027\n\007Request\022\014\n\004" - "text\030\001 \001(\t", 50); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "request.proto", &protobuf_RegisterTypes); - Request::default_instance_ = new Request(); - Request::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_request_2eproto); -} - -// Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_request_2eproto { - StaticDescriptorInitializer_request_2eproto() { - protobuf_AddDesc_request_2eproto(); - } -} static_descriptor_initializer_request_2eproto_; - -// =================================================================== - -#ifndef _MSC_VER -const int Request::kTextFieldNumber; -#endif // !_MSC_VER - -Request::Request() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:Messages.Request) -} - -void Request::InitAsDefaultInstance() { -} - -Request::Request(const Request& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:Messages.Request) -} - -void Request::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Request::~Request() { - // @@protoc_insertion_point(destructor:Messages.Request) - SharedDtor(); -} - -void Request::SharedDtor() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (this != default_instance_) { - } -} - -void Request::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Request::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Request_descriptor_; -} - -const Request& Request::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_request_2eproto(); - return *default_instance_; -} - -Request* Request::default_instance_ = NULL; - -Request* Request::New() const { - return new Request; -} - -void Request::Clear() { - if (has_text()) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Request::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:Messages.Request) - 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 text = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_text())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "text"); - } 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::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:Messages.Request) - return true; -failure: - // @@protoc_insertion_point(parse_failure:Messages.Request) - return false; -#undef DO_ -} - -void Request::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:Messages.Request) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->text(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:Messages.Request) -} - -::google::protobuf::uint8* Request::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:Messages.Request) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->text(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:Messages.Request) - return target; -} - -int Request::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string text = 1; - if (has_text()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->text()); - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Request::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Request* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Request::MergeFrom(const Request& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_text()) { - set_text(from.text()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Request::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Request::CopyFrom(const Request& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Request::IsInitialized() const { - - return true; -} - -void Request::Swap(Request* other) { - if (other != this) { - std::swap(text_, other->text_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Request::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Request_descriptor_; - metadata.reflection = Request_reflection_; - return metadata; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -// @@protoc_insertion_point(global_scope) diff --git a/Client/proto/request.pb.h b/Client/proto/request.pb.h deleted file mode 100644 index cd93583..0000000 --- a/Client/proto/request.pb.h +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: request.proto - -#ifndef PROTOBUF_request_2eproto__INCLUDED -#define PROTOBUF_request_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 2006000 -#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 2006001 < 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 -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_request_2eproto(); -void protobuf_AssignDesc_request_2eproto(); -void protobuf_ShutdownFile_request_2eproto(); - -class Request; - -// =================================================================== - -class Request : public ::google::protobuf::Message { - public: - Request(); - virtual ~Request(); - - Request(const Request& from); - - inline Request& operator=(const Request& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Request& default_instance(); - - void Swap(Request* other); - - // implements Message ---------------------------------------------- - - Request* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Request& from); - void MergeFrom(const Request& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string text = 1; - inline bool has_text() const; - inline void clear_text(); - static const int kTextFieldNumber = 1; - inline const ::std::string& text() const; - inline void set_text(const ::std::string& value); - inline void set_text(const char* value); - inline void set_text(const char* value, size_t size); - inline ::std::string* mutable_text(); - inline ::std::string* release_text(); - inline void set_allocated_text(::std::string* text); - - // @@protoc_insertion_point(class_scope:Messages.Request) - private: - inline void set_has_text(); - inline void clear_has_text(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* text_; - friend void protobuf_AddDesc_request_2eproto(); - friend void protobuf_AssignDesc_request_2eproto(); - friend void protobuf_ShutdownFile_request_2eproto(); - - void InitAsDefaultInstance(); - static Request* default_instance_; -}; -// =================================================================== - - -// =================================================================== - -// Request - -// optional string text = 1; -inline bool Request::has_text() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Request::set_has_text() { - _has_bits_[0] |= 0x00000001u; -} -inline void Request::clear_has_text() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Request::clear_text() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - clear_has_text(); -} -inline const ::std::string& Request::text() const { - // @@protoc_insertion_point(field_get:Messages.Request.text) - return *text_; -} -inline void Request::set_text(const ::std::string& value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set:Messages.Request.text) -} -inline void Request::set_text(const char* value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set_char:Messages.Request.text) -} -inline void Request::set_text(const char* value, size_t size) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:Messages.Request.text) -} -inline ::std::string* Request::mutable_text() { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:Messages.Request.text) - return text_; -} -inline ::std::string* Request::release_text() { - clear_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = text_; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void Request::set_allocated_text(::std::string* text) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (text) { - set_has_text(); - text_ = text; - } else { - clear_has_text(); - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:Messages.Request.text) -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -#ifndef SWIG -namespace google { -namespace protobuf { - - -} // namespace google -} // namespace protobuf -#endif // SWIG - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_request_2eproto__INCLUDED diff --git a/Server/Server.cpp b/Server/Server.cpp index 320422f..881fd12 100644 --- a/Server/Server.cpp +++ b/Server/Server.cpp @@ -1,15 +1,65 @@ #include #include +#include #include -#include "proto/request.pb.h" -#include "proto/reply.pb.h" +#include "proto/Messages.pb.h" + +class MyPingService : public Messages::PingService +{ +public: + void Ping( + ::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) override + { + + } + + void Ping2( + ::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) override + { + + } +}; + +class MyRpcServer +{ +private: + std::shared_ptr m_zmqContext; + std::shared_ptr m_zmqSocket; + + MyPingService m_pingService; + +public: + MyRpcServer(const std::string &bindString) + { + m_zmqContext = std::make_shared(1); + m_zmqSocket = std::make_shared(*m_zmqContext, ZMQ_REQ); + m_zmqSocket->bind(bindString.c_str()); + } + + void Run() + { + while (true) + { + + } + } +}; int main(int argc, char **argv) { std::cout << "Server running" << std::endl; + MyRpcServer server("tcp://*:5555"); + server.Run(); + zmq::context_t context(1); zmq::socket_t socket(context, ZMQ_REP); socket.bind("tcp://*:5555"); @@ -19,12 +69,12 @@ int main(int argc, char **argv) zmq::message_t request; socket.recv(&request); - Messages::Request requestMessage; + Messages::PingRequest requestMessage; requestMessage.ParseFromArray(request.data(), request.size()); std::cout << "Received request: " << requestMessage.text() << std::endl; - Messages::Reply replyMessage; + Messages::PingReply replyMessage; replyMessage.set_text("Hello Client"); zmq::message_t reply(replyMessage.ByteSize()); @@ -33,4 +83,5 @@ int main(int argc, char **argv) } return 0; -} \ No newline at end of file +} + diff --git a/Server/Server.vcxproj b/Server/Server.vcxproj index a6e9f4a..bd3d8ca 100644 --- a/Server/Server.vcxproj +++ b/Server/Server.vcxproj @@ -84,24 +84,14 @@ - - + - + false - Document false - $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) - $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) - proto\%(Filename).pb.h;proto\%(Filename).pb.cc - proto\%(Filename).pb.h;proto\%(Filename).pb.cc - - - false Document - false $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) $(OutDir)\protoc.exe -I=%(RelativeDir) --cpp_out=$(ProjectDir)\proto %(Identity) proto\%(Filename).pb.h;proto\%(Filename).pb.cc @@ -109,8 +99,7 @@ - - + diff --git a/Server/Server.vcxproj.filters b/Server/Server.vcxproj.filters index 72ab9df..9d6091f 100644 --- a/Server/Server.vcxproj.filters +++ b/Server/Server.vcxproj.filters @@ -21,26 +21,17 @@ Source Files - - proto - - + proto - - proto - - + proto - - proto - - + proto diff --git a/Server/proto/Messages.pb.cc b/Server/proto/Messages.pb.cc new file mode 100644 index 0000000..af445c2 --- /dev/null +++ b/Server/proto/Messages.pb.cc @@ -0,0 +1,726 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Messages.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "Messages.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace Messages { + +namespace { + +const ::google::protobuf::Descriptor* PingRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + PingRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* PingReply_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + PingReply_reflection_ = NULL; +const ::google::protobuf::ServiceDescriptor* PingService_descriptor_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_Messages_2eproto() { + protobuf_AddDesc_Messages_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "Messages.proto"); + GOOGLE_CHECK(file != NULL); + PingRequest_descriptor_ = file->message_type(0); + static const int PingRequest_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, text_), + }; + PingRequest_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + PingRequest_descriptor_, + PingRequest::default_instance_, + PingRequest_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingRequest, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(PingRequest)); + PingReply_descriptor_ = file->message_type(1); + static const int PingReply_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, text_), + }; + PingReply_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + PingReply_descriptor_, + PingReply::default_instance_, + PingReply_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(PingReply, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(PingReply)); + PingService_descriptor_ = file->service(0); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_Messages_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + PingRequest_descriptor_, &PingRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + PingReply_descriptor_, &PingReply::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_Messages_2eproto() { + delete PingRequest::default_instance_; + delete PingRequest_reflection_; + delete PingReply::default_instance_; + delete PingReply_reflection_; +} + +void protobuf_AddDesc_Messages_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\016Messages.proto\022\010Messages\"\033\n\013PingReques" + "t\022\014\n\004text\030\001 \001(\t\"\031\n\tPingReply\022\014\n\004text\030\001 \001" + "(\t2v\n\013PingService\0222\n\004Ping\022\025.Messages.Pin" + "gRequest\032\023.Messages.PingReply\0223\n\005Ping2\022\025" + ".Messages.PingRequest\032\023.Messages.PingRep" + "lyB\003\200\001\001", 207); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "Messages.proto", &protobuf_RegisterTypes); + PingRequest::default_instance_ = new PingRequest(); + PingReply::default_instance_ = new PingReply(); + PingRequest::default_instance_->InitAsDefaultInstance(); + PingReply::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Messages_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_Messages_2eproto { + StaticDescriptorInitializer_Messages_2eproto() { + protobuf_AddDesc_Messages_2eproto(); + } +} static_descriptor_initializer_Messages_2eproto_; + +// =================================================================== + +#ifndef _MSC_VER +const int PingRequest::kTextFieldNumber; +#endif // !_MSC_VER + +PingRequest::PingRequest() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Messages.PingRequest) +} + +void PingRequest::InitAsDefaultInstance() { +} + +PingRequest::PingRequest(const PingRequest& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Messages.PingRequest) +} + +void PingRequest::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +PingRequest::~PingRequest() { + // @@protoc_insertion_point(destructor:Messages.PingRequest) + SharedDtor(); +} + +void PingRequest::SharedDtor() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (this != default_instance_) { + } +} + +void PingRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* PingRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingRequest_descriptor_; +} + +const PingRequest& PingRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Messages_2eproto(); + return *default_instance_; +} + +PingRequest* PingRequest::default_instance_ = NULL; + +PingRequest* PingRequest::New() const { + return new PingRequest; +} + +void PingRequest::Clear() { + if (has_text()) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool PingRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:Messages.PingRequest) + 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 text = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_text())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "text"); + } 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::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:Messages.PingRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:Messages.PingRequest) + return false; +#undef DO_ +} + +void PingRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:Messages.PingRequest) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->text(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:Messages.PingRequest) +} + +::google::protobuf::uint8* PingRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:Messages.PingRequest) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->text(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:Messages.PingRequest) + return target; +} + +int PingRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string text = 1; + if (has_text()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->text()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void PingRequest::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const PingRequest* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void PingRequest::MergeFrom(const PingRequest& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_text()) { + set_text(from.text()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void PingRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void PingRequest::CopyFrom(const PingRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool PingRequest::IsInitialized() const { + + return true; +} + +void PingRequest::Swap(PingRequest* other) { + if (other != this) { + std::swap(text_, other->text_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata PingRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = PingRequest_descriptor_; + metadata.reflection = PingRequest_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int PingReply::kTextFieldNumber; +#endif // !_MSC_VER + +PingReply::PingReply() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Messages.PingReply) +} + +void PingReply::InitAsDefaultInstance() { +} + +PingReply::PingReply(const PingReply& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Messages.PingReply) +} + +void PingReply::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +PingReply::~PingReply() { + // @@protoc_insertion_point(destructor:Messages.PingReply) + SharedDtor(); +} + +void PingReply::SharedDtor() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (this != default_instance_) { + } +} + +void PingReply::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* PingReply::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingReply_descriptor_; +} + +const PingReply& PingReply::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Messages_2eproto(); + return *default_instance_; +} + +PingReply* PingReply::default_instance_ = NULL; + +PingReply* PingReply::New() const { + return new PingReply; +} + +void PingReply::Clear() { + if (has_text()) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool PingReply::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:Messages.PingReply) + 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 text = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_text())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "text"); + } 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::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:Messages.PingReply) + return true; +failure: + // @@protoc_insertion_point(parse_failure:Messages.PingReply) + return false; +#undef DO_ +} + +void PingReply::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:Messages.PingReply) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->text(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:Messages.PingReply) +} + +::google::protobuf::uint8* PingReply::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:Messages.PingReply) + // optional string text = 1; + if (has_text()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->text().data(), this->text().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "text"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->text(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:Messages.PingReply) + return target; +} + +int PingReply::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string text = 1; + if (has_text()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->text()); + } + + } + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void PingReply::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const PingReply* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void PingReply::MergeFrom(const PingReply& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_text()) { + set_text(from.text()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void PingReply::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void PingReply::CopyFrom(const PingReply& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool PingReply::IsInitialized() const { + + return true; +} + +void PingReply::Swap(PingReply* other) { + if (other != this) { + std::swap(text_, other->text_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata PingReply::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = PingReply_descriptor_; + metadata.reflection = PingReply_reflection_; + return metadata; +} + + +// =================================================================== + +PingService::~PingService() {} + +const ::google::protobuf::ServiceDescriptor* PingService::descriptor() { + protobuf_AssignDescriptorsOnce(); + return PingService_descriptor_; +} + +const ::google::protobuf::ServiceDescriptor* PingService::GetDescriptor() { + protobuf_AssignDescriptorsOnce(); + return PingService_descriptor_; +} + +void PingService::Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest*, + ::Messages::PingReply*, + ::google::protobuf::Closure* done) { + controller->SetFailed("Method Ping() not implemented."); + done->Run(); +} + +void PingService::Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest*, + ::Messages::PingReply*, + ::google::protobuf::Closure* done) { + controller->SetFailed("Method Ping2() not implemented."); + done->Run(); +} + +void PingService::CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done) { + GOOGLE_DCHECK_EQ(method->service(), PingService_descriptor_); + switch(method->index()) { + case 0: + Ping(controller, + ::google::protobuf::down_cast(request), + ::google::protobuf::down_cast< ::Messages::PingReply*>(response), + done); + break; + case 1: + Ping2(controller, + ::google::protobuf::down_cast(request), + ::google::protobuf::down_cast< ::Messages::PingReply*>(response), + done); + break; + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + break; + } +} + +const ::google::protobuf::Message& PingService::GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::Messages::PingRequest::default_instance(); + case 1: + return ::Messages::PingRequest::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *reinterpret_cast< ::google::protobuf::Message*>(NULL); + } +} + +const ::google::protobuf::Message& PingService::GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const { + GOOGLE_DCHECK_EQ(method->service(), descriptor()); + switch(method->index()) { + case 0: + return ::Messages::PingReply::default_instance(); + case 1: + return ::Messages::PingReply::default_instance(); + default: + GOOGLE_LOG(FATAL) << "Bad method index; this should never happen."; + return *reinterpret_cast< ::google::protobuf::Message*>(NULL); + } +} + +PingService_Stub::PingService_Stub(::google::protobuf::RpcChannel* channel) + : channel_(channel), owns_channel_(false) {} +PingService_Stub::PingService_Stub( + ::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership) + : channel_(channel), + owns_channel_(ownership == ::google::protobuf::Service::STUB_OWNS_CHANNEL) {} +PingService_Stub::~PingService_Stub() { + if (owns_channel_) delete channel_; +} + +void PingService_Stub::Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) { + channel_->CallMethod(descriptor()->method(0), + controller, request, response, done); +} +void PingService_Stub::Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done) { + channel_->CallMethod(descriptor()->method(1), + controller, request, response, done); +} + +// @@protoc_insertion_point(namespace_scope) + +} // namespace Messages + +// @@protoc_insertion_point(global_scope) diff --git a/Server/proto/Messages.pb.h b/Server/proto/Messages.pb.h new file mode 100644 index 0000000..74869a8 --- /dev/null +++ b/Server/proto/Messages.pb.h @@ -0,0 +1,454 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Messages.proto + +#ifndef PROTOBUF_Messages_2eproto__INCLUDED +#define PROTOBUF_Messages_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2006000 +#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 2006001 < 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 +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace Messages { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_Messages_2eproto(); +void protobuf_AssignDesc_Messages_2eproto(); +void protobuf_ShutdownFile_Messages_2eproto(); + +class PingRequest; +class PingReply; + +// =================================================================== + +class PingRequest : public ::google::protobuf::Message { + public: + PingRequest(); + virtual ~PingRequest(); + + PingRequest(const PingRequest& from); + + inline PingRequest& operator=(const PingRequest& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const PingRequest& default_instance(); + + void Swap(PingRequest* other); + + // implements Message ---------------------------------------------- + + PingRequest* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const PingRequest& from); + void MergeFrom(const PingRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string text = 1; + inline bool has_text() const; + inline void clear_text(); + static const int kTextFieldNumber = 1; + inline const ::std::string& text() const; + inline void set_text(const ::std::string& value); + inline void set_text(const char* value); + inline void set_text(const char* value, size_t size); + inline ::std::string* mutable_text(); + inline ::std::string* release_text(); + inline void set_allocated_text(::std::string* text); + + // @@protoc_insertion_point(class_scope:Messages.PingRequest) + private: + inline void set_has_text(); + inline void clear_has_text(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* text_; + friend void protobuf_AddDesc_Messages_2eproto(); + friend void protobuf_AssignDesc_Messages_2eproto(); + friend void protobuf_ShutdownFile_Messages_2eproto(); + + void InitAsDefaultInstance(); + static PingRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class PingReply : public ::google::protobuf::Message { + public: + PingReply(); + virtual ~PingReply(); + + PingReply(const PingReply& from); + + inline PingReply& operator=(const PingReply& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const PingReply& default_instance(); + + void Swap(PingReply* other); + + // implements Message ---------------------------------------------- + + PingReply* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const PingReply& from); + void MergeFrom(const PingReply& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string text = 1; + inline bool has_text() const; + inline void clear_text(); + static const int kTextFieldNumber = 1; + inline const ::std::string& text() const; + inline void set_text(const ::std::string& value); + inline void set_text(const char* value); + inline void set_text(const char* value, size_t size); + inline ::std::string* mutable_text(); + inline ::std::string* release_text(); + inline void set_allocated_text(::std::string* text); + + // @@protoc_insertion_point(class_scope:Messages.PingReply) + private: + inline void set_has_text(); + inline void clear_has_text(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* text_; + friend void protobuf_AddDesc_Messages_2eproto(); + friend void protobuf_AssignDesc_Messages_2eproto(); + friend void protobuf_ShutdownFile_Messages_2eproto(); + + void InitAsDefaultInstance(); + static PingReply* default_instance_; +}; +// =================================================================== + +class PingService_Stub; + +class PingService : public ::google::protobuf::Service { + protected: + // This class should be treated as an abstract interface. + inline PingService() {}; + public: + virtual ~PingService(); + + typedef PingService_Stub Stub; + + static const ::google::protobuf::ServiceDescriptor* descriptor(); + + virtual void Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + virtual void Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + + // implements Service ---------------------------------------------- + + const ::google::protobuf::ServiceDescriptor* GetDescriptor(); + void CallMethod(const ::google::protobuf::MethodDescriptor* method, + ::google::protobuf::RpcController* controller, + const ::google::protobuf::Message* request, + ::google::protobuf::Message* response, + ::google::protobuf::Closure* done); + const ::google::protobuf::Message& GetRequestPrototype( + const ::google::protobuf::MethodDescriptor* method) const; + const ::google::protobuf::Message& GetResponsePrototype( + const ::google::protobuf::MethodDescriptor* method) const; + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PingService); +}; + +class PingService_Stub : public PingService { + public: + PingService_Stub(::google::protobuf::RpcChannel* channel); + PingService_Stub(::google::protobuf::RpcChannel* channel, + ::google::protobuf::Service::ChannelOwnership ownership); + ~PingService_Stub(); + + inline ::google::protobuf::RpcChannel* channel() { return channel_; } + + // implements PingService ------------------------------------------ + + void Ping(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + void Ping2(::google::protobuf::RpcController* controller, + const ::Messages::PingRequest* request, + ::Messages::PingReply* response, + ::google::protobuf::Closure* done); + private: + ::google::protobuf::RpcChannel* channel_; + bool owns_channel_; + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PingService_Stub); +}; + + +// =================================================================== + + +// =================================================================== + +// PingRequest + +// optional string text = 1; +inline bool PingRequest::has_text() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void PingRequest::set_has_text() { + _has_bits_[0] |= 0x00000001u; +} +inline void PingRequest::clear_has_text() { + _has_bits_[0] &= ~0x00000001u; +} +inline void PingRequest::clear_text() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + clear_has_text(); +} +inline const ::std::string& PingRequest::text() const { + // @@protoc_insertion_point(field_get:Messages.PingRequest.text) + return *text_; +} +inline void PingRequest::set_text(const ::std::string& value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set:Messages.PingRequest.text) +} +inline void PingRequest::set_text(const char* value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set_char:Messages.PingRequest.text) +} +inline void PingRequest::set_text(const char* value, size_t size) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:Messages.PingRequest.text) +} +inline ::std::string* PingRequest::mutable_text() { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Messages.PingRequest.text) + return text_; +} +inline ::std::string* PingRequest::release_text() { + clear_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = text_; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void PingRequest::set_allocated_text(::std::string* text) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (text) { + set_has_text(); + text_ = text; + } else { + clear_has_text(); + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Messages.PingRequest.text) +} + +// ------------------------------------------------------------------- + +// PingReply + +// optional string text = 1; +inline bool PingReply::has_text() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void PingReply::set_has_text() { + _has_bits_[0] |= 0x00000001u; +} +inline void PingReply::clear_has_text() { + _has_bits_[0] &= ~0x00000001u; +} +inline void PingReply::clear_text() { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_->clear(); + } + clear_has_text(); +} +inline const ::std::string& PingReply::text() const { + // @@protoc_insertion_point(field_get:Messages.PingReply.text) + return *text_; +} +inline void PingReply::set_text(const ::std::string& value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set:Messages.PingReply.text) +} +inline void PingReply::set_text(const char* value) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(value); + // @@protoc_insertion_point(field_set_char:Messages.PingReply.text) +} +inline void PingReply::set_text(const char* value, size_t size) { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + text_->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:Messages.PingReply.text) +} +inline ::std::string* PingReply::mutable_text() { + set_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + text_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Messages.PingReply.text) + return text_; +} +inline ::std::string* PingReply::release_text() { + clear_has_text(); + if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = text_; + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void PingReply::set_allocated_text(::std::string* text) { + if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete text_; + } + if (text) { + set_has_text(); + text_ = text; + } else { + clear_has_text(); + text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Messages.PingReply.text) +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace Messages + +#ifndef SWIG +namespace google { +namespace protobuf { + + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_Messages_2eproto__INCLUDED diff --git a/Server/proto/reply.pb.cc b/Server/proto/reply.pb.cc deleted file mode 100644 index b0fe172..0000000 --- a/Server/proto/reply.pb.cc +++ /dev/null @@ -1,344 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: reply.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "reply.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -namespace { - -const ::google::protobuf::Descriptor* Reply_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Reply_reflection_ = NULL; - -} // namespace - - -void protobuf_AssignDesc_reply_2eproto() { - protobuf_AddDesc_reply_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "reply.proto"); - GOOGLE_CHECK(file != NULL); - Reply_descriptor_ = file->message_type(0); - static const int Reply_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, text_), - }; - Reply_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Reply_descriptor_, - Reply::default_instance_, - Reply_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Reply, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Reply)); -} - -namespace { - -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_reply_2eproto); -} - -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Reply_descriptor_, &Reply::default_instance()); -} - -} // namespace - -void protobuf_ShutdownFile_reply_2eproto() { - delete Reply::default_instance_; - delete Reply_reflection_; -} - -void protobuf_AddDesc_reply_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\013reply.proto\022\010Messages\"\025\n\005Reply\022\014\n\004text" - "\030\001 \001(\t", 46); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "reply.proto", &protobuf_RegisterTypes); - Reply::default_instance_ = new Reply(); - Reply::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reply_2eproto); -} - -// Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_reply_2eproto { - StaticDescriptorInitializer_reply_2eproto() { - protobuf_AddDesc_reply_2eproto(); - } -} static_descriptor_initializer_reply_2eproto_; - -// =================================================================== - -#ifndef _MSC_VER -const int Reply::kTextFieldNumber; -#endif // !_MSC_VER - -Reply::Reply() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:Messages.Reply) -} - -void Reply::InitAsDefaultInstance() { -} - -Reply::Reply(const Reply& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:Messages.Reply) -} - -void Reply::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Reply::~Reply() { - // @@protoc_insertion_point(destructor:Messages.Reply) - SharedDtor(); -} - -void Reply::SharedDtor() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (this != default_instance_) { - } -} - -void Reply::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Reply::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Reply_descriptor_; -} - -const Reply& Reply::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reply_2eproto(); - return *default_instance_; -} - -Reply* Reply::default_instance_ = NULL; - -Reply* Reply::New() const { - return new Reply; -} - -void Reply::Clear() { - if (has_text()) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Reply::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:Messages.Reply) - 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 text = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_text())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "text"); - } 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::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:Messages.Reply) - return true; -failure: - // @@protoc_insertion_point(parse_failure:Messages.Reply) - return false; -#undef DO_ -} - -void Reply::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:Messages.Reply) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->text(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:Messages.Reply) -} - -::google::protobuf::uint8* Reply::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:Messages.Reply) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->text(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:Messages.Reply) - return target; -} - -int Reply::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string text = 1; - if (has_text()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->text()); - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Reply::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Reply* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Reply::MergeFrom(const Reply& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_text()) { - set_text(from.text()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Reply::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Reply::CopyFrom(const Reply& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Reply::IsInitialized() const { - - return true; -} - -void Reply::Swap(Reply* other) { - if (other != this) { - std::swap(text_, other->text_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Reply::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Reply_descriptor_; - metadata.reflection = Reply_reflection_; - return metadata; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -// @@protoc_insertion_point(global_scope) diff --git a/Server/proto/reply.pb.h b/Server/proto/reply.pb.h deleted file mode 100644 index 10b15ca..0000000 --- a/Server/proto/reply.pb.h +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: reply.proto - -#ifndef PROTOBUF_reply_2eproto__INCLUDED -#define PROTOBUF_reply_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 2006000 -#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 2006001 < 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 -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_reply_2eproto(); -void protobuf_AssignDesc_reply_2eproto(); -void protobuf_ShutdownFile_reply_2eproto(); - -class Reply; - -// =================================================================== - -class Reply : public ::google::protobuf::Message { - public: - Reply(); - virtual ~Reply(); - - Reply(const Reply& from); - - inline Reply& operator=(const Reply& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Reply& default_instance(); - - void Swap(Reply* other); - - // implements Message ---------------------------------------------- - - Reply* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Reply& from); - void MergeFrom(const Reply& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string text = 1; - inline bool has_text() const; - inline void clear_text(); - static const int kTextFieldNumber = 1; - inline const ::std::string& text() const; - inline void set_text(const ::std::string& value); - inline void set_text(const char* value); - inline void set_text(const char* value, size_t size); - inline ::std::string* mutable_text(); - inline ::std::string* release_text(); - inline void set_allocated_text(::std::string* text); - - // @@protoc_insertion_point(class_scope:Messages.Reply) - private: - inline void set_has_text(); - inline void clear_has_text(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* text_; - friend void protobuf_AddDesc_reply_2eproto(); - friend void protobuf_AssignDesc_reply_2eproto(); - friend void protobuf_ShutdownFile_reply_2eproto(); - - void InitAsDefaultInstance(); - static Reply* default_instance_; -}; -// =================================================================== - - -// =================================================================== - -// Reply - -// optional string text = 1; -inline bool Reply::has_text() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Reply::set_has_text() { - _has_bits_[0] |= 0x00000001u; -} -inline void Reply::clear_has_text() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Reply::clear_text() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - clear_has_text(); -} -inline const ::std::string& Reply::text() const { - // @@protoc_insertion_point(field_get:Messages.Reply.text) - return *text_; -} -inline void Reply::set_text(const ::std::string& value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set:Messages.Reply.text) -} -inline void Reply::set_text(const char* value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set_char:Messages.Reply.text) -} -inline void Reply::set_text(const char* value, size_t size) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:Messages.Reply.text) -} -inline ::std::string* Reply::mutable_text() { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:Messages.Reply.text) - return text_; -} -inline ::std::string* Reply::release_text() { - clear_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = text_; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void Reply::set_allocated_text(::std::string* text) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (text) { - set_has_text(); - text_ = text; - } else { - clear_has_text(); - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:Messages.Reply.text) -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -#ifndef SWIG -namespace google { -namespace protobuf { - - -} // namespace google -} // namespace protobuf -#endif // SWIG - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_reply_2eproto__INCLUDED diff --git a/Server/proto/request.pb.cc b/Server/proto/request.pb.cc deleted file mode 100644 index 73574a5..0000000 --- a/Server/proto/request.pb.cc +++ /dev/null @@ -1,344 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: request.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "request.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -namespace { - -const ::google::protobuf::Descriptor* Request_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - Request_reflection_ = NULL; - -} // namespace - - -void protobuf_AssignDesc_request_2eproto() { - protobuf_AddDesc_request_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "request.proto"); - GOOGLE_CHECK(file != NULL); - Request_descriptor_ = file->message_type(0); - static const int Request_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, text_), - }; - Request_reflection_ = - new ::google::protobuf::internal::GeneratedMessageReflection( - Request_descriptor_, - Request::default_instance_, - Request_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _has_bits_[0]), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Request, _unknown_fields_), - -1, - ::google::protobuf::DescriptorPool::generated_pool(), - ::google::protobuf::MessageFactory::generated_factory(), - sizeof(Request)); -} - -namespace { - -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_request_2eproto); -} - -void protobuf_RegisterTypes(const ::std::string&) { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - Request_descriptor_, &Request::default_instance()); -} - -} // namespace - -void protobuf_ShutdownFile_request_2eproto() { - delete Request::default_instance_; - delete Request_reflection_; -} - -void protobuf_AddDesc_request_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\rrequest.proto\022\010Messages\"\027\n\007Request\022\014\n\004" - "text\030\001 \001(\t", 50); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "request.proto", &protobuf_RegisterTypes); - Request::default_instance_ = new Request(); - Request::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_request_2eproto); -} - -// Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_request_2eproto { - StaticDescriptorInitializer_request_2eproto() { - protobuf_AddDesc_request_2eproto(); - } -} static_descriptor_initializer_request_2eproto_; - -// =================================================================== - -#ifndef _MSC_VER -const int Request::kTextFieldNumber; -#endif // !_MSC_VER - -Request::Request() - : ::google::protobuf::Message() { - SharedCtor(); - // @@protoc_insertion_point(constructor:Messages.Request) -} - -void Request::InitAsDefaultInstance() { -} - -Request::Request(const Request& from) - : ::google::protobuf::Message() { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:Messages.Request) -} - -void Request::SharedCtor() { - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); -} - -Request::~Request() { - // @@protoc_insertion_point(destructor:Messages.Request) - SharedDtor(); -} - -void Request::SharedDtor() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (this != default_instance_) { - } -} - -void Request::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* Request::descriptor() { - protobuf_AssignDescriptorsOnce(); - return Request_descriptor_; -} - -const Request& Request::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_request_2eproto(); - return *default_instance_; -} - -Request* Request::default_instance_ = NULL; - -Request* Request::New() const { - return new Request; -} - -void Request::Clear() { - if (has_text()) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - } - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - mutable_unknown_fields()->Clear(); -} - -bool Request::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:Messages.Request) - 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 text = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_text())); - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::PARSE, - "text"); - } 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::WireFormat::SkipField( - input, tag, mutable_unknown_fields())); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:Messages.Request) - return true; -failure: - // @@protoc_insertion_point(parse_failure:Messages.Request) - return false; -#undef DO_ -} - -void Request::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:Messages.Request) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->text(), output); - } - - if (!unknown_fields().empty()) { - ::google::protobuf::internal::WireFormat::SerializeUnknownFields( - unknown_fields(), output); - } - // @@protoc_insertion_point(serialize_end:Messages.Request) -} - -::google::protobuf::uint8* Request::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:Messages.Request) - // optional string text = 1; - if (has_text()) { - ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->text().data(), this->text().length(), - ::google::protobuf::internal::WireFormat::SERIALIZE, - "text"); - target = - ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->text(), target); - } - - if (!unknown_fields().empty()) { - target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( - unknown_fields(), target); - } - // @@protoc_insertion_point(serialize_to_array_end:Messages.Request) - return target; -} - -int Request::ByteSize() const { - int total_size = 0; - - if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { - // optional string text = 1; - if (has_text()) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::StringSize( - this->text()); - } - - } - if (!unknown_fields().empty()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void Request::MergeFrom(const ::google::protobuf::Message& from) { - GOOGLE_CHECK_NE(&from, this); - const Request* source = - ::google::protobuf::internal::dynamic_cast_if_available( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void Request::MergeFrom(const Request& from) { - GOOGLE_CHECK_NE(&from, this); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { - if (from.has_text()) { - set_text(from.text()); - } - } - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); -} - -void Request::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void Request::CopyFrom(const Request& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool Request::IsInitialized() const { - - return true; -} - -void Request::Swap(Request* other) { - if (other != this) { - std::swap(text_, other->text_); - std::swap(_has_bits_[0], other->_has_bits_[0]); - _unknown_fields_.Swap(&other->_unknown_fields_); - std::swap(_cached_size_, other->_cached_size_); - } -} - -::google::protobuf::Metadata Request::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = Request_descriptor_; - metadata.reflection = Request_reflection_; - return metadata; -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -// @@protoc_insertion_point(global_scope) diff --git a/Server/proto/request.pb.h b/Server/proto/request.pb.h deleted file mode 100644 index cd93583..0000000 --- a/Server/proto/request.pb.h +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: request.proto - -#ifndef PROTOBUF_request_2eproto__INCLUDED -#define PROTOBUF_request_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 2006000 -#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 2006001 < 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 -#include -#include -#include -#include -// @@protoc_insertion_point(includes) - -namespace Messages { - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_request_2eproto(); -void protobuf_AssignDesc_request_2eproto(); -void protobuf_ShutdownFile_request_2eproto(); - -class Request; - -// =================================================================== - -class Request : public ::google::protobuf::Message { - public: - Request(); - virtual ~Request(); - - Request(const Request& from); - - inline Request& operator=(const Request& from) { - CopyFrom(from); - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { - return _unknown_fields_; - } - - inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { - return &_unknown_fields_; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const Request& default_instance(); - - void Swap(Request* other); - - // implements Message ---------------------------------------------- - - Request* New() const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const Request& from); - void MergeFrom(const Request& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string text = 1; - inline bool has_text() const; - inline void clear_text(); - static const int kTextFieldNumber = 1; - inline const ::std::string& text() const; - inline void set_text(const ::std::string& value); - inline void set_text(const char* value); - inline void set_text(const char* value, size_t size); - inline ::std::string* mutable_text(); - inline ::std::string* release_text(); - inline void set_allocated_text(::std::string* text); - - // @@protoc_insertion_point(class_scope:Messages.Request) - private: - inline void set_has_text(); - inline void clear_has_text(); - - ::google::protobuf::UnknownFieldSet _unknown_fields_; - - ::google::protobuf::uint32 _has_bits_[1]; - mutable int _cached_size_; - ::std::string* text_; - friend void protobuf_AddDesc_request_2eproto(); - friend void protobuf_AssignDesc_request_2eproto(); - friend void protobuf_ShutdownFile_request_2eproto(); - - void InitAsDefaultInstance(); - static Request* default_instance_; -}; -// =================================================================== - - -// =================================================================== - -// Request - -// optional string text = 1; -inline bool Request::has_text() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void Request::set_has_text() { - _has_bits_[0] |= 0x00000001u; -} -inline void Request::clear_has_text() { - _has_bits_[0] &= ~0x00000001u; -} -inline void Request::clear_text() { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_->clear(); - } - clear_has_text(); -} -inline const ::std::string& Request::text() const { - // @@protoc_insertion_point(field_get:Messages.Request.text) - return *text_; -} -inline void Request::set_text(const ::std::string& value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set:Messages.Request.text) -} -inline void Request::set_text(const char* value) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(value); - // @@protoc_insertion_point(field_set_char:Messages.Request.text) -} -inline void Request::set_text(const char* value, size_t size) { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - text_->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:Messages.Request.text) -} -inline ::std::string* Request::mutable_text() { - set_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - text_ = new ::std::string; - } - // @@protoc_insertion_point(field_mutable:Messages.Request.text) - return text_; -} -inline ::std::string* Request::release_text() { - clear_has_text(); - if (text_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - return NULL; - } else { - ::std::string* temp = text_; - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - return temp; - } -} -inline void Request::set_allocated_text(::std::string* text) { - if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { - delete text_; - } - if (text) { - set_has_text(); - text_ = text; - } else { - clear_has_text(); - text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_set_allocated:Messages.Request.text) -} - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace Messages - -#ifndef SWIG -namespace google { -namespace protobuf { - - -} // namespace google -} // namespace protobuf -#endif // SWIG - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_request_2eproto__INCLUDED diff --git a/proto/Messages.proto b/proto/Messages.proto new file mode 100644 index 0000000..908b298 --- /dev/null +++ b/proto/Messages.proto @@ -0,0 +1,20 @@ + +option cc_generic_services = true; + +package Messages; + +message PingRequest +{ + optional string text = 1; +} + +message PingReply +{ + optional string text = 1; +} + +service PingService +{ + rpc Ping(PingRequest) returns (PingReply); + rpc Ping2(PingRequest) returns (PingReply); +} \ No newline at end of file diff --git a/proto/reply.proto b/proto/reply.proto deleted file mode 100644 index 7256795..0000000 --- a/proto/reply.proto +++ /dev/null @@ -1,7 +0,0 @@ - -package Messages; - -message Reply -{ - optional string text = 1; -} \ No newline at end of file diff --git a/proto/request.proto b/proto/request.proto deleted file mode 100644 index 66b4de6..0000000 --- a/proto/request.proto +++ /dev/null @@ -1,7 +0,0 @@ - -package Messages; - -message Request -{ - optional string text = 1; -}