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

#include "OneHotEncoder.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 OneHotEncoder::OneHotEncoder(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : outputsparse_(false)
  , handleunknown_(0)

  , _oneof_case_{}{}
struct OneHotEncoderDefaultTypeInternal {
  constexpr OneHotEncoderDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~OneHotEncoderDefaultTypeInternal() {}
  union {
    OneHotEncoder _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT OneHotEncoderDefaultTypeInternal _OneHotEncoder_default_instance_;
}  // namespace Specification
}  // namespace CoreML
namespace CoreML {
namespace Specification {
bool OneHotEncoder_HandleUnknown_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> OneHotEncoder_HandleUnknown_strings[2] = {};

static const char OneHotEncoder_HandleUnknown_names[] =
  "ErrorOnUnknown"
  "IgnoreUnknown";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry OneHotEncoder_HandleUnknown_entries[] = {
  { {OneHotEncoder_HandleUnknown_names + 0, 14}, 0 },
  { {OneHotEncoder_HandleUnknown_names + 14, 13}, 1 },
};

static const int OneHotEncoder_HandleUnknown_entries_by_number[] = {
  0, // 0 -> ErrorOnUnknown
  1, // 1 -> IgnoreUnknown
};

const std::string& OneHotEncoder_HandleUnknown_Name(
    OneHotEncoder_HandleUnknown value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          OneHotEncoder_HandleUnknown_entries,
          OneHotEncoder_HandleUnknown_entries_by_number,
          2, OneHotEncoder_HandleUnknown_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      OneHotEncoder_HandleUnknown_entries,
      OneHotEncoder_HandleUnknown_entries_by_number,
      2, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     OneHotEncoder_HandleUnknown_strings[idx].get();
}
bool OneHotEncoder_HandleUnknown_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OneHotEncoder_HandleUnknown* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      OneHotEncoder_HandleUnknown_entries, 2, name, &int_value);
  if (success) {
    *value = static_cast<OneHotEncoder_HandleUnknown>(int_value);
  }
  return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr OneHotEncoder_HandleUnknown OneHotEncoder::ErrorOnUnknown;
constexpr OneHotEncoder_HandleUnknown OneHotEncoder::IgnoreUnknown;
constexpr OneHotEncoder_HandleUnknown OneHotEncoder::HandleUnknown_MIN;
constexpr OneHotEncoder_HandleUnknown OneHotEncoder::HandleUnknown_MAX;
constexpr int OneHotEncoder::HandleUnknown_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))

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

class OneHotEncoder::_Internal {
 public:
  static const ::CoreML::Specification::StringVector& stringcategories(const OneHotEncoder* msg);
  static const ::CoreML::Specification::Int64Vector& int64categories(const OneHotEncoder* msg);
};

const ::CoreML::Specification::StringVector&
OneHotEncoder::_Internal::stringcategories(const OneHotEncoder* msg) {
  return *msg->CategoryType_.stringcategories_;
}
const ::CoreML::Specification::Int64Vector&
OneHotEncoder::_Internal::int64categories(const OneHotEncoder* msg) {
  return *msg->CategoryType_.int64categories_;
}
void OneHotEncoder::set_allocated_stringcategories(::CoreML::Specification::StringVector* stringcategories) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_CategoryType();
  if (stringcategories) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(stringcategories));
    if (message_arena != submessage_arena) {
      stringcategories = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, stringcategories, submessage_arena);
    }
    set_has_stringcategories();
    CategoryType_.stringcategories_ = stringcategories;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.OneHotEncoder.stringCategories)
}
void OneHotEncoder::clear_stringcategories() {
  if (_internal_has_stringcategories()) {
    if (GetArenaForAllocation() == nullptr) {
      delete CategoryType_.stringcategories_;
    }
    clear_has_CategoryType();
  }
}
void OneHotEncoder::set_allocated_int64categories(::CoreML::Specification::Int64Vector* int64categories) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_CategoryType();
  if (int64categories) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(int64categories));
    if (message_arena != submessage_arena) {
      int64categories = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, int64categories, submessage_arena);
    }
    set_has_int64categories();
    CategoryType_.int64categories_ = int64categories;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.OneHotEncoder.int64Categories)
}
void OneHotEncoder::clear_int64categories() {
  if (_internal_has_int64categories()) {
    if (GetArenaForAllocation() == nullptr) {
      delete CategoryType_.int64categories_;
    }
    clear_has_CategoryType();
  }
}
OneHotEncoder::OneHotEncoder(::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.OneHotEncoder)
}
OneHotEncoder::OneHotEncoder(const OneHotEncoder& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  ::memcpy(&outputsparse_, &from.outputsparse_,
    static_cast<size_t>(reinterpret_cast<char*>(&handleunknown_) -
    reinterpret_cast<char*>(&outputsparse_)) + sizeof(handleunknown_));
  clear_has_CategoryType();
  switch (from.CategoryType_case()) {
    case kStringCategories: {
      _internal_mutable_stringcategories()->::CoreML::Specification::StringVector::MergeFrom(from._internal_stringcategories());
      break;
    }
    case kInt64Categories: {
      _internal_mutable_int64categories()->::CoreML::Specification::Int64Vector::MergeFrom(from._internal_int64categories());
      break;
    }
    case CATEGORYTYPE_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.OneHotEncoder)
}

inline void OneHotEncoder::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&outputsparse_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&handleunknown_) -
    reinterpret_cast<char*>(&outputsparse_)) + sizeof(handleunknown_));
clear_has_CategoryType();
}

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

inline void OneHotEncoder::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (has_CategoryType()) {
    clear_CategoryType();
  }
}

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

void OneHotEncoder::clear_CategoryType() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.OneHotEncoder)
  switch (CategoryType_case()) {
    case kStringCategories: {
      if (GetArenaForAllocation() == nullptr) {
        delete CategoryType_.stringcategories_;
      }
      break;
    }
    case kInt64Categories: {
      if (GetArenaForAllocation() == nullptr) {
        delete CategoryType_.int64categories_;
      }
      break;
    }
    case CATEGORYTYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = CATEGORYTYPE_NOT_SET;
}


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

  ::memset(&outputsparse_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&handleunknown_) -
      reinterpret_cast<char*>(&outputsparse_)) + sizeof(handleunknown_));
  clear_CategoryType();
  _internal_metadata_.Clear<std::string>();
}

const char* OneHotEncoder::_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.StringVector stringCategories = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_stringcategories(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.Int64Vector int64Categories = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_int64categories(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // bool outputSparse = 10;
      case 10:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
          outputsparse_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.OneHotEncoder.HandleUnknown handleUnknown = 11;
      case 11:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 88)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          _internal_set_handleunknown(static_cast<::CoreML::Specification::OneHotEncoder_HandleUnknown>(val));
        } 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* OneHotEncoder::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:CoreML.Specification.OneHotEncoder)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // .CoreML.Specification.StringVector stringCategories = 1;
  if (_internal_has_stringcategories()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::stringcategories(this), target, stream);
  }

  // .CoreML.Specification.Int64Vector int64Categories = 2;
  if (_internal_has_int64categories()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::int64categories(this), target, stream);
  }

  // bool outputSparse = 10;
  if (this->_internal_outputsparse() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(10, this->_internal_outputsparse(), target);
  }

  // .CoreML.Specification.OneHotEncoder.HandleUnknown handleUnknown = 11;
  if (this->_internal_handleunknown() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      11, this->_internal_handleunknown(), target);
  }

  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.OneHotEncoder)
  return target;
}

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

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

  // bool outputSparse = 10;
  if (this->_internal_outputsparse() != 0) {
    total_size += 1 + 1;
  }

  // .CoreML.Specification.OneHotEncoder.HandleUnknown handleUnknown = 11;
  if (this->_internal_handleunknown() != 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_handleunknown());
  }

  switch (CategoryType_case()) {
    // .CoreML.Specification.StringVector stringCategories = 1;
    case kStringCategories: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *CategoryType_.stringcategories_);
      break;
    }
    // .CoreML.Specification.Int64Vector int64Categories = 2;
    case kInt64Categories: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *CategoryType_.int64categories_);
      break;
    }
    case CATEGORYTYPE_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 OneHotEncoder::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const OneHotEncoder*>(
      &from));
}

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

  if (from._internal_outputsparse() != 0) {
    _internal_set_outputsparse(from._internal_outputsparse());
  }
  if (from._internal_handleunknown() != 0) {
    _internal_set_handleunknown(from._internal_handleunknown());
  }
  switch (from.CategoryType_case()) {
    case kStringCategories: {
      _internal_mutable_stringcategories()->::CoreML::Specification::StringVector::MergeFrom(from._internal_stringcategories());
      break;
    }
    case kInt64Categories: {
      _internal_mutable_int64categories()->::CoreML::Specification::Int64Vector::MergeFrom(from._internal_int64categories());
      break;
    }
    case CATEGORYTYPE_NOT_SET: {
      break;
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void OneHotEncoder::InternalSwap(OneHotEncoder* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(OneHotEncoder, handleunknown_)
      + sizeof(OneHotEncoder::handleunknown_)
      - PROTOBUF_FIELD_OFFSET(OneHotEncoder, outputsparse_)>(
          reinterpret_cast<char*>(&outputsparse_),
          reinterpret_cast<char*>(&other->outputsparse_));
  swap(CategoryType_, other->CategoryType_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
}

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


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

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