diff options
author | Patrick Simianer <p@simianer.de> | 2014-08-16 21:29:30 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-08-16 21:29:30 +0100 |
commit | ad6fdf99c86150a0e72c5094d1379b39b83a148d (patch) | |
tree | a19ff1e9be98871d117f81ca2c5ef602ec779c2c /protocol_buffer_map | |
parent | b822f350e3936c2aa16ca73355afee28e6b4454c (diff) |
protocol buffer map
Diffstat (limited to 'protocol_buffer_map')
-rw-r--r-- | protocol_buffer_map/map.pb.cc | 594 | ||||
-rw-r--r-- | protocol_buffer_map/map.pb.h | 361 | ||||
-rw-r--r-- | protocol_buffer_map/map.proto | 9 |
3 files changed, 964 insertions, 0 deletions
diff --git a/protocol_buffer_map/map.pb.cc b/protocol_buffer_map/map.pb.cc new file mode 100644 index 0000000..7b355a2 --- /dev/null +++ b/protocol_buffer_map/map.pb.cc @@ -0,0 +1,594 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: map.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "map.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace { + +const ::google::protobuf::Descriptor* Pair_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Pair_reflection_ = NULL; +const ::google::protobuf::Descriptor* Map_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Map_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_map_2eproto() { + protobuf_AddDesc_map_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "map.proto"); + GOOGLE_CHECK(file != NULL); + Pair_descriptor_ = file->message_type(0); + static const int Pair_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Pair, key_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Pair, value_), + }; + Pair_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + Pair_descriptor_, + Pair::default_instance_, + Pair_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Pair, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Pair, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(Pair)); + Map_descriptor_ = file->message_type(1); + static const int Map_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Map, pairs_), + }; + Map_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + Map_descriptor_, + Map::default_instance_, + Map_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Map, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Map, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(Map)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_map_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Pair_descriptor_, &Pair::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Map_descriptor_, &Map::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_map_2eproto() { + delete Pair::default_instance_; + delete Pair_reflection_; + delete Map::default_instance_; + delete Map_reflection_; +} + +void protobuf_AddDesc_map_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\tmap.proto\"\"\n\004Pair\022\013\n\003key\030\001 \002(\t\022\r\n\005valu" + "e\030\002 \002(\005\"\033\n\003Map\022\024\n\005pairs\030\001 \003(\0132\005.Pair", 76); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "map.proto", &protobuf_RegisterTypes); + Pair::default_instance_ = new Pair(); + Map::default_instance_ = new Map(); + Pair::default_instance_->InitAsDefaultInstance(); + Map::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_map_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_map_2eproto { + StaticDescriptorInitializer_map_2eproto() { + protobuf_AddDesc_map_2eproto(); + } +} static_descriptor_initializer_map_2eproto_; + +// =================================================================== + +#ifndef _MSC_VER +const int Pair::kKeyFieldNumber; +const int Pair::kValueFieldNumber; +#endif // !_MSC_VER + +Pair::Pair() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void Pair::InitAsDefaultInstance() { +} + +Pair::Pair(const Pair& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void Pair::SharedCtor() { + _cached_size_ = 0; + key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +Pair::~Pair() { + SharedDtor(); +} + +void Pair::SharedDtor() { + if (key_ != &::google::protobuf::internal::kEmptyString) { + delete key_; + } + if (this != default_instance_) { + } +} + +void Pair::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Pair::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Pair_descriptor_; +} + +const Pair& Pair::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_map_2eproto(); + return *default_instance_; +} + +Pair* Pair::default_instance_ = NULL; + +Pair* Pair::New() const { + return new Pair; +} + +void Pair::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_key()) { + if (key_ != &::google::protobuf::internal::kEmptyString) { + key_->clear(); + } + } + value_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool Pair::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string key = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_key())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->key().data(), this->key().length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_value; + break; + } + + // required int32 value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &value_))); + set_has_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void Pair::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string key = 1; + if (has_key()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->key().data(), this->key().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->key(), output); + } + + // required int32 value = 2; + if (has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->value(), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* Pair::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // required string key = 1; + if (has_key()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->key().data(), this->key().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->key(), target); + } + + // required int32 value = 2; + if (has_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->value(), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int Pair::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string key = 1; + if (has_key()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->key()); + } + + // required int32 value = 2; + if (has_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->value()); + } + + } + 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 Pair::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const Pair* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Pair*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Pair::MergeFrom(const Pair& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_key()) { + set_key(from.key()); + } + if (from.has_value()) { + set_value(from.value()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void Pair::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Pair::CopyFrom(const Pair& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Pair::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void Pair::Swap(Pair* other) { + if (other != this) { + std::swap(key_, other->key_); + std::swap(value_, other->value_); + 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 Pair::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Pair_descriptor_; + metadata.reflection = Pair_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int Map::kPairsFieldNumber; +#endif // !_MSC_VER + +Map::Map() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void Map::InitAsDefaultInstance() { +} + +Map::Map(const Map& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void Map::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +Map::~Map() { + SharedDtor(); +} + +void Map::SharedDtor() { + if (this != default_instance_) { + } +} + +void Map::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Map::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Map_descriptor_; +} + +const Map& Map::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_map_2eproto(); + return *default_instance_; +} + +Map* Map::default_instance_ = NULL; + +Map* Map::New() const { + return new Map; +} + +void Map::Clear() { + pairs_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool Map::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .Pair pairs = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_pairs: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_pairs())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_pairs; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void Map::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .Pair pairs = 1; + for (int i = 0; i < this->pairs_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->pairs(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* Map::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated .Pair pairs = 1; + for (int i = 0; i < this->pairs_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->pairs(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int Map::ByteSize() const { + int total_size = 0; + + // repeated .Pair pairs = 1; + total_size += 1 * this->pairs_size(); + for (int i = 0; i < this->pairs_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->pairs(i)); + } + + 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 Map::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const Map* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Map*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Map::MergeFrom(const Map& from) { + GOOGLE_CHECK_NE(&from, this); + pairs_.MergeFrom(from.pairs_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void Map::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Map::CopyFrom(const Map& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Map::IsInitialized() const { + + for (int i = 0; i < pairs_size(); i++) { + if (!this->pairs(i).IsInitialized()) return false; + } + return true; +} + +void Map::Swap(Map* other) { + if (other != this) { + pairs_.Swap(&other->pairs_); + 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 Map::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Map_descriptor_; + metadata.reflection = Map_reflection_; + return metadata; +} + + +// @@protoc_insertion_point(namespace_scope) + +// @@protoc_insertion_point(global_scope) diff --git a/protocol_buffer_map/map.pb.h b/protocol_buffer_map/map.pb.h new file mode 100644 index 0000000..c47e03c --- /dev/null +++ b/protocol_buffer_map/map.pb.h @@ -0,0 +1,361 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: map.proto + +#ifndef PROTOBUF_map_2eproto__INCLUDED +#define PROTOBUF_map_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 2005000 +#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 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_map_2eproto(); +void protobuf_AssignDesc_map_2eproto(); +void protobuf_ShutdownFile_map_2eproto(); + +class Pair; +class Map; + +// =================================================================== + +class Pair : public ::google::protobuf::Message { + public: + Pair(); + virtual ~Pair(); + + Pair(const Pair& from); + + inline Pair& operator=(const Pair& 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 Pair& default_instance(); + + void Swap(Pair* other); + + // implements Message ---------------------------------------------- + + Pair* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Pair& from); + void MergeFrom(const Pair& 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 ------------------------------------------------------- + + // required string key = 1; + inline bool has_key() const; + inline void clear_key(); + static const int kKeyFieldNumber = 1; + inline const ::std::string& key() const; + inline void set_key(const ::std::string& value); + inline void set_key(const char* value); + inline void set_key(const char* value, size_t size); + inline ::std::string* mutable_key(); + inline ::std::string* release_key(); + inline void set_allocated_key(::std::string* key); + + // required int32 value = 2; + inline bool has_value() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline ::google::protobuf::int32 value() const; + inline void set_value(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:Pair) + private: + inline void set_has_key(); + inline void clear_has_key(); + inline void set_has_value(); + inline void clear_has_value(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::std::string* key_; + ::google::protobuf::int32 value_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_map_2eproto(); + friend void protobuf_AssignDesc_map_2eproto(); + friend void protobuf_ShutdownFile_map_2eproto(); + + void InitAsDefaultInstance(); + static Pair* default_instance_; +}; +// ------------------------------------------------------------------- + +class Map : public ::google::protobuf::Message { + public: + Map(); + virtual ~Map(); + + Map(const Map& from); + + inline Map& operator=(const Map& 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 Map& default_instance(); + + void Swap(Map* other); + + // implements Message ---------------------------------------------- + + Map* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Map& from); + void MergeFrom(const Map& 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 ------------------------------------------------------- + + // repeated .Pair pairs = 1; + inline int pairs_size() const; + inline void clear_pairs(); + static const int kPairsFieldNumber = 1; + inline const ::Pair& pairs(int index) const; + inline ::Pair* mutable_pairs(int index); + inline ::Pair* add_pairs(); + inline const ::google::protobuf::RepeatedPtrField< ::Pair >& + pairs() const; + inline ::google::protobuf::RepeatedPtrField< ::Pair >* + mutable_pairs(); + + // @@protoc_insertion_point(class_scope:Map) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::Pair > pairs_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_map_2eproto(); + friend void protobuf_AssignDesc_map_2eproto(); + friend void protobuf_ShutdownFile_map_2eproto(); + + void InitAsDefaultInstance(); + static Map* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// Pair + +// required string key = 1; +inline bool Pair::has_key() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void Pair::set_has_key() { + _has_bits_[0] |= 0x00000001u; +} +inline void Pair::clear_has_key() { + _has_bits_[0] &= ~0x00000001u; +} +inline void Pair::clear_key() { + if (key_ != &::google::protobuf::internal::kEmptyString) { + key_->clear(); + } + clear_has_key(); +} +inline const ::std::string& Pair::key() const { + return *key_; +} +inline void Pair::set_key(const ::std::string& value) { + set_has_key(); + if (key_ == &::google::protobuf::internal::kEmptyString) { + key_ = new ::std::string; + } + key_->assign(value); +} +inline void Pair::set_key(const char* value) { + set_has_key(); + if (key_ == &::google::protobuf::internal::kEmptyString) { + key_ = new ::std::string; + } + key_->assign(value); +} +inline void Pair::set_key(const char* value, size_t size) { + set_has_key(); + if (key_ == &::google::protobuf::internal::kEmptyString) { + key_ = new ::std::string; + } + key_->assign(reinterpret_cast<const char*>(value), size); +} +inline ::std::string* Pair::mutable_key() { + set_has_key(); + if (key_ == &::google::protobuf::internal::kEmptyString) { + key_ = new ::std::string; + } + return key_; +} +inline ::std::string* Pair::release_key() { + clear_has_key(); + if (key_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = key_; + key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} +inline void Pair::set_allocated_key(::std::string* key) { + if (key_ != &::google::protobuf::internal::kEmptyString) { + delete key_; + } + if (key) { + set_has_key(); + key_ = key; + } else { + clear_has_key(); + key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + } +} + +// required int32 value = 2; +inline bool Pair::has_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void Pair::set_has_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void Pair::clear_has_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void Pair::clear_value() { + value_ = 0; + clear_has_value(); +} +inline ::google::protobuf::int32 Pair::value() const { + return value_; +} +inline void Pair::set_value(::google::protobuf::int32 value) { + set_has_value(); + value_ = value; +} + +// ------------------------------------------------------------------- + +// Map + +// repeated .Pair pairs = 1; +inline int Map::pairs_size() const { + return pairs_.size(); +} +inline void Map::clear_pairs() { + pairs_.Clear(); +} +inline const ::Pair& Map::pairs(int index) const { + return pairs_.Get(index); +} +inline ::Pair* Map::mutable_pairs(int index) { + return pairs_.Mutable(index); +} +inline ::Pair* Map::add_pairs() { + return pairs_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::Pair >& +Map::pairs() const { + return pairs_; +} +inline ::google::protobuf::RepeatedPtrField< ::Pair >* +Map::mutable_pairs() { + return &pairs_; +} + + +// @@protoc_insertion_point(namespace_scope) + +#ifndef SWIG +namespace google { +namespace protobuf { + + +} // namespace google +} // namespace protobuf +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_map_2eproto__INCLUDED diff --git a/protocol_buffer_map/map.proto b/protocol_buffer_map/map.proto new file mode 100644 index 0000000..f794682 --- /dev/null +++ b/protocol_buffer_map/map.proto @@ -0,0 +1,9 @@ +message Pair { + required string key = 1; + required int32 value = 2; +} + +message Map { + repeated Pair pairs = 1; +} + |