// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: LinkedModel.proto

#include "LinkedModel.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/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace CoreML {
namespace Specification {
constexpr LinkedModel::LinkedModel(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : _oneof_case_{}{}
struct LinkedModelDefaultTypeInternal {
  constexpr LinkedModelDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~LinkedModelDefaultTypeInternal() {}
  union {
    LinkedModel _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LinkedModelDefaultTypeInternal _LinkedModel_default_instance_;
constexpr LinkedModelFile::LinkedModelFile(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : linkedmodelfilename_(nullptr)
  , linkedmodelsearchpath_(nullptr){}
struct LinkedModelFileDefaultTypeInternal {
  constexpr LinkedModelFileDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~LinkedModelFileDefaultTypeInternal() {}
  union {
    LinkedModelFile _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LinkedModelFileDefaultTypeInternal _LinkedModelFile_default_instance_;
}  // namespace Specification
}  // namespace CoreML
namespace CoreML {
namespace Specification {

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

class LinkedModel::_Internal {
 public:
  static const ::CoreML::Specification::LinkedModelFile& linkedmodelfile(const LinkedModel* msg);
};

const ::CoreML::Specification::LinkedModelFile&
LinkedModel::_Internal::linkedmodelfile(const LinkedModel* msg) {
  return *msg->LinkType_.linkedmodelfile_;
}
void LinkedModel::set_allocated_linkedmodelfile(::CoreML::Specification::LinkedModelFile* linkedmodelfile) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_LinkType();
  if (linkedmodelfile) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::LinkedModelFile>::GetOwningArena(linkedmodelfile);
    if (message_arena != submessage_arena) {
      linkedmodelfile = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, linkedmodelfile, submessage_arena);
    }
    set_has_linkedmodelfile();
    LinkType_.linkedmodelfile_ = linkedmodelfile;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.LinkedModel.linkedModelFile)
}
LinkedModel::LinkedModel(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.LinkedModel)
}
LinkedModel::LinkedModel(const LinkedModel& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  clear_has_LinkType();
  switch (from.LinkType_case()) {
    case kLinkedModelFile: {
      _internal_mutable_linkedmodelfile()->::CoreML::Specification::LinkedModelFile::MergeFrom(from._internal_linkedmodelfile());
      break;
    }
    case LINKTYPE_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.LinkedModel)
}

inline void LinkedModel::SharedCtor() {
clear_has_LinkType();
}

LinkedModel::~LinkedModel() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.LinkedModel)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void LinkedModel::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (has_LinkType()) {
    clear_LinkType();
  }
}

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

void LinkedModel::clear_LinkType() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.LinkedModel)
  switch (LinkType_case()) {
    case kLinkedModelFile: {
      if (GetArenaForAllocation() == nullptr) {
        delete LinkType_.linkedmodelfile_;
      }
      break;
    }
    case LINKTYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = LINKTYPE_NOT_SET;
}


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

  clear_LinkType();
  _internal_metadata_.Clear<std::string>();
}

const char* LinkedModel::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .CoreML.Specification.LinkedModelFile linkedModelFile = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_linkedmodelfile(), ptr);
          CHK_(ptr);
        } 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<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  // .CoreML.Specification.LinkedModelFile linkedModelFile = 1;
  if (_internal_has_linkedmodelfile()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::linkedmodelfile(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.LinkedModel)
  return target;
}

size_t LinkedModel::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.LinkedModel)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  switch (LinkType_case()) {
    // .CoreML.Specification.LinkedModelFile linkedModelFile = 1;
    case kLinkedModelFile: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *LinkType_.linkedmodelfile_);
      break;
    }
    case LINKTYPE_NOT_SET: {
      break;
    }
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void LinkedModel::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const LinkedModel*>(
      &from));
}

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

  switch (from.LinkType_case()) {
    case kLinkedModelFile: {
      _internal_mutable_linkedmodelfile()->::CoreML::Specification::LinkedModelFile::MergeFrom(from._internal_linkedmodelfile());
      break;
    }
    case LINKTYPE_NOT_SET: {
      break;
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

bool LinkedModel::IsInitialized() const {
  return true;
}

void LinkedModel::InternalSwap(LinkedModel* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(LinkType_, other->LinkType_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
}

std::string LinkedModel::GetTypeName() const {
  return "CoreML.Specification.LinkedModel";
}


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

class LinkedModelFile::_Internal {
 public:
  static const ::CoreML::Specification::StringParameter& linkedmodelfilename(const LinkedModelFile* msg);
  static const ::CoreML::Specification::StringParameter& linkedmodelsearchpath(const LinkedModelFile* msg);
};

const ::CoreML::Specification::StringParameter&
LinkedModelFile::_Internal::linkedmodelfilename(const LinkedModelFile* msg) {
  return *msg->linkedmodelfilename_;
}
const ::CoreML::Specification::StringParameter&
LinkedModelFile::_Internal::linkedmodelsearchpath(const LinkedModelFile* msg) {
  return *msg->linkedmodelsearchpath_;
}
void LinkedModelFile::clear_linkedmodelfilename() {
  if (GetArenaForAllocation() == nullptr && linkedmodelfilename_ != nullptr) {
    delete linkedmodelfilename_;
  }
  linkedmodelfilename_ = nullptr;
}
void LinkedModelFile::clear_linkedmodelsearchpath() {
  if (GetArenaForAllocation() == nullptr && linkedmodelsearchpath_ != nullptr) {
    delete linkedmodelsearchpath_;
  }
  linkedmodelsearchpath_ = nullptr;
}
LinkedModelFile::LinkedModelFile(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.LinkedModelFile)
}
LinkedModelFile::LinkedModelFile(const LinkedModelFile& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  if (from._internal_has_linkedmodelfilename()) {
    linkedmodelfilename_ = new ::CoreML::Specification::StringParameter(*from.linkedmodelfilename_);
  } else {
    linkedmodelfilename_ = nullptr;
  }
  if (from._internal_has_linkedmodelsearchpath()) {
    linkedmodelsearchpath_ = new ::CoreML::Specification::StringParameter(*from.linkedmodelsearchpath_);
  } else {
    linkedmodelsearchpath_ = nullptr;
  }
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.LinkedModelFile)
}

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

LinkedModelFile::~LinkedModelFile() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.LinkedModelFile)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void LinkedModelFile::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete linkedmodelfilename_;
  if (this != internal_default_instance()) delete linkedmodelsearchpath_;
}

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

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

  if (GetArenaForAllocation() == nullptr && linkedmodelfilename_ != nullptr) {
    delete linkedmodelfilename_;
  }
  linkedmodelfilename_ = nullptr;
  if (GetArenaForAllocation() == nullptr && linkedmodelsearchpath_ != nullptr) {
    delete linkedmodelsearchpath_;
  }
  linkedmodelsearchpath_ = nullptr;
  _internal_metadata_.Clear<std::string>();
}

const char* LinkedModelFile::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .CoreML.Specification.StringParameter linkedModelFileName = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_linkedmodelfilename(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.StringParameter linkedModelSearchPath = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_linkedmodelsearchpath(), ptr);
          CHK_(ptr);
        } 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<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  // .CoreML.Specification.StringParameter linkedModelFileName = 1;
  if (this->_internal_has_linkedmodelfilename()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::linkedmodelfilename(this), target, stream);
  }

  // .CoreML.Specification.StringParameter linkedModelSearchPath = 2;
  if (this->_internal_has_linkedmodelsearchpath()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::linkedmodelsearchpath(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.LinkedModelFile)
  return target;
}

size_t LinkedModelFile::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.LinkedModelFile)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // .CoreML.Specification.StringParameter linkedModelFileName = 1;
  if (this->_internal_has_linkedmodelfilename()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *linkedmodelfilename_);
  }

  // .CoreML.Specification.StringParameter linkedModelSearchPath = 2;
  if (this->_internal_has_linkedmodelsearchpath()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *linkedmodelsearchpath_);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void LinkedModelFile::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const LinkedModelFile*>(
      &from));
}

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

  if (from._internal_has_linkedmodelfilename()) {
    _internal_mutable_linkedmodelfilename()->::CoreML::Specification::StringParameter::MergeFrom(from._internal_linkedmodelfilename());
  }
  if (from._internal_has_linkedmodelsearchpath()) {
    _internal_mutable_linkedmodelsearchpath()->::CoreML::Specification::StringParameter::MergeFrom(from._internal_linkedmodelsearchpath());
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

bool LinkedModelFile::IsInitialized() const {
  return true;
}

void LinkedModelFile::InternalSwap(LinkedModelFile* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(LinkedModelFile, linkedmodelsearchpath_)
      + sizeof(LinkedModelFile::linkedmodelsearchpath_)
      - PROTOBUF_FIELD_OFFSET(LinkedModelFile, linkedmodelfilename_)>(
          reinterpret_cast<char*>(&linkedmodelfilename_),
          reinterpret_cast<char*>(&other->linkedmodelfilename_));
}

std::string LinkedModelFile::GetTypeName() const {
  return "CoreML.Specification.LinkedModelFile";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace Specification
}  // namespace CoreML
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::CoreML::Specification::LinkedModel* Arena::CreateMaybeMessage< ::CoreML::Specification::LinkedModel >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::LinkedModel >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::LinkedModelFile* Arena::CreateMaybeMessage< ::CoreML::Specification::LinkedModelFile >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::LinkedModelFile >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

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