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

#include "fileformat.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 _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace OSMPBF {
PROTOBUF_CONSTEXPR Blob::Blob(
    ::_pbi::ConstantInitialized)
  : raw_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , zlib_data_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , lzma_data_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , obsolete_bzip2_data_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , raw_size_(0){}
struct BlobDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BlobDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BlobDefaultTypeInternal() {}
  union {
    Blob _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BlobDefaultTypeInternal _Blob_default_instance_;
PROTOBUF_CONSTEXPR BlobHeader::BlobHeader(
    ::_pbi::ConstantInitialized)
  : type_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , indexdata_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
  , datasize_(0){}
struct BlobHeaderDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BlobHeaderDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BlobHeaderDefaultTypeInternal() {}
  union {
    BlobHeader _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BlobHeaderDefaultTypeInternal _BlobHeader_default_instance_;
}  // namespace OSMPBF
namespace OSMPBF {

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

class Blob::_Internal {
 public:
  using HasBits = decltype(std::declval<Blob>()._has_bits_);
  static void set_has_raw(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_raw_size(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_zlib_data(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_lzma_data(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_obsolete_bzip2_data(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
};

Blob::Blob(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:OSMPBF.Blob)
}
Blob::Blob(const Blob& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  raw_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    raw_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_raw()) {
    raw_.Set(from._internal_raw(), 
      GetArenaForAllocation());
  }
  zlib_data_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    zlib_data_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_zlib_data()) {
    zlib_data_.Set(from._internal_zlib_data(), 
      GetArenaForAllocation());
  }
  lzma_data_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    lzma_data_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_lzma_data()) {
    lzma_data_.Set(from._internal_lzma_data(), 
      GetArenaForAllocation());
  }
  obsolete_bzip2_data_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    obsolete_bzip2_data_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_obsolete_bzip2_data()) {
    obsolete_bzip2_data_.Set(from._internal_obsolete_bzip2_data(), 
      GetArenaForAllocation());
  }
  raw_size_ = from.raw_size_;
  // @@protoc_insertion_point(copy_constructor:OSMPBF.Blob)
}

inline void Blob::SharedCtor() {
raw_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  raw_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
zlib_data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  zlib_data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
lzma_data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  lzma_data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
obsolete_bzip2_data_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  obsolete_bzip2_data_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
raw_size_ = 0;
}

Blob::~Blob() {
  // @@protoc_insertion_point(destructor:OSMPBF.Blob)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void Blob::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  raw_.Destroy();
  zlib_data_.Destroy();
  lzma_data_.Destroy();
  obsolete_bzip2_data_.Destroy();
}

void Blob::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Blob::Clear() {
// @@protoc_insertion_point(message_clear_start:OSMPBF.Blob)
  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) {
    if (cached_has_bits & 0x00000001u) {
      raw_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      zlib_data_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      lzma_data_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000008u) {
      obsolete_bzip2_data_.ClearNonDefaultToEmpty();
    }
  }
  raw_size_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Blob::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional bytes raw = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_raw();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 raw_size = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
          _Internal::set_has_raw_size(&has_bits);
          raw_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes zlib_data = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          auto str = _internal_mutable_zlib_data();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes lzma_data = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          auto str = _internal_mutable_lzma_data();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes OBSOLETE_bzip2_data = 5 [deprecated = true];
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          auto str = _internal_mutable_obsolete_bzip2_data();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          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:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  cached_has_bits = _has_bits_[0];
  // optional bytes raw = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteBytesMaybeAliased(
        1, this->_internal_raw(), target);
  }

  // optional int32 raw_size = 2;
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_raw_size(), target);
  }

  // optional bytes zlib_data = 3;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteBytesMaybeAliased(
        3, this->_internal_zlib_data(), target);
  }

  // optional bytes lzma_data = 4;
  if (cached_has_bits & 0x00000004u) {
    target = stream->WriteBytesMaybeAliased(
        4, this->_internal_lzma_data(), target);
  }

  // optional bytes OBSOLETE_bzip2_data = 5 [deprecated = true];
  if (cached_has_bits & 0x00000008u) {
    target = stream->WriteBytesMaybeAliased(
        5, this->_internal_obsolete_bzip2_data(), 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:OSMPBF.Blob)
  return target;
}

size_t Blob::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:OSMPBF.Blob)
  size_t total_size = 0;

  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 & 0x0000001fu) {
    // optional bytes raw = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_raw());
    }

    // optional bytes zlib_data = 3;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_zlib_data());
    }

    // optional bytes lzma_data = 4;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_lzma_data());
    }

    // optional bytes OBSOLETE_bzip2_data = 5 [deprecated = true];
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
          this->_internal_obsolete_bzip2_data());
    }

    // optional int32 raw_size = 2;
    if (cached_has_bits & 0x00000010u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_raw_size());
    }

  }
  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 = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

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

void Blob::MergeFrom(const Blob& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:OSMPBF.Blob)
  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 & 0x0000001fu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_raw(from._internal_raw());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_zlib_data(from._internal_zlib_data());
    }
    if (cached_has_bits & 0x00000004u) {
      _internal_set_lzma_data(from._internal_lzma_data());
    }
    if (cached_has_bits & 0x00000008u) {
      _internal_set_obsolete_bzip2_data(from._internal_obsolete_bzip2_data());
    }
    if (cached_has_bits & 0x00000010u) {
      raw_size_ = from.raw_size_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void Blob::InternalSwap(Blob* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &raw_, lhs_arena,
      &other->raw_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &zlib_data_, lhs_arena,
      &other->zlib_data_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &lzma_data_, lhs_arena,
      &other->lzma_data_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &obsolete_bzip2_data_, lhs_arena,
      &other->obsolete_bzip2_data_, rhs_arena
  );
  swap(raw_size_, other->raw_size_);
}

std::string Blob::GetTypeName() const {
  return "OSMPBF.Blob";
}


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

class BlobHeader::_Internal {
 public:
  using HasBits = decltype(std::declval<BlobHeader>()._has_bits_);
  static void set_has_type(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_indexdata(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_datasize(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000005) ^ 0x00000005) != 0;
  }
};

BlobHeader::BlobHeader(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:OSMPBF.BlobHeader)
}
BlobHeader::BlobHeader(const BlobHeader& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  type_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    type_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_type()) {
    type_.Set(from._internal_type(), 
      GetArenaForAllocation());
  }
  indexdata_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    indexdata_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_indexdata()) {
    indexdata_.Set(from._internal_indexdata(), 
      GetArenaForAllocation());
  }
  datasize_ = from.datasize_;
  // @@protoc_insertion_point(copy_constructor:OSMPBF.BlobHeader)
}

inline void BlobHeader::SharedCtor() {
type_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  type_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
indexdata_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
  indexdata_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
datasize_ = 0;
}

BlobHeader::~BlobHeader() {
  // @@protoc_insertion_point(destructor:OSMPBF.BlobHeader)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void BlobHeader::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  type_.Destroy();
  indexdata_.Destroy();
}

void BlobHeader::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void BlobHeader::Clear() {
// @@protoc_insertion_point(message_clear_start:OSMPBF.BlobHeader)
  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 & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      type_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      indexdata_.ClearNonDefaultToEmpty();
    }
  }
  datasize_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* BlobHeader::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // required string type = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          auto str = _internal_mutable_type();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bytes indexdata = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          auto str = _internal_mutable_indexdata();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // required int32 datasize = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          _Internal::set_has_datasize(&has_bits);
          datasize_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&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:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  cached_has_bits = _has_bits_[0];
  // required string type = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_type(), target);
  }

  // optional bytes indexdata = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->WriteBytesMaybeAliased(
        2, this->_internal_indexdata(), target);
  }

  // required int32 datasize = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_datasize(), 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:OSMPBF.BlobHeader)
  return target;
}

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

  if (_internal_has_type()) {
    // required string type = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_type());
  }

  if (_internal_has_datasize()) {
    // required int32 datasize = 3;
    total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_datasize());
  }

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

  if (((_has_bits_[0] & 0x00000005) ^ 0x00000005) == 0) {  // All required fields are present.
    // required string type = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_type());

    // required int32 datasize = 3;
    total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_datasize());

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

  // optional bytes indexdata = 2;
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000002u) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
        this->_internal_indexdata());
  }

  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 = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

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

void BlobHeader::MergeFrom(const BlobHeader& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:OSMPBF.BlobHeader)
  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 & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_type(from._internal_type());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_indexdata(from._internal_indexdata());
    }
    if (cached_has_bits & 0x00000004u) {
      datasize_ = from.datasize_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void BlobHeader::InternalSwap(BlobHeader* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &type_, lhs_arena,
      &other->type_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &indexdata_, lhs_arena,
      &other->indexdata_, rhs_arena
  );
  swap(datasize_, other->datasize_);
}

std::string BlobHeader::GetTypeName() const {
  return "OSMPBF.BlobHeader";
}


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

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