diff --git a/setup.py b/setup.py index e2a6a2c..f4f5c7b 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ Extension( 'annoy.annoylib', ['src/annoymodule.cc', 'src/protobuf/annoy.pb.cc'], depends=['src/annoylib.h', 'src/lmdbforest.h', 'src/protobuf/annoy.pb.h'], - include_dirs=['src', '/usr/loca/include', '/opt/local/include', '/usr/local/Cellar/protobuf/2.6.0/include/'], + include_dirs=['src', '/usr/local/include', '/opt/local/include', '/usr/local/Cellar/protobuf/2.6.0/include/'], extra_compile_args=['-O3', '-march=native', '-ffast-math'], libraries = ["lmdb", "protobuf"] ) diff --git a/src/protobuf/annoy.pb.cc b/src/protobuf/annoy.pb.cc index 715575d..9cd5b7a 100644 --- a/src/protobuf/annoy.pb.cc +++ b/src/protobuf/annoy.pb.cc @@ -1,12 +1,13 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: protobuf/annoy.proto +// source: annoy.proto #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "protobuf/annoy.pb.h" +#include "annoy.pb.h" #include #include +#include #include #include #include @@ -15,158 +16,166 @@ #include #include // @@protoc_insertion_point(includes) +class data_infoDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed { +} _data_info_default_instance_; +class tree_nodeDefaultTypeInternal : public ::google::protobuf::internal::ExplicitlyConstructed { +} _tree_node_default_instance_; + +namespace protobuf_annoy_2eproto { + namespace { -const ::google::protobuf::Descriptor* data_info_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - data_info_reflection_ = NULL; -const ::google::protobuf::Descriptor* tree_node_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - tree_node_reflection_ = NULL; +::google::protobuf::Metadata file_level_metadata[2]; } // namespace - -void protobuf_AssignDesc_protobuf_2fannoy_2eproto() { - protobuf_AddDesc_protobuf_2fannoy_2eproto(); - const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "protobuf/annoy.proto"); - GOOGLE_CHECK(file != NULL); - data_info_descriptor_ = file->message_type(0); - static const int data_info_offsets_[3] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, data_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, id_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, category_), - }; - data_info_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - data_info_descriptor_, - data_info::default_instance_, - data_info_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, _has_bits_[0]), - -1, - -1, - sizeof(data_info), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, _internal_metadata_), - -1); - tree_node_descriptor_ = file->message_type(1); - static const int tree_node_offsets_[7] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, index_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, leaf_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, left_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, right_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, items_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, v_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, t_), - }; - tree_node_reflection_ = - ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - tree_node_descriptor_, - tree_node::default_instance_, - tree_node_offsets_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, _has_bits_[0]), - -1, - -1, - sizeof(tree_node), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, _internal_metadata_), - -1); -} +const ::google::protobuf::uint32 TableStruct::offsets[] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, data_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(data_info, category_), + ~0u, + 0, + 1, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, index_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, leaf_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, left_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, right_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, items_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, v_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(tree_node, t_), + 0, + 1, + 2, + 3, + ~0u, + ~0u, + 4, +}; + +static const ::google::protobuf::internal::MigrationSchema schemas[] = { + { 0, 7, sizeof(data_info)}, + { 10, 21, sizeof(tree_node)}, +}; + +static ::google::protobuf::Message const * const file_default_instances[] = { + reinterpret_cast(&_data_info_default_instance_), + reinterpret_cast(&_tree_node_default_instance_), +}; namespace { -GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); -inline void protobuf_AssignDescriptorsOnce() { - ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_protobuf_2fannoy_2eproto); +void protobuf_AssignDescriptors() { + AddDescriptors(); + ::google::protobuf::MessageFactory* factory = NULL; + AssignDescriptors( + "annoy.proto", schemas, file_default_instances, TableStruct::offsets, factory, + file_level_metadata, NULL, NULL); } +void protobuf_AssignDescriptorsOnce() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); +} + +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - data_info_descriptor_, &data_info::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - tree_node_descriptor_, &tree_node::default_instance()); + ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2); } } // namespace -void protobuf_ShutdownFile_protobuf_2fannoy_2eproto() { - delete data_info::default_instance_; - delete data_info_reflection_; - delete tree_node::default_instance_; - delete tree_node_reflection_; +void TableStruct::Shutdown() { + _data_info_default_instance_.Shutdown(); + delete file_level_metadata[0].reflection; + _tree_node_default_instance_.Shutdown(); + delete file_level_metadata[1].reflection; } -void protobuf_AddDesc_protobuf_2fannoy_2eproto() { - static bool already_here = false; - if (already_here) return; - already_here = true; +void TableStruct::InitDefaultsImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; + ::google::protobuf::internal::InitProtobufDefaults(); + _data_info_default_instance_.DefaultConstruct(); + _tree_node_default_instance_.DefaultConstruct(); +} + +void InitDefaults() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); +} +void AddDescriptorsImpl() { + InitDefaults(); + static const char descriptor[] = { + "\n\013annoy.proto\";\n\tdata_info\022\020\n\004data\030\001 \003(\002" + "B\002\020\001\022\n\n\002id\030\002 \001(\r\022\020\n\010category\030\003 \001(\r\"n\n\ttr" + "ee_node\022\r\n\005index\030\001 \002(\r\022\014\n\004leaf\030\002 \002(\010\022\014\n\004" + "left\030\003 \001(\r\022\r\n\005right\030\004 \001(\r\022\r\n\005items\030\005 \003(\r" + "\022\r\n\001v\030\006 \003(\002B\002\020\001\022\t\n\001t\030\007 \001(\002" + }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\024protobuf/annoy.proto\";\n\tdata_info\022\020\n\004d" - "ata\030\001 \003(\002B\002\020\001\022\n\n\002id\030\002 \001(\r\022\020\n\010category\030\003 " - "\001(\r\"n\n\ttree_node\022\r\n\005index\030\001 \002(\r\022\014\n\004leaf\030" - "\002 \002(\010\022\014\n\004left\030\003 \001(\r\022\r\n\005right\030\004 \001(\r\022\r\n\005it" - "ems\030\005 \003(\r\022\r\n\001v\030\006 \003(\002B\002\020\001\022\t\n\001t\030\007 \001(\002", 195); + descriptor, 186); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "protobuf/annoy.proto", &protobuf_RegisterTypes); - data_info::default_instance_ = new data_info(); - tree_node::default_instance_ = new tree_node(); - data_info::default_instance_->InitAsDefaultInstance(); - tree_node::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_protobuf_2fannoy_2eproto); + "annoy.proto", &protobuf_RegisterTypes); + ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown); } +void AddDescriptors() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); +} // Force AddDescriptors() to be called at static initialization time. -struct StaticDescriptorInitializer_protobuf_2fannoy_2eproto { - StaticDescriptorInitializer_protobuf_2fannoy_2eproto() { - protobuf_AddDesc_protobuf_2fannoy_2eproto(); +struct StaticDescriptorInitializer { + StaticDescriptorInitializer() { + AddDescriptors(); } -} static_descriptor_initializer_protobuf_2fannoy_2eproto_; - -namespace { - -static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; -static void MergeFromFail(int line) { - GOOGLE_CHECK(false) << __FILE__ << ":" << line; -} +} static_descriptor_initializer; -} // namespace +} // namespace protobuf_annoy_2eproto // =================================================================== -#ifndef _MSC_VER +#if !defined(_MSC_VER) || _MSC_VER >= 1900 const int data_info::kDataFieldNumber; const int data_info::kIdFieldNumber; const int data_info::kCategoryFieldNumber; -#endif // !_MSC_VER +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 data_info::data_info() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_annoy_2eproto::InitDefaults(); + } SharedCtor(); // @@protoc_insertion_point(constructor:data_info) } - -void data_info::InitAsDefaultInstance() { -} - data_info::data_info(const data_info& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); + _internal_metadata_(NULL), + _has_bits_(from._has_bits_), + _cached_size_(0), + data_(from.data_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&id_, &from.id_, + reinterpret_cast(&category_) - + reinterpret_cast(&id_) + sizeof(category_)); // @@protoc_insertion_point(copy_constructor:data_info) } void data_info::SharedCtor() { _cached_size_ = 0; - id_ = 0u; - category_ = 0u; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); + ::memset(&id_, 0, reinterpret_cast(&category_) - + reinterpret_cast(&id_) + sizeof(category_)); } data_info::~data_info() { @@ -175,8 +184,6 @@ data_info::~data_info() { } void data_info::SharedDtor() { - if (this != default_instance_) { - } } void data_info::SetCachedSize(int size) const { @@ -185,17 +192,15 @@ void data_info::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* data_info::descriptor() { - protobuf_AssignDescriptorsOnce(); - return data_info_descriptor_; + protobuf_annoy_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_annoy_2eproto::file_level_metadata[0].descriptor; } const data_info& data_info::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_protobuf_2fannoy_2eproto(); - return *default_instance_; + protobuf_annoy_2eproto::InitDefaults(); + return *internal_default_instance(); } -data_info* data_info::default_instance_ = NULL; - data_info* data_info::New(::google::protobuf::Arena* arena) const { data_info* n = new data_info; if (arena != NULL) { @@ -205,80 +210,65 @@ data_info* data_info::New(::google::protobuf::Arena* arena) const { } void data_info::Clear() { -#define ZR_HELPER_(f) reinterpret_cast(\ - &reinterpret_cast(16)->f) - -#define ZR_(first, last) do {\ - ::memset(&first, 0,\ - ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ -} while (0) - - ZR_(id_, category_); - -#undef ZR_HELPER_ -#undef ZR_ - +// @@protoc_insertion_point(message_clear_start:data_info) data_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - if (_internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->Clear(); + if (_has_bits_[0 / 32] & 3u) { + ::memset(&id_, 0, reinterpret_cast(&category_) - + reinterpret_cast(&id_) + sizeof(category_)); } + _has_bits_.Clear(); + _internal_metadata_.Clear(); } bool data_info::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:data_info) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // repeated float data = 1 [packed = true]; case 1: { - if (tag == 10) { + if (tag == 10u) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( input, this->mutable_data()))); - } else if (tag == 13) { + } else if (tag == 13u) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - 1, 10, input, this->mutable_data()))); + 1, 10u, input, this->mutable_data()))); } else { goto handle_unusual; } - if (input->ExpectTag(16)) goto parse_id; break; } // optional uint32 id = 2; case 2: { - if (tag == 16) { - parse_id: + if (tag == 16u) { + set_has_id(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, &id_))); - set_has_id(); } else { goto handle_unusual; } - if (input->ExpectTag(24)) goto parse_category; break; } // optional uint32 category = 3; case 3: { - if (tag == 24) { - parse_category: + if (tag == 24u) { + set_has_category(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, &category_))); - set_has_category(); } else { goto handle_unusual; } - if (input->ExpectAtEnd()) goto success; break; } @@ -311,10 +301,8 @@ void data_info::SerializeWithCachedSizes( if (this->data_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); output->WriteVarint32(_data_cached_byte_size_); - } - for (int i = 0; i < this->data_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteFloatNoTag( - this->data(i), output); + ::google::protobuf::internal::WireFormatLite::WriteFloatArray( + this->data().data(), this->data_size(), output); } // optional uint32 id = 2; @@ -334,8 +322,9 @@ void data_info::SerializeWithCachedSizes( // @@protoc_insertion_point(serialize_end:data_info) } -::google::protobuf::uint8* data_info::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { +::google::protobuf::uint8* data_info::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:data_info) // repeated float data = 1 [packed = true]; if (this->data_size() > 0) { @@ -369,10 +358,31 @@ ::google::protobuf::uint8* data_info::SerializeWithCachedSizesToArray( return target; } -int data_info::ByteSize() const { - int total_size = 0; +size_t data_info::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:data_info) + size_t total_size = 0; + + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + // repeated float data = 1 [packed = true]; + { + unsigned int count = this->data_size(); + size_t data_size = 4UL * count; + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _data_cached_byte_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } - if (_has_bits_[1 / 32] & 6u) { + if (_has_bits_[0 / 32] & 3u) { // optional uint32 id = 2; if (has_id()) { total_size += 1 + @@ -388,47 +398,34 @@ int data_info::ByteSize() const { } } - // repeated float data = 1 [packed = true]; - { - int data_size = 0; - data_size = 4 * this->data_size(); - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _data_cached_byte_size_ = data_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; - } - - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void data_info::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const data_info* source = +// @@protoc_insertion_point(generalized_merge_from_start:data_info) + GOOGLE_DCHECK_NE(&from, this); + const data_info* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:data_info) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:data_info) MergeFrom(*source); } } void data_info::MergeFrom(const data_info& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); +// @@protoc_insertion_point(class_specific_merge_from_start:data_info) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); data_.MergeFrom(from.data_); - if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from._has_bits_[0 / 32] & 3u) { if (from.has_id()) { set_id(from.id()); } @@ -436,25 +433,23 @@ void data_info::MergeFrom(const data_info& from) { set_category(from.category()); } } - if (from._internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); - } } void data_info::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:data_info) if (&from == this) return; Clear(); MergeFrom(from); } void data_info::CopyFrom(const data_info& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:data_info) if (&from == this) return; Clear(); MergeFrom(from); } bool data_info::IsInitialized() const { - return true; } @@ -472,11 +467,8 @@ void data_info::InternalSwap(data_info* other) { } ::google::protobuf::Metadata data_info::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = data_info_descriptor_; - metadata.reflection = data_info_reflection_; - return metadata; + protobuf_annoy_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_annoy_2eproto::file_level_metadata[0]; } #if PROTOBUF_INLINE_NOT_IN_HEADERS @@ -489,24 +481,24 @@ int data_info::data_size() const { void data_info::clear_data() { data_.Clear(); } - float data_info::data(int index) const { +float data_info::data(int index) const { // @@protoc_insertion_point(field_get:data_info.data) return data_.Get(index); } - void data_info::set_data(int index, float value) { +void data_info::set_data(int index, float value) { data_.Set(index, value); // @@protoc_insertion_point(field_set:data_info.data) } - void data_info::add_data(float value) { +void data_info::add_data(float value) { data_.Add(value); // @@protoc_insertion_point(field_add:data_info.data) } - const ::google::protobuf::RepeatedField< float >& +const ::google::protobuf::RepeatedField< float >& data_info::data() const { // @@protoc_insertion_point(field_list:data_info.data) return data_; } - ::google::protobuf::RepeatedField< float >* +::google::protobuf::RepeatedField< float >* data_info::mutable_data() { // @@protoc_insertion_point(field_mutable_list:data_info.data) return &data_; @@ -514,23 +506,23 @@ data_info::mutable_data() { // optional uint32 id = 2; bool data_info::has_id() const { - return (_has_bits_[0] & 0x00000002u) != 0; + return (_has_bits_[0] & 0x00000001u) != 0; } void data_info::set_has_id() { - _has_bits_[0] |= 0x00000002u; + _has_bits_[0] |= 0x00000001u; } void data_info::clear_has_id() { - _has_bits_[0] &= ~0x00000002u; + _has_bits_[0] &= ~0x00000001u; } void data_info::clear_id() { id_ = 0u; clear_has_id(); } - ::google::protobuf::uint32 data_info::id() const { +::google::protobuf::uint32 data_info::id() const { // @@protoc_insertion_point(field_get:data_info.id) return id_; } - void data_info::set_id(::google::protobuf::uint32 value) { +void data_info::set_id(::google::protobuf::uint32 value) { set_has_id(); id_ = value; // @@protoc_insertion_point(field_set:data_info.id) @@ -538,23 +530,23 @@ void data_info::clear_id() { // optional uint32 category = 3; bool data_info::has_category() const { - return (_has_bits_[0] & 0x00000004u) != 0; + return (_has_bits_[0] & 0x00000002u) != 0; } void data_info::set_has_category() { - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000002u; } void data_info::clear_has_category() { - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000002u; } void data_info::clear_category() { category_ = 0u; clear_has_category(); } - ::google::protobuf::uint32 data_info::category() const { +::google::protobuf::uint32 data_info::category() const { // @@protoc_insertion_point(field_get:data_info.category) return category_; } - void data_info::set_category(::google::protobuf::uint32 value) { +void data_info::set_category(::google::protobuf::uint32 value) { set_has_category(); category_ = value; // @@protoc_insertion_point(field_set:data_info.category) @@ -564,7 +556,7 @@ void data_info::clear_category() { // =================================================================== -#ifndef _MSC_VER +#if !defined(_MSC_VER) || _MSC_VER >= 1900 const int tree_node::kIndexFieldNumber; const int tree_node::kLeafFieldNumber; const int tree_node::kLeftFieldNumber; @@ -572,33 +564,34 @@ const int tree_node::kRightFieldNumber; const int tree_node::kItemsFieldNumber; const int tree_node::kVFieldNumber; const int tree_node::kTFieldNumber; -#endif // !_MSC_VER +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 tree_node::tree_node() : ::google::protobuf::Message(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_annoy_2eproto::InitDefaults(); + } SharedCtor(); // @@protoc_insertion_point(constructor:tree_node) } - -void tree_node::InitAsDefaultInstance() { -} - tree_node::tree_node(const tree_node& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); + _internal_metadata_(NULL), + _has_bits_(from._has_bits_), + _cached_size_(0), + items_(from.items_), + v_(from.v_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&index_, &from.index_, + reinterpret_cast(&t_) - + reinterpret_cast(&index_) + sizeof(t_)); // @@protoc_insertion_point(copy_constructor:tree_node) } void tree_node::SharedCtor() { _cached_size_ = 0; - index_ = 0u; - leaf_ = false; - left_ = 0u; - right_ = 0u; - t_ = 0; - ::memset(_has_bits_, 0, sizeof(_has_bits_)); + ::memset(&index_, 0, reinterpret_cast(&t_) - + reinterpret_cast(&index_) + sizeof(t_)); } tree_node::~tree_node() { @@ -607,8 +600,6 @@ tree_node::~tree_node() { } void tree_node::SharedDtor() { - if (this != default_instance_) { - } } void tree_node::SetCachedSize(int size) const { @@ -617,17 +608,15 @@ void tree_node::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* tree_node::descriptor() { - protobuf_AssignDescriptorsOnce(); - return tree_node_descriptor_; + protobuf_annoy_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_annoy_2eproto::file_level_metadata[1].descriptor; } const tree_node& tree_node::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_protobuf_2fannoy_2eproto(); - return *default_instance_; + protobuf_annoy_2eproto::InitDefaults(); + return *internal_default_instance(); } -tree_node* tree_node::default_instance_ = NULL; - tree_node* tree_node::New(::google::protobuf::Arena* arena) const { tree_node* n = new tree_node; if (arena != NULL) { @@ -637,148 +626,121 @@ tree_node* tree_node::New(::google::protobuf::Arena* arena) const { } void tree_node::Clear() { -#define ZR_HELPER_(f) reinterpret_cast(\ - &reinterpret_cast(16)->f) - -#define ZR_(first, last) do {\ - ::memset(&first, 0,\ - ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ -} while (0) - - if (_has_bits_[0 / 32] & 79u) { - ZR_(index_, right_); - t_ = 0; - } - -#undef ZR_HELPER_ -#undef ZR_ - +// @@protoc_insertion_point(message_clear_start:tree_node) items_.Clear(); v_.Clear(); - ::memset(_has_bits_, 0, sizeof(_has_bits_)); - if (_internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->Clear(); + if (_has_bits_[0 / 32] & 31u) { + ::memset(&index_, 0, reinterpret_cast(&t_) - + reinterpret_cast(&index_) + sizeof(t_)); } + _has_bits_.Clear(); + _internal_metadata_.Clear(); } bool tree_node::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:tree_node) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // required uint32 index = 1; case 1: { - if (tag == 8) { + if (tag == 8u) { + set_has_index(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, &index_))); - set_has_index(); } else { goto handle_unusual; } - if (input->ExpectTag(16)) goto parse_leaf; break; } // required bool leaf = 2; case 2: { - if (tag == 16) { - parse_leaf: + if (tag == 16u) { + set_has_leaf(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( input, &leaf_))); - set_has_leaf(); } else { goto handle_unusual; } - if (input->ExpectTag(24)) goto parse_left; break; } // optional uint32 left = 3; case 3: { - if (tag == 24) { - parse_left: + if (tag == 24u) { + set_has_left(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, &left_))); - set_has_left(); } else { goto handle_unusual; } - if (input->ExpectTag(32)) goto parse_right; break; } // optional uint32 right = 4; case 4: { - if (tag == 32) { - parse_right: + if (tag == 32u) { + set_has_right(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, &right_))); - set_has_right(); } else { goto handle_unusual; } - if (input->ExpectTag(40)) goto parse_items; break; } // repeated uint32 items = 5; case 5: { - if (tag == 40) { - parse_items: + if (tag == 40u) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( - 1, 40, input, this->mutable_items()))); - } else if (tag == 42) { + 1, 40u, input, this->mutable_items()))); + } else if (tag == 42u) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( input, this->mutable_items()))); } else { goto handle_unusual; } - if (input->ExpectTag(40)) goto parse_items; - if (input->ExpectTag(50)) goto parse_v; break; } // repeated float v = 6 [packed = true]; case 6: { - if (tag == 50) { - parse_v: + if (tag == 50u) { DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( input, this->mutable_v()))); - } else if (tag == 53) { + } else if (tag == 53u) { DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - 1, 50, input, this->mutable_v()))); + 1, 50u, input, this->mutable_v()))); } else { goto handle_unusual; } - if (input->ExpectTag(61)) goto parse_t; break; } // optional float t = 7; case 7: { - if (tag == 61) { - parse_t: + if (tag == 61u) { + set_has_t(); DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( input, &t_))); - set_has_t(); } else { goto handle_unusual; } - if (input->ExpectAtEnd()) goto success; break; } @@ -837,10 +799,8 @@ void tree_node::SerializeWithCachedSizes( if (this->v_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag(6, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); output->WriteVarint32(_v_cached_byte_size_); - } - for (int i = 0; i < this->v_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteFloatNoTag( - this->v(i), output); + ::google::protobuf::internal::WireFormatLite::WriteFloatArray( + this->v().data(), this->v_size(), output); } // optional float t = 7; @@ -855,8 +815,9 @@ void tree_node::SerializeWithCachedSizes( // @@protoc_insertion_point(serialize_end:tree_node) } -::google::protobuf::uint8* tree_node::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { +::google::protobuf::uint8* tree_node::InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const { + (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:tree_node) // required uint32 index = 1; if (has_index()) { @@ -911,8 +872,9 @@ ::google::protobuf::uint8* tree_node::SerializeWithCachedSizesToArray( return target; } -int tree_node::RequiredFieldsByteSizeFallback() const { - int total_size = 0; +size_t tree_node::RequiredFieldsByteSizeFallback() const { +// @@protoc_insertion_point(required_fields_byte_size_fallback_start:tree_node) + size_t total_size = 0; if (has_index()) { // required uint32 index = 1; @@ -928,9 +890,15 @@ int tree_node::RequiredFieldsByteSizeFallback() const { return total_size; } -int tree_node::ByteSize() const { - int total_size = 0; +size_t tree_node::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:tree_node) + size_t total_size = 0; + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present. // required uint32 index = 1; total_size += 1 + @@ -943,7 +911,31 @@ int tree_node::ByteSize() const { } else { total_size += RequiredFieldsByteSizeFallback(); } - if (_has_bits_[2 / 32] & 76u) { + // repeated uint32 items = 5; + { + size_t data_size = ::google::protobuf::internal::WireFormatLite:: + UInt32Size(this->items_); + total_size += 1 * + ::google::protobuf::internal::FromIntSize(this->items_size()); + total_size += data_size; + } + + // repeated float v = 6 [packed = true]; + { + unsigned int count = this->v_size(); + size_t data_size = 4UL * count; + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _v_cached_byte_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + if (_has_bits_[0 / 32] & 28u) { // optional uint32 left = 3; if (has_left()) { total_size += 1 + @@ -964,58 +956,35 @@ int tree_node::ByteSize() const { } } - // repeated uint32 items = 5; - { - int data_size = 0; - for (int i = 0; i < this->items_size(); i++) { - data_size += ::google::protobuf::internal::WireFormatLite:: - UInt32Size(this->items(i)); - } - total_size += 1 * this->items_size() + data_size; - } - - // repeated float v = 6 [packed = true]; - { - int data_size = 0; - data_size = 4 * this->v_size(); - if (data_size > 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _v_cached_byte_size_ = data_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; - } - - if (_internal_metadata_.have_unknown_fields()) { - total_size += - ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( - unknown_fields()); - } + int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; + _cached_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } void tree_node::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const tree_node* source = +// @@protoc_insertion_point(generalized_merge_from_start:tree_node) + GOOGLE_DCHECK_NE(&from, this); + const tree_node* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:tree_node) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:tree_node) MergeFrom(*source); } } void tree_node::MergeFrom(const tree_node& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); +// @@protoc_insertion_point(class_specific_merge_from_start:tree_node) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); items_.MergeFrom(from.items_); v_.MergeFrom(from.v_); - if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bits_[0 / 32] & 31u) { if (from.has_index()) { set_index(from.index()); } @@ -1032,18 +1001,17 @@ void tree_node::MergeFrom(const tree_node& from) { set_t(from.t()); } } - if (from._internal_metadata_.have_unknown_fields()) { - mutable_unknown_fields()->MergeFrom(from.unknown_fields()); - } } void tree_node::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:tree_node) if (&from == this) return; Clear(); MergeFrom(from); } void tree_node::CopyFrom(const tree_node& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:tree_node) if (&from == this) return; Clear(); MergeFrom(from); @@ -1051,7 +1019,6 @@ void tree_node::CopyFrom(const tree_node& from) { bool tree_node::IsInitialized() const { if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; - return true; } @@ -1060,12 +1027,12 @@ void tree_node::Swap(tree_node* other) { InternalSwap(other); } void tree_node::InternalSwap(tree_node* other) { + items_.UnsafeArenaSwap(&other->items_); + v_.UnsafeArenaSwap(&other->v_); std::swap(index_, other->index_); std::swap(leaf_, other->leaf_); std::swap(left_, other->left_); std::swap(right_, other->right_); - items_.UnsafeArenaSwap(&other->items_); - v_.UnsafeArenaSwap(&other->v_); std::swap(t_, other->t_); std::swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); @@ -1073,11 +1040,8 @@ void tree_node::InternalSwap(tree_node* other) { } ::google::protobuf::Metadata tree_node::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = tree_node_descriptor_; - metadata.reflection = tree_node_reflection_; - return metadata; + protobuf_annoy_2eproto::protobuf_AssignDescriptorsOnce(); + return protobuf_annoy_2eproto::file_level_metadata[1]; } #if PROTOBUF_INLINE_NOT_IN_HEADERS @@ -1097,11 +1061,11 @@ void tree_node::clear_index() { index_ = 0u; clear_has_index(); } - ::google::protobuf::uint32 tree_node::index() const { +::google::protobuf::uint32 tree_node::index() const { // @@protoc_insertion_point(field_get:tree_node.index) return index_; } - void tree_node::set_index(::google::protobuf::uint32 value) { +void tree_node::set_index(::google::protobuf::uint32 value) { set_has_index(); index_ = value; // @@protoc_insertion_point(field_set:tree_node.index) @@ -1121,11 +1085,11 @@ void tree_node::clear_leaf() { leaf_ = false; clear_has_leaf(); } - bool tree_node::leaf() const { +bool tree_node::leaf() const { // @@protoc_insertion_point(field_get:tree_node.leaf) return leaf_; } - void tree_node::set_leaf(bool value) { +void tree_node::set_leaf(bool value) { set_has_leaf(); leaf_ = value; // @@protoc_insertion_point(field_set:tree_node.leaf) @@ -1145,11 +1109,11 @@ void tree_node::clear_left() { left_ = 0u; clear_has_left(); } - ::google::protobuf::uint32 tree_node::left() const { +::google::protobuf::uint32 tree_node::left() const { // @@protoc_insertion_point(field_get:tree_node.left) return left_; } - void tree_node::set_left(::google::protobuf::uint32 value) { +void tree_node::set_left(::google::protobuf::uint32 value) { set_has_left(); left_ = value; // @@protoc_insertion_point(field_set:tree_node.left) @@ -1169,11 +1133,11 @@ void tree_node::clear_right() { right_ = 0u; clear_has_right(); } - ::google::protobuf::uint32 tree_node::right() const { +::google::protobuf::uint32 tree_node::right() const { // @@protoc_insertion_point(field_get:tree_node.right) return right_; } - void tree_node::set_right(::google::protobuf::uint32 value) { +void tree_node::set_right(::google::protobuf::uint32 value) { set_has_right(); right_ = value; // @@protoc_insertion_point(field_set:tree_node.right) @@ -1186,24 +1150,24 @@ int tree_node::items_size() const { void tree_node::clear_items() { items_.Clear(); } - ::google::protobuf::uint32 tree_node::items(int index) const { +::google::protobuf::uint32 tree_node::items(int index) const { // @@protoc_insertion_point(field_get:tree_node.items) return items_.Get(index); } - void tree_node::set_items(int index, ::google::protobuf::uint32 value) { +void tree_node::set_items(int index, ::google::protobuf::uint32 value) { items_.Set(index, value); // @@protoc_insertion_point(field_set:tree_node.items) } - void tree_node::add_items(::google::protobuf::uint32 value) { +void tree_node::add_items(::google::protobuf::uint32 value) { items_.Add(value); // @@protoc_insertion_point(field_add:tree_node.items) } - const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& +const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& tree_node::items() const { // @@protoc_insertion_point(field_list:tree_node.items) return items_; } - ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* +::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* tree_node::mutable_items() { // @@protoc_insertion_point(field_mutable_list:tree_node.items) return &items_; @@ -1216,24 +1180,24 @@ int tree_node::v_size() const { void tree_node::clear_v() { v_.Clear(); } - float tree_node::v(int index) const { +float tree_node::v(int index) const { // @@protoc_insertion_point(field_get:tree_node.v) return v_.Get(index); } - void tree_node::set_v(int index, float value) { +void tree_node::set_v(int index, float value) { v_.Set(index, value); // @@protoc_insertion_point(field_set:tree_node.v) } - void tree_node::add_v(float value) { +void tree_node::add_v(float value) { v_.Add(value); // @@protoc_insertion_point(field_add:tree_node.v) } - const ::google::protobuf::RepeatedField< float >& +const ::google::protobuf::RepeatedField< float >& tree_node::v() const { // @@protoc_insertion_point(field_list:tree_node.v) return v_; } - ::google::protobuf::RepeatedField< float >* +::google::protobuf::RepeatedField< float >* tree_node::mutable_v() { // @@protoc_insertion_point(field_mutable_list:tree_node.v) return &v_; @@ -1241,23 +1205,23 @@ tree_node::mutable_v() { // optional float t = 7; bool tree_node::has_t() const { - return (_has_bits_[0] & 0x00000040u) != 0; + return (_has_bits_[0] & 0x00000010u) != 0; } void tree_node::set_has_t() { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000010u; } void tree_node::clear_has_t() { - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000010u; } void tree_node::clear_t() { t_ = 0; clear_has_t(); } - float tree_node::t() const { +float tree_node::t() const { // @@protoc_insertion_point(field_get:tree_node.t) return t_; } - void tree_node::set_t(float value) { +void tree_node::set_t(float value) { set_has_t(); t_ = value; // @@protoc_insertion_point(field_set:tree_node.t) diff --git a/src/protobuf/annoy.pb.h b/src/protobuf/annoy.pb.h index bc2ac04..510b628 100644 --- a/src/protobuf/annoy.pb.h +++ b/src/protobuf/annoy.pb.h @@ -1,45 +1,55 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: protobuf/annoy.proto +// source: annoy.proto -#ifndef PROTOBUF_protobuf_2fannoy_2eproto__INCLUDED -#define PROTOBUF_protobuf_2fannoy_2eproto__INCLUDED +#ifndef PROTOBUF_annoy_2eproto__INCLUDED +#define PROTOBUF_annoy_2eproto__INCLUDED #include #include -#if GOOGLE_PROTOBUF_VERSION < 3000000 +#if GOOGLE_PROTOBUF_VERSION < 3002000 #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 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3002000 < 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 -#include -#include +#include // IWYU pragma: export +#include // IWYU pragma: export #include // @@protoc_insertion_point(includes) - -// Internal implementation detail -- do not call these. -void protobuf_AddDesc_protobuf_2fannoy_2eproto(); -void protobuf_AssignDesc_protobuf_2fannoy_2eproto(); -void protobuf_ShutdownFile_protobuf_2fannoy_2eproto(); - class data_info; +class data_infoDefaultTypeInternal; +extern data_infoDefaultTypeInternal _data_info_default_instance_; class tree_node; +class tree_nodeDefaultTypeInternal; +extern tree_nodeDefaultTypeInternal _tree_node_default_instance_; + +namespace protobuf_annoy_2eproto { +// Internal implementation detail -- do not call these. +struct TableStruct { + static const ::google::protobuf::uint32 offsets[]; + static void InitDefaultsImpl(); + static void Shutdown(); +}; +void AddDescriptors(); +void InitDefaults(); +} // namespace protobuf_annoy_2eproto // =================================================================== -class data_info : public ::google::protobuf::Message { +class data_info : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:data_info) */ { public: data_info(); virtual ~data_info(); @@ -62,42 +72,53 @@ class data_info : public ::google::protobuf::Message { static const ::google::protobuf::Descriptor* descriptor(); static const data_info& default_instance(); + static inline const data_info* internal_default_instance() { + return reinterpret_cast( + &_data_info_default_instance_); + } + void Swap(data_info* other); // implements Message ---------------------------------------------- - inline data_info* New() const { return New(NULL); } + inline data_info* New() const PROTOBUF_FINAL { return New(NULL); } - data_info* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); + data_info* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const data_info& from); void MergeFrom(const data_info& from); - void Clear(); - bool IsInitialized() const; + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; - int ByteSize() const; + size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) + const PROTOBUF_FINAL { + return InternalSerializeWithCachedSizesToArray( + ::google::protobuf::io::CodedOutputStream::IsDefaultSerializationDeterministic(), output); + } + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); - void SetCachedSize(int size) const; + void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(data_info* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); + return NULL; } inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); + return NULL; } public: - ::google::protobuf::Metadata GetMetadata() const; + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- @@ -131,28 +152,23 @@ class data_info : public ::google::protobuf::Message { // @@protoc_insertion_point(class_scope:data_info) private: - inline void set_has_id(); - inline void clear_has_id(); - inline void set_has_category(); - inline void clear_has_category(); + void set_has_id(); + void clear_has_id(); + void set_has_category(); + void clear_has_category(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::uint32 _has_bits_[1]; + ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedField< float > data_; mutable int _data_cached_byte_size_; ::google::protobuf::uint32 id_; ::google::protobuf::uint32 category_; - friend void protobuf_AddDesc_protobuf_2fannoy_2eproto(); - friend void protobuf_AssignDesc_protobuf_2fannoy_2eproto(); - friend void protobuf_ShutdownFile_protobuf_2fannoy_2eproto(); - - void InitAsDefaultInstance(); - static data_info* default_instance_; + friend struct protobuf_annoy_2eproto::TableStruct; }; // ------------------------------------------------------------------- -class tree_node : public ::google::protobuf::Message { +class tree_node : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tree_node) */ { public: tree_node(); virtual ~tree_node(); @@ -175,47 +191,82 @@ class tree_node : public ::google::protobuf::Message { static const ::google::protobuf::Descriptor* descriptor(); static const tree_node& default_instance(); + static inline const tree_node* internal_default_instance() { + return reinterpret_cast( + &_tree_node_default_instance_); + } + void Swap(tree_node* other); // implements Message ---------------------------------------------- - inline tree_node* New() const { return New(NULL); } + inline tree_node* New() const PROTOBUF_FINAL { return New(NULL); } - tree_node* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); + tree_node* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; + void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; + void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const tree_node& from); void MergeFrom(const tree_node& from); - void Clear(); - bool IsInitialized() const; + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; - int ByteSize() const; + size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); + ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } + ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; + ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( + bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) + const PROTOBUF_FINAL { + return InternalSerializeWithCachedSizesToArray( + ::google::protobuf::io::CodedOutputStream::IsDefaultSerializationDeterministic(), output); + } + int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); - void SetCachedSize(int size) const; + void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(tree_node* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); + return NULL; } inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); + return NULL; } public: - ::google::protobuf::Metadata GetMetadata() const; + ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- + // repeated uint32 items = 5; + int items_size() const; + void clear_items(); + static const int kItemsFieldNumber = 5; + ::google::protobuf::uint32 items(int index) const; + void set_items(int index, ::google::protobuf::uint32 value); + void add_items(::google::protobuf::uint32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& + items() const; + ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* + mutable_items(); + + // repeated float v = 6 [packed = true]; + int v_size() const; + void clear_v(); + static const int kVFieldNumber = 6; + float v(int index) const; + void set_v(int index, float value); + void add_v(float value); + const ::google::protobuf::RepeatedField< float >& + v() const; + ::google::protobuf::RepeatedField< float >* + mutable_v(); + // required uint32 index = 1; bool has_index() const; void clear_index(); @@ -244,30 +295,6 @@ class tree_node : public ::google::protobuf::Message { ::google::protobuf::uint32 right() const; void set_right(::google::protobuf::uint32 value); - // repeated uint32 items = 5; - int items_size() const; - void clear_items(); - static const int kItemsFieldNumber = 5; - ::google::protobuf::uint32 items(int index) const; - void set_items(int index, ::google::protobuf::uint32 value); - void add_items(::google::protobuf::uint32 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& - items() const; - ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* - mutable_items(); - - // repeated float v = 6 [packed = true]; - int v_size() const; - void clear_v(); - static const int kVFieldNumber = 6; - float v(int index) const; - void set_v(int index, float value); - void add_v(float value); - const ::google::protobuf::RepeatedField< float >& - v() const; - ::google::protobuf::RepeatedField< float >* - mutable_v(); - // optional float t = 7; bool has_t() const; void clear_t(); @@ -277,37 +304,32 @@ class tree_node : public ::google::protobuf::Message { // @@protoc_insertion_point(class_scope:tree_node) private: - inline void set_has_index(); - inline void clear_has_index(); - inline void set_has_leaf(); - inline void clear_has_leaf(); - inline void set_has_left(); - inline void clear_has_left(); - inline void set_has_right(); - inline void clear_has_right(); - inline void set_has_t(); - inline void clear_has_t(); - - // helper for ByteSize() - int RequiredFieldsByteSizeFallback() const; + void set_has_index(); + void clear_has_index(); + void set_has_leaf(); + void clear_has_leaf(); + void set_has_left(); + void clear_has_left(); + void set_has_right(); + void clear_has_right(); + void set_has_t(); + void clear_has_t(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - ::google::protobuf::uint32 _has_bits_[1]; + ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; + ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > items_; + ::google::protobuf::RepeatedField< float > v_; + mutable int _v_cached_byte_size_; ::google::protobuf::uint32 index_; bool leaf_; ::google::protobuf::uint32 left_; ::google::protobuf::uint32 right_; - ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > items_; - ::google::protobuf::RepeatedField< float > v_; - mutable int _v_cached_byte_size_; float t_; - friend void protobuf_AddDesc_protobuf_2fannoy_2eproto(); - friend void protobuf_AssignDesc_protobuf_2fannoy_2eproto(); - friend void protobuf_ShutdownFile_protobuf_2fannoy_2eproto(); - - void InitAsDefaultInstance(); - static tree_node* default_instance_; + friend struct protobuf_annoy_2eproto::TableStruct; }; // =================================================================== @@ -349,13 +371,13 @@ data_info::mutable_data() { // optional uint32 id = 2; inline bool data_info::has_id() const { - return (_has_bits_[0] & 0x00000002u) != 0; + return (_has_bits_[0] & 0x00000001u) != 0; } inline void data_info::set_has_id() { - _has_bits_[0] |= 0x00000002u; + _has_bits_[0] |= 0x00000001u; } inline void data_info::clear_has_id() { - _has_bits_[0] &= ~0x00000002u; + _has_bits_[0] &= ~0x00000001u; } inline void data_info::clear_id() { id_ = 0u; @@ -373,13 +395,13 @@ inline void data_info::set_id(::google::protobuf::uint32 value) { // optional uint32 category = 3; inline bool data_info::has_category() const { - return (_has_bits_[0] & 0x00000004u) != 0; + return (_has_bits_[0] & 0x00000002u) != 0; } inline void data_info::set_has_category() { - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000002u; } inline void data_info::clear_has_category() { - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000002u; } inline void data_info::clear_category() { category_ = 0u; @@ -557,13 +579,13 @@ tree_node::mutable_v() { // optional float t = 7; inline bool tree_node::has_t() const { - return (_has_bits_[0] & 0x00000040u) != 0; + return (_has_bits_[0] & 0x00000010u) != 0; } inline void tree_node::set_has_t() { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000010u; } inline void tree_node::clear_has_t() { - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000010u; } inline void tree_node::clear_t() { t_ = 0; @@ -585,6 +607,7 @@ inline void tree_node::set_t(float value) { // @@protoc_insertion_point(namespace_scope) + // @@protoc_insertion_point(global_scope) -#endif // PROTOBUF_protobuf_2fannoy_2eproto__INCLUDED +#endif // PROTOBUF_annoy_2eproto__INCLUDED