Skip to content

File anchor.pb.cc

File List > formats > object_detection > anchor.pb.cc

Go to the documentation of this file

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: mediapipe/framework/formats/object_detection/anchor.proto

#include "mediapipe/framework/formats/object_detection/anchor.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.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)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace mediapipe {
constexpr Anchor::Anchor(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : x_center_(0)
  , y_center_(0)
  , h_(0)
  , w_(0){}
struct AnchorDefaultTypeInternal {
  constexpr AnchorDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~AnchorDefaultTypeInternal() {}
  union {
    Anchor _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT AnchorDefaultTypeInternal _Anchor_default_instance_;
}  // namespace mediapipe
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto = nullptr;

const uint32_t TableStruct_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, x_center_),
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, y_center_),
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, h_),
  PROTOBUF_FIELD_OFFSET(::mediapipe::Anchor, w_),
  0,
  1,
  2,
  3,
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 10, -1, sizeof(::mediapipe::Anchor)},
};

static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mediapipe::_Anchor_default_instance_),
};

const char descriptor_table_protodef_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n9mediapipe/framework/formats/object_det"
  "ection/anchor.proto\022\tmediapipe\"B\n\006Anchor"
  "\022\020\n\010x_center\030\001 \002(\002\022\020\n\010y_center\030\002 \002(\002\022\t\n\001"
  "h\030\003 \002(\002\022\t\n\001w\030\004 \002(\002"
  ;
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto = {
  false, false, 138, descriptor_table_protodef_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto, "mediapipe/framework/formats/object_detection/anchor.proto", 
  &descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto_once, nullptr, 0, 1,
  schemas, file_default_instances, TableStruct_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto::offsets,
  file_level_metadata_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto, file_level_enum_descriptors_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto, file_level_service_descriptors_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto_getter() {
  return &descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto;
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto(&descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto);
namespace mediapipe {

// ===================================================================

class Anchor::_Internal {
 public:
  using HasBits = decltype(std::declval<Anchor>()._has_bits_);
  static void set_has_x_center(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_y_center(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_h(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_w(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x0000000f) ^ 0x0000000f) != 0;
  }
};

Anchor::Anchor(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:mediapipe.Anchor)
}
Anchor::Anchor(const Anchor& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::memcpy(&x_center_, &from.x_center_,
    static_cast<size_t>(reinterpret_cast<char*>(&w_) -
    reinterpret_cast<char*>(&x_center_)) + sizeof(w_));
  // @@protoc_insertion_point(copy_constructor:mediapipe.Anchor)
}

inline void Anchor::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&x_center_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&w_) -
    reinterpret_cast<char*>(&x_center_)) + sizeof(w_));
}

Anchor::~Anchor() {
  // @@protoc_insertion_point(destructor:mediapipe.Anchor)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

inline void Anchor::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void Anchor::ArenaDtor(void* object) {
  Anchor* _this = reinterpret_cast< Anchor* >(object);
  (void)_this;
}
void Anchor::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Anchor::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Anchor::Clear() {
// @@protoc_insertion_point(message_clear_start:mediapipe.Anchor)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    ::memset(&x_center_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&w_) -
        reinterpret_cast<char*>(&x_center_)) + sizeof(w_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* Anchor::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required float x_center = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
          _Internal::set_has_x_center(&has_bits);
          x_center_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // required float y_center = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 21)) {
          _Internal::set_has_y_center(&has_bits);
          y_center_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // required float h = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 29)) {
          _Internal::set_has_h(&has_bits);
          h_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // required float w = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 37)) {
          _Internal::set_has_w(&has_bits);
          w_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Anchor::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:mediapipe.Anchor)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required float x_center = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_x_center(), target);
  }

  // required float y_center = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_y_center(), target);
  }

  // required float h = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->_internal_h(), target);
  }

  // required float w = 4;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(4, this->_internal_w(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:mediapipe.Anchor)
  return target;
}

size_t Anchor::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:mediapipe.Anchor)
  size_t total_size = 0;

  if (_internal_has_x_center()) {
    // required float x_center = 1;
    total_size += 1 + 4;
  }

  if (_internal_has_y_center()) {
    // required float y_center = 2;
    total_size += 1 + 4;
  }

  if (_internal_has_h()) {
    // required float h = 3;
    total_size += 1 + 4;
  }

  if (_internal_has_w()) {
    // required float w = 4;
    total_size += 1 + 4;
  }

  return total_size;
}
size_t Anchor::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mediapipe.Anchor)
  size_t total_size = 0;

  if (((_has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) {  // All required fields are present.
    // required float x_center = 1;
    total_size += 1 + 4;

    // required float y_center = 2;
    total_size += 1 + 4;

    // required float h = 3;
    total_size += 1 + 4;

    // required float w = 4;
    total_size += 1 + 4;

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  return MaybeComputeUnknownFieldsSize(total_size, &_cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Anchor::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck,
    Anchor::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Anchor::GetClassData() const { return &_class_data_; }

void Anchor::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
                      const ::PROTOBUF_NAMESPACE_ID::Message& from) {
  static_cast<Anchor *>(to)->MergeFrom(
      static_cast<const Anchor &>(from));
}


void Anchor::MergeFrom(const Anchor& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mediapipe.Anchor)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      x_center_ = from.x_center_;
    }
    if (cached_has_bits & 0x00000002u) {
      y_center_ = from.y_center_;
    }
    if (cached_has_bits & 0x00000004u) {
      h_ = from.h_;
    }
    if (cached_has_bits & 0x00000008u) {
      w_ = from.w_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

void Anchor::CopyFrom(const Anchor& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mediapipe.Anchor)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Anchor::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_has_bits_)) return false;
  return true;
}

void Anchor::InternalSwap(Anchor* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(Anchor, w_)
      + sizeof(Anchor::w_)
      - PROTOBUF_FIELD_OFFSET(Anchor, x_center_)>(
          reinterpret_cast<char*>(&x_center_),
          reinterpret_cast<char*>(&other->x_center_));
}

::PROTOBUF_NAMESPACE_ID::Metadata Anchor::GetMetadata() const {
  return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(
      &descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto_getter, &descriptor_table_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto_once,
      file_level_metadata_mediapipe_2fframework_2fformats_2fobject_5fdetection_2fanchor_2eproto[0]);
}

// @@protoc_insertion_point(namespace_scope)
}  // namespace mediapipe
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::mediapipe::Anchor* Arena::CreateMaybeMessage< ::mediapipe::Anchor >(Arena* arena) {
  return Arena::CreateMessageInternal< ::mediapipe::Anchor >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>