// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/any_test.proto

#include <google/protobuf/any_test.pb.h>

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace protobuf_google_2fprotobuf_2fany_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fany_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Any;
}  // namespace protobuf_google_2fprotobuf_2fany_2eproto
namespace protobuf_unittest {
class TestAnyDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TestAny>
      _instance;
} _TestAny_default_instance_;
}  // namespace protobuf_unittest
namespace protobuf_google_2fprotobuf_2fany_5ftest_2eproto {
static void InitDefaultsTestAny() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf_unittest::_TestAny_default_instance_;
    new (ptr) ::protobuf_unittest::TestAny();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf_unittest::TestAny::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_TestAny =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestAny}, {
      &protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any.base,}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_TestAny.base);
}

::google::protobuf::Metadata file_level_metadata[1];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, int32_value_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, any_value_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, repeated_any_value_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(::protobuf_unittest::TestAny)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestAny_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "google/protobuf/any_test.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, NULL, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n\036google/protobuf/any_test.proto\022\021protob"
      "uf_unittest\032\031google/protobuf/any.proto\"y"
      "\n\007TestAny\022\023\n\013int32_value\030\001 \001(\005\022\'\n\tany_va"
      "lue\030\002 \001(\0132\024.google.protobuf.Any\0220\n\022repea"
      "ted_any_value\030\003 \003(\0132\024.google.protobuf.An"
      "yb\006proto3"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 209);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "google/protobuf/any_test.proto", &protobuf_RegisterTypes);
  ::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_google_2fprotobuf_2fany_5ftest_2eproto
namespace protobuf_unittest {

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

void TestAny::InitAsDefaultInstance() {
  ::protobuf_unittest::_TestAny_default_instance_._instance.get_mutable()->any_value_ = const_cast< ::google::protobuf::Any*>(
      ::google::protobuf::Any::internal_default_instance());
}
void TestAny::clear_any_value() {
  if (GetArenaNoVirtual() == NULL && any_value_ != NULL) {
    delete any_value_;
  }
  any_value_ = NULL;
}
void TestAny::clear_repeated_any_value() {
  repeated_any_value_.Clear();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TestAny::kInt32ValueFieldNumber;
const int TestAny::kAnyValueFieldNumber;
const int TestAny::kRepeatedAnyValueFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TestAny::TestAny()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_google_2fprotobuf_2fany_5ftest_2eproto::scc_info_TestAny.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:protobuf_unittest.TestAny)
}
TestAny::TestAny(const TestAny& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      repeated_any_value_(from.repeated_any_value_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_any_value()) {
    any_value_ = new ::google::protobuf::Any(*from.any_value_);
  } else {
    any_value_ = NULL;
  }
  int32_value_ = from.int32_value_;
  // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestAny)
}

void TestAny::SharedCtor() {
  ::memset(&any_value_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&int32_value_) -
      reinterpret_cast<char*>(&any_value_)) + sizeof(int32_value_));
}

TestAny::~TestAny() {
  // @@protoc_insertion_point(destructor:protobuf_unittest.TestAny)
  SharedDtor();
}

void TestAny::SharedDtor() {
  if (this != internal_default_instance()) delete any_value_;
}

void TestAny::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TestAny::descriptor() {
  ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TestAny& TestAny::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fany_5ftest_2eproto::scc_info_TestAny.base);
  return *internal_default_instance();
}


void TestAny::Clear() {
// @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestAny)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  repeated_any_value_.Clear();
  if (GetArenaNoVirtual() == NULL && any_value_ != NULL) {
    delete any_value_;
  }
  any_value_ = NULL;
  int32_value_ = 0;
  _internal_metadata_.Clear();
}

bool TestAny::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:protobuf_unittest.TestAny)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // int32 int32_value = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &int32_value_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .google.protobuf.Any any_value = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_any_value()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .google.protobuf.Any repeated_any_value = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_repeated_any_value()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:protobuf_unittest.TestAny)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestAny)
  return false;
#undef DO_
}

void TestAny::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestAny)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // int32 int32_value = 1;
  if (this->int32_value() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->int32_value(), output);
  }

  // .google.protobuf.Any any_value = 2;
  if (this->has_any_value()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->_internal_any_value(), output);
  }

  // repeated .google.protobuf.Any repeated_any_value = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->repeated_any_value_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      3,
      this->repeated_any_value(static_cast<int>(i)),
      output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestAny)
}

::google::protobuf::uint8* TestAny::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestAny)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // int32 int32_value = 1;
  if (this->int32_value() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->int32_value(), target);
  }

  // .google.protobuf.Any any_value = 2;
  if (this->has_any_value()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->_internal_any_value(), deterministic, target);
  }

  // repeated .google.protobuf.Any repeated_any_value = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->repeated_any_value_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        3, this->repeated_any_value(static_cast<int>(i)), deterministic, target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestAny)
  return target;
}

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

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated .google.protobuf.Any repeated_any_value = 3;
  {
    unsigned int count = static_cast<unsigned int>(this->repeated_any_value_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->repeated_any_value(static_cast<int>(i)));
    }
  }

  // .google.protobuf.Any any_value = 2;
  if (this->has_any_value()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *any_value_);
  }

  // int32 int32_value = 1;
  if (this->int32_value() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int32Size(
        this->int32_value());
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TestAny::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestAny)
  GOOGLE_DCHECK_NE(&from, this);
  const TestAny* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TestAny>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestAny)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestAny)
    MergeFrom(*source);
  }
}

void TestAny::MergeFrom(const TestAny& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestAny)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  repeated_any_value_.MergeFrom(from.repeated_any_value_);
  if (from.has_any_value()) {
    mutable_any_value()->::google::protobuf::Any::MergeFrom(from.any_value());
  }
  if (from.int32_value() != 0) {
    set_int32_value(from.int32_value());
  }
}

void TestAny::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestAny)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

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

void TestAny::Swap(TestAny* other) {
  if (other == this) return;
  InternalSwap(other);
}
void TestAny::InternalSwap(TestAny* other) {
  using std::swap;
  CastToBase(&repeated_any_value_)->InternalSwap(CastToBase(&other->repeated_any_value_));
  swap(any_value_, other->any_value_);
  swap(int32_value_, other->int32_value_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata TestAny::GetMetadata() const {
  protobuf_google_2fprotobuf_2fany_5ftest_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::file_level_metadata[kIndexInFileMessages];
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace protobuf_unittest
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestAny* Arena::CreateMaybeMessage< ::protobuf_unittest::TestAny >(Arena* arena) {
  return Arena::CreateInternal< ::protobuf_unittest::TestAny >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)
