/**
 * Autogenerated by Thrift for /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_fbthrift/fbthrift/work/fbthrift-2025.01.13.00/thrift/lib/thrift/field_mask.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#pragma once

#include "thrift/lib/thrift/gen-cpp2/field_mask_types.h"

#include <thrift/lib/cpp2/gen/module_types_tcc.h>


namespace apache {
namespace thrift {
namespace detail {

template <>
struct TccStructTraits<::apache::thrift::protocol::TypeAndMaskEntry> {
  static void translateFieldName(
      std::string_view _fname,
      int16_t& fid,
      apache::thrift::protocol::TType& _ftype) noexcept;
};
template <>
struct TccStructTraits<::apache::thrift::protocol::Mask> {
  static void translateFieldName(
      std::string_view _fname,
      int16_t& fid,
      apache::thrift::protocol::TType& _ftype) noexcept;
};

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::protocol {

template <class Protocol_>
void TypeAndMaskEntry::readNoXfer(Protocol_* iprot) {
  __fbthrift_clear_terse_fields();

  apache::thrift::detail::ProtocolReaderStructReadState<Protocol_> _readState;

  _readState.readStructBegin(iprot);

  using apache::thrift::TProtocolException;


  if (UNLIKELY(!_readState.advanceToNextField(
          iprot,
          0,
          1,
          apache::thrift::protocol::T_STRUCT))) {
    goto _advance_failure;
  }
_readField_type:
  {
    _readState.beforeSubobject(iprot);
    ::apache::thrift::op::decode<::apache::thrift::type::adapted<::apache::thrift::InlineAdapter<::apache::thrift::type::Type>, ::apache::thrift::type::struct_t<::apache::thrift::type::TypeStruct>>>(*iprot, this->__fbthrift_field_type);
    _readState.afterSubobject(iprot);
  }
 this->__isset.set(0, true);

  if (UNLIKELY(!_readState.advanceToNextField(
          iprot,
          1,
          2,
          apache::thrift::protocol::T_STRUCT))) {
    goto _advance_failure;
  }
_readField_mask:
  {
    _readState.beforeSubobject(iprot);
    ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::variant, ::apache::thrift::protocol::Mask>::readWithContext(*iprot, this->__fbthrift_field_mask, _readState);
    _readState.afterSubobject(iprot);
  }
 this->__isset.set(1, true);

  if (UNLIKELY(!_readState.advanceToNextField(
          iprot,
          2,
          0,
          apache::thrift::protocol::T_STOP))) {
    goto _advance_failure;
  }

_end:
  _readState.readStructEnd(iprot);

  return;

  goto _advance_failure; // Avoid compiler warnings about unused labels.
  _advance_failure:
  _readState.afterAdvanceFailure(iprot);
_loop:
  if (_readState.atStop()) {
    goto _end;
  }
  if (iprot->kUsesFieldNames()) {
    _readState.template fillFieldTraitsFromName<apache::thrift::detail::TccStructTraits<TypeAndMaskEntry>>();
  }

  switch (_readState.fieldId) {
    case 1:
    {
      if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_STRUCT))) {
        goto _readField_type;
      } else {
        goto _skip;
      }
    }
    case 2:
    {
      if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_STRUCT))) {
        goto _readField_mask;
      } else {
        goto _skip;
      }
    }
    default:
    {
_skip:
      _readState.skip(iprot);
      _readState.readFieldEnd(iprot);
      _readState.readFieldBeginNoInline(iprot);
      goto _loop;
    }
  }
}

template <class Protocol_>
uint32_t TypeAndMaskEntry::serializedSize(Protocol_ const* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->serializedStructSize("TypeAndMaskEntry");
  {
    xfer += prot_->serializedFieldSize("type", apache::thrift::protocol::T_STRUCT, 1);
    xfer += ::apache::thrift::op::serialized_size<false, ::apache::thrift::type::adapted<::apache::thrift::InlineAdapter<::apache::thrift::type::Type>, ::apache::thrift::type::struct_t<::apache::thrift::type::TypeStruct>>>(*prot_, this->__fbthrift_field_type);
  }
  {
    xfer += prot_->serializedFieldSize("mask", apache::thrift::protocol::T_STRUCT, 2);
    xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::variant, ::apache::thrift::protocol::Mask>::serializedSize<false>(*prot_, this->__fbthrift_field_mask);
  }
  xfer += prot_->serializedSizeStop();
  return xfer;
}

template <class Protocol_>
uint32_t TypeAndMaskEntry::serializedSizeZC(Protocol_ const* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->serializedStructSize("TypeAndMaskEntry");
  {
    xfer += prot_->serializedFieldSize("type", apache::thrift::protocol::T_STRUCT, 1);
    xfer += ::apache::thrift::op::serialized_size<true, ::apache::thrift::type::adapted<::apache::thrift::InlineAdapter<::apache::thrift::type::Type>, ::apache::thrift::type::struct_t<::apache::thrift::type::TypeStruct>>>(*prot_, this->__fbthrift_field_type);
  }
  {
    xfer += prot_->serializedFieldSize("mask", apache::thrift::protocol::T_STRUCT, 2);
    xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::variant, ::apache::thrift::protocol::Mask>::serializedSize<true>(*prot_, this->__fbthrift_field_mask);
  }
  xfer += prot_->serializedSizeStop();
  return xfer;
}

template <class Protocol_>
uint32_t TypeAndMaskEntry::write(Protocol_* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->writeStructBegin("TypeAndMaskEntry");
  bool previousFieldHasValue = true;
  {
    constexpr int16_t kPrevFieldId = 0;
    xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_STRUCT, 1, kPrevFieldId>(*prot_, "type", previousFieldHasValue);
    previousFieldHasValue = true;
    xfer += ::apache::thrift::op::encode<::apache::thrift::type::adapted<::apache::thrift::InlineAdapter<::apache::thrift::type::Type>, ::apache::thrift::type::struct_t<::apache::thrift::type::TypeStruct>>>(*prot_, this->__fbthrift_field_type);
    xfer += prot_->writeFieldEnd();
  }
  {
    constexpr int16_t kPrevFieldId = 1;
    xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_STRUCT, 2, kPrevFieldId>(*prot_, "mask", previousFieldHasValue);
    previousFieldHasValue = true;
    xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::variant, ::apache::thrift::protocol::Mask>::write(*prot_, this->__fbthrift_field_mask);
    xfer += prot_->writeFieldEnd();
  }
  xfer += prot_->writeFieldStop();
  xfer += prot_->writeStructEnd();
  return xfer;
}

extern template void TypeAndMaskEntry::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
extern template uint32_t TypeAndMaskEntry::write<>(apache::thrift::BinaryProtocolWriter*) const;
extern template uint32_t TypeAndMaskEntry::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t TypeAndMaskEntry::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template void TypeAndMaskEntry::readNoXfer<>(apache::thrift::CompactProtocolReader*);
extern template uint32_t TypeAndMaskEntry::write<>(apache::thrift::CompactProtocolWriter*) const;
extern template uint32_t TypeAndMaskEntry::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
extern template uint32_t TypeAndMaskEntry::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


template <class Protocol_>
void Mask::readNoXfer(Protocol_* iprot) {
  apache::thrift::detail::ProtocolReaderStructReadState<Protocol_> _readState;
  _readState.fieldId = 0;

  _readState.readStructBegin(iprot);

  _readState.readFieldBegin(iprot);
  if (_readState.atStop()) {
    apache::thrift::clear(*this);
  } else {
    if (iprot->kUsesFieldNames()) {
      _readState.template fillFieldTraitsFromName<apache::thrift::detail::TccStructTraits<Mask>>();
    }
    switch (_readState.fieldId) {
      case 1:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->excludes_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::FieldIdToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.excludes = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 2:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->includes_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::FieldIdToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.includes = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 3:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->excludes_map_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::MapIdToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.excludes_map = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 4:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->includes_map_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::MapIdToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.includes_map = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 5:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->excludes_string_map_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::MapStringToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.excludes_string_map = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 6:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP)) {
          this->includes_string_map_ref().emplace();
          _readState.beforeSubobject(iprot);
          auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::apache::thrift::protocol::MapStringToMask>>();
          ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::readWithContext(*iprot, *ptr, _readState);
          value_.includes_string_map = std::move(ptr);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 7:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_LIST)) {
          this->excludes_type_ref().emplace();
          _readState.beforeSubobject(iprot);
          ::apache::thrift::op::decode<::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
                ::apache::thrift::protocol::TypeAndMaskEntry,
                ::apache::thrift::protocol::Mask
              >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*iprot, value_.excludes_type);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      case 8:
      {
        if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_LIST)) {
          this->includes_type_ref().emplace();
          _readState.beforeSubobject(iprot);
          ::apache::thrift::op::decode<::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
                ::apache::thrift::protocol::TypeAndMaskEntry,
                ::apache::thrift::protocol::Mask
              >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*iprot, value_.includes_type);
          _readState.afterSubobject(iprot);
        } else {
          _readState.skip(iprot);
        }
        break;
      }
      default:
      {
        _readState.skip(iprot);
        break;
      }
    }
    _readState.readFieldEnd(iprot);
    _readState.readFieldBegin(iprot);
    if (UNLIKELY(!_readState.atStop())) {
      using apache::thrift::protocol::TProtocolException;
      TProtocolException::throwUnionMissingStop();
    }
  }
  _readState.readStructEnd(iprot);
}
template <class Protocol_>
uint32_t Mask::serializedSize(Protocol_ const* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->serializedStructSize("Mask");
  switch(this->getType()) {
    case Mask::Type::excludes:
    {
      xfer += prot_->serializedFieldSize("excludes", apache::thrift::protocol::T_MAP, 1);
      if (value_.excludes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::serializedSize<false>(*prot_, *value_.excludes);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes:
    {
      xfer += prot_->serializedFieldSize("includes", apache::thrift::protocol::T_MAP, 2);
      if (value_.includes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::serializedSize<false>(*prot_, *value_.includes);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_map:
    {
      xfer += prot_->serializedFieldSize("excludes_map", apache::thrift::protocol::T_MAP, 3);
      if (value_.excludes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::serializedSize<false>(*prot_, *value_.excludes_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes_map:
    {
      xfer += prot_->serializedFieldSize("includes_map", apache::thrift::protocol::T_MAP, 4);
      if (value_.includes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::serializedSize<false>(*prot_, *value_.includes_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_string_map:
    {
      xfer += prot_->serializedFieldSize("excludes_string_map", apache::thrift::protocol::T_MAP, 5);
      if (value_.excludes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::serializedSize<false>(*prot_, *value_.excludes_string_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes_string_map:
    {
      xfer += prot_->serializedFieldSize("includes_string_map", apache::thrift::protocol::T_MAP, 6);
      if (value_.includes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::serializedSize<false>(*prot_, *value_.includes_string_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_type:
    {
      xfer += prot_->serializedFieldSize("excludes_type", apache::thrift::protocol::T_LIST, 7);
      xfer += ::apache::thrift::op::serialized_size<false, ::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.excludes_type);
      break;
    }
    case Mask::Type::includes_type:
    {
      xfer += prot_->serializedFieldSize("includes_type", apache::thrift::protocol::T_LIST, 8);
      xfer += ::apache::thrift::op::serialized_size<false, ::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.includes_type);
      break;
    }
    case Mask::Type::__EMPTY__:;
  }
  xfer += prot_->serializedSizeStop();
  return xfer;
}

template <class Protocol_>
uint32_t Mask::serializedSizeZC(Protocol_ const* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->serializedStructSize("Mask");
  switch(this->getType()) {
    case Mask::Type::excludes:
    {
      xfer += prot_->serializedFieldSize("excludes", apache::thrift::protocol::T_MAP, 1);
      if (value_.excludes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::serializedSize<false>(*prot_, *value_.excludes);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes:
    {
      xfer += prot_->serializedFieldSize("includes", apache::thrift::protocol::T_MAP, 2);
      if (value_.includes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::serializedSize<false>(*prot_, *value_.includes);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_map:
    {
      xfer += prot_->serializedFieldSize("excludes_map", apache::thrift::protocol::T_MAP, 3);
      if (value_.excludes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::serializedSize<false>(*prot_, *value_.excludes_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes_map:
    {
      xfer += prot_->serializedFieldSize("includes_map", apache::thrift::protocol::T_MAP, 4);
      if (value_.includes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::serializedSize<false>(*prot_, *value_.includes_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_string_map:
    {
      xfer += prot_->serializedFieldSize("excludes_string_map", apache::thrift::protocol::T_MAP, 5);
      if (value_.excludes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::serializedSize<false>(*prot_, *value_.excludes_string_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::includes_string_map:
    {
      xfer += prot_->serializedFieldSize("includes_string_map", apache::thrift::protocol::T_MAP, 6);
      if (value_.includes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::serializedSize<false>(*prot_, *value_.includes_string_map);
      } else {
        xfer += prot_->serializedSizeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->serializedSizeMapEnd();
      }
      break;
    }
    case Mask::Type::excludes_type:
    {
      xfer += prot_->serializedFieldSize("excludes_type", apache::thrift::protocol::T_LIST, 7);
      xfer += ::apache::thrift::op::serialized_size<false, ::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.excludes_type);
      break;
    }
    case Mask::Type::includes_type:
    {
      xfer += prot_->serializedFieldSize("includes_type", apache::thrift::protocol::T_LIST, 8);
      xfer += ::apache::thrift::op::serialized_size<false, ::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.includes_type);
      break;
    }
    case Mask::Type::__EMPTY__:;
  }
  xfer += prot_->serializedSizeStop();
  return xfer;
}

template <class Protocol_>
uint32_t Mask::write(Protocol_* prot_) const {
  uint32_t xfer = 0;
  xfer += prot_->writeStructBegin("Mask");
  switch(this->getType()) {
    case Mask::Type::excludes:
    {
      constexpr int16_t kPrevFieldId = 0;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 1, kPrevFieldId>(*prot_, "excludes", false);
      if (value_.excludes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::write(*prot_, *value_.excludes);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::includes:
    {
      constexpr int16_t kPrevFieldId = 1;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 2, kPrevFieldId>(*prot_, "includes", false);
      if (value_.includes) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::FieldIdToMask>::write(*prot_, *value_.includes);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_I16, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::excludes_map:
    {
      constexpr int16_t kPrevFieldId = 2;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 3, kPrevFieldId>(*prot_, "excludes_map", false);
      if (value_.excludes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::write(*prot_, *value_.excludes_map);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::includes_map:
    {
      constexpr int16_t kPrevFieldId = 3;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 4, kPrevFieldId>(*prot_, "includes_map", false);
      if (value_.includes_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapIdToMask>::write(*prot_, *value_.includes_map);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_I64, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::excludes_string_map:
    {
      constexpr int16_t kPrevFieldId = 4;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 5, kPrevFieldId>(*prot_, "excludes_string_map", false);
      if (value_.excludes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::write(*prot_, *value_.excludes_string_map);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::includes_string_map:
    {
      constexpr int16_t kPrevFieldId = 5;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_MAP, 6, kPrevFieldId>(*prot_, "includes_string_map", false);
      if (value_.includes_string_map) {
        xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::string, ::apache::thrift::type_class::variant>, ::apache::thrift::protocol::MapStringToMask>::write(*prot_, *value_.includes_string_map);
      } else {
        xfer += prot_->writeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRUCT, 0);
        xfer += prot_->writeMapEnd();
      }
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::excludes_type:
    {
      constexpr int16_t kPrevFieldId = 6;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_LIST, 7, kPrevFieldId>(*prot_, "excludes_type", false);
      xfer += ::apache::thrift::op::encode<::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.excludes_type);
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::includes_type:
    {
      constexpr int16_t kPrevFieldId = 7;
      xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_LIST, 8, kPrevFieldId>(*prot_, "includes_type", false);
      xfer += ::apache::thrift::op::encode<::apache::thrift::type::adapted<::apache::thrift::protocol::detail::TypeToMaskAdapter<
        ::apache::thrift::protocol::TypeAndMaskEntry,
        ::apache::thrift::protocol::Mask
      >, ::apache::thrift::type::list<::apache::thrift::type::struct_t<::apache::thrift::protocol::TypeAndMaskEntry>>>>(*prot_, value_.includes_type);
      xfer += prot_->writeFieldEnd();
      break;
    }
    case Mask::Type::__EMPTY__:;
  }
  xfer += prot_->writeFieldStop();
  xfer += prot_->writeStructEnd();
  return xfer;
}

extern template void Mask::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
extern template uint32_t Mask::write<>(apache::thrift::BinaryProtocolWriter*) const;
extern template uint32_t Mask::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template uint32_t Mask::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
extern template void Mask::readNoXfer<>(apache::thrift::CompactProtocolReader*);
extern template uint32_t Mask::write<>(apache::thrift::CompactProtocolWriter*) const;
extern template uint32_t Mask::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
extern template uint32_t Mask::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::protocol
