text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: tensorflow_serving/apis/inference.proto

#include "tensorflow_serving/apis/inference.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_tensorflow_5fserving_2fapis_2fclassification_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2fclassification_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_ClassificationResult;
}  // namespace protobuf_tensorflow_5fserving_2fapis_2fclassification_2eproto
namespace protobuf_tensorflow_5fserving_2fapis_2finference_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2finference_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_InferenceTask;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2finference_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_InferenceResult;
}  // namespace protobuf_tensorflow_5fserving_2fapis_2finference_2eproto
namespace protobuf_tensorflow_5fserving_2fapis_2finput_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2finput_2eproto ::google::protobuf::internal::SCCInfo<2> scc_info_Input;
}  // namespace protobuf_tensorflow_5fserving_2fapis_2finput_2eproto
namespace protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_ModelSpec;
}  // namespace protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto
namespace protobuf_tensorflow_5fserving_2fapis_2fregression_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_5fserving_2fapis_2fregression_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_RegressionResult;
}  // namespace protobuf_tensorflow_5fserving_2fapis_2fregression_2eproto
namespace tensorflow {
namespace serving {
class InferenceTaskDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<InferenceTask>
      _instance;
} _InferenceTask_default_instance_;
class InferenceResultDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<InferenceResult>
      _instance;
  const ::tensorflow::serving::ClassificationResult* classification_result_;
  const ::tensorflow::serving::RegressionResult* regression_result_;
} _InferenceResult_default_instance_;
class MultiInferenceRequestDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<MultiInferenceRequest>
      _instance;
} _MultiInferenceRequest_default_instance_;
class MultiInferenceResponseDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<MultiInferenceResponse>
      _instance;
} _MultiInferenceResponse_default_instance_;
}  // namespace serving
}  // namespace tensorflow
namespace protobuf_tensorflow_5fserving_2fapis_2finference_2eproto {
static void InitDefaultsInferenceTask() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::tensorflow::serving::_InferenceTask_default_instance_;
    new (ptr) ::tensorflow::serving::InferenceTask();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::tensorflow::serving::InferenceTask::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_InferenceTask =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsInferenceTask}, {
      &protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto::scc_info_ModelSpec.base,}};

static void InitDefaultsInferenceResult() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::tensorflow::serving::_InferenceResult_default_instance_;
    new (ptr) ::tensorflow::serving::InferenceResult();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::tensorflow::serving::InferenceResult::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<3> scc_info_InferenceResult =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsInferenceResult}, {
      &protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto::scc_info_ModelSpec.base,
      &protobuf_tensorflow_5fserving_2fapis_2fclassification_2eproto::scc_info_ClassificationResult.base,
      &protobuf_tensorflow_5fserving_2fapis_2fregression_2eproto::scc_info_RegressionResult.base,}};

static void InitDefaultsMultiInferenceRequest() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::tensorflow::serving::_MultiInferenceRequest_default_instance_;
    new (ptr) ::tensorflow::serving::MultiInferenceRequest();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::tensorflow::serving::MultiInferenceRequest::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<2> scc_info_MultiInferenceRequest =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsMultiInferenceRequest}, {
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceTask.base,
      &protobuf_tensorflow_5fserving_2fapis_2finput_2eproto::scc_info_Input.base,}};

static void InitDefaultsMultiInferenceResponse() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::tensorflow::serving::_MultiInferenceResponse_default_instance_;
    new (ptr) ::tensorflow::serving::MultiInferenceResponse();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::tensorflow::serving::MultiInferenceResponse::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<1> scc_info_MultiInferenceResponse =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsMultiInferenceResponse}, {
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceResult.base,}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_InferenceTask.base);
  ::google::protobuf::internal::InitSCC(&scc_info_InferenceResult.base);
  ::google::protobuf::internal::InitSCC(&scc_info_MultiInferenceRequest.base);
  ::google::protobuf::internal::InitSCC(&scc_info_MultiInferenceResponse.base);
}

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

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceTask, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceTask, model_spec_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceTask, method_name_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceResult, _internal_metadata_),
  ~0u,  // no _extensions_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceResult, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceResult, model_spec_),
  offsetof(::tensorflow::serving::InferenceResultDefaultTypeInternal, classification_result_),
  offsetof(::tensorflow::serving::InferenceResultDefaultTypeInternal, regression_result_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::InferenceResult, result_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::MultiInferenceRequest, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::MultiInferenceRequest, tasks_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::MultiInferenceRequest, input_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::MultiInferenceResponse, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::serving::MultiInferenceResponse, results_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(::tensorflow::serving::InferenceTask)},
  { 7, -1, sizeof(::tensorflow::serving::InferenceResult)},
  { 16, -1, sizeof(::tensorflow::serving::MultiInferenceRequest)},
  { 23, -1, sizeof(::tensorflow::serving::MultiInferenceResponse)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::tensorflow::serving::_InferenceTask_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::tensorflow::serving::_InferenceResult_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::tensorflow::serving::_MultiInferenceRequest_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::tensorflow::serving::_MultiInferenceResponse_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "tensorflow_serving/apis/inference.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, 4);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n\'tensorflow_serving/apis/inference.prot"
      "o\022\022tensorflow.serving\032,tensorflow_servin"
      "g/apis/classification.proto\032#tensorflow_"
      "serving/apis/input.proto\032#tensorflow_ser"
      "ving/apis/model.proto\032(tensorflow_servin"
      "g/apis/regression.proto\"W\n\rInferenceTask"
      "\0221\n\nmodel_spec\030\001 \001(\0132\035.tensorflow.servin"
      "g.ModelSpec\022\023\n\013method_name\030\002 \001(\t\"\334\001\n\017Inf"
      "erenceResult\0221\n\nmodel_spec\030\001 \001(\0132\035.tenso"
      "rflow.serving.ModelSpec\022I\n\025classificatio"
      "n_result\030\002 \001(\0132(.tensorflow.serving.Clas"
      "sificationResultH\000\022A\n\021regression_result\030"
      "\003 \001(\0132$.tensorflow.serving.RegressionRes"
      "ultH\000B\010\n\006result\"s\n\025MultiInferenceRequest"
      "\0220\n\005tasks\030\001 \003(\0132!.tensorflow.serving.Inf"
      "erenceTask\022(\n\005input\030\002 \001(\0132\031.tensorflow.s"
      "erving.Input\"N\n\026MultiInferenceResponse\0224"
      "\n\007results\030\001 \003(\0132#.tensorflow.serving.Inf"
      "erenceResultB\003\370\001\001b\006proto3"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 745);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "tensorflow_serving/apis/inference.proto", &protobuf_RegisterTypes);
  ::protobuf_tensorflow_5fserving_2fapis_2fclassification_2eproto::AddDescriptors();
  ::protobuf_tensorflow_5fserving_2fapis_2finput_2eproto::AddDescriptors();
  ::protobuf_tensorflow_5fserving_2fapis_2fmodel_2eproto::AddDescriptors();
  ::protobuf_tensorflow_5fserving_2fapis_2fregression_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_tensorflow_5fserving_2fapis_2finference_2eproto
namespace tensorflow {
namespace serving {

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

void InferenceTask::InitAsDefaultInstance() {
  ::tensorflow::serving::_InferenceTask_default_instance_._instance.get_mutable()->model_spec_ = const_cast< ::tensorflow::serving::ModelSpec*>(
      ::tensorflow::serving::ModelSpec::internal_default_instance());
}
void InferenceTask::unsafe_arena_set_allocated_model_spec(
    ::tensorflow::serving::ModelSpec* model_spec) {
  if (GetArenaNoVirtual() == NULL) {
    delete model_spec_;
  }
  model_spec_ = model_spec;
  if (model_spec) {

  } else {

  }
  // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.serving.InferenceTask.model_spec)
}
void InferenceTask::clear_model_spec() {
  if (GetArenaNoVirtual() == NULL && model_spec_ != NULL) {
    delete model_spec_;
  }
  model_spec_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int InferenceTask::kModelSpecFieldNumber;
const int InferenceTask::kMethodNameFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

InferenceTask::InferenceTask()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceTask.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:tensorflow.serving.InferenceTask)
}
InferenceTask::InferenceTask(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceTask.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:tensorflow.serving.InferenceTask)
}
InferenceTask::InferenceTask(const InferenceTask& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  method_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.method_name().size() > 0) {
    method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.method_name(),
      GetArenaNoVirtual());
  }
  if (from.has_model_spec()) {
    model_spec_ = new ::tensorflow::serving::ModelSpec(*from.model_spec_);
  } else {
    model_spec_ = NULL;
  }
  // @@protoc_insertion_point(copy_constructor:tensorflow.serving.InferenceTask)
}

void InferenceTask::SharedCtor() {
  method_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  model_spec_ = NULL;
}

InferenceTask::~InferenceTask() {
  // @@protoc_insertion_point(destructor:tensorflow.serving.InferenceTask)
  SharedDtor();
}

void InferenceTask::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  method_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete model_spec_;
}

void InferenceTask::ArenaDtor(void* object) {
  InferenceTask* _this = reinterpret_cast< InferenceTask* >(object);
  (void)_this;
}
void InferenceTask::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void InferenceTask::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* InferenceTask::descriptor() {
  ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const InferenceTask& InferenceTask::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceTask.base);
  return *internal_default_instance();
}

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

  method_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
  if (GetArenaNoVirtual() == NULL && model_spec_ != NULL) {
    delete model_spec_;
  }
  model_spec_ = NULL;
  _internal_metadata_.Clear();
}

bool InferenceTask::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:tensorflow.serving.InferenceTask)
  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)) {
      // .tensorflow.serving.ModelSpec model_spec = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_model_spec()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // string method_name = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_method_name()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->method_name().data(), static_cast<int>(this->method_name().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "tensorflow.serving.InferenceTask.method_name"));
        } 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:tensorflow.serving.InferenceTask)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:tensorflow.serving.InferenceTask)
  return false;
#undef DO_
}

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

  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->_internal_model_spec(), output);
  }

  // string method_name = 2;
  if (this->method_name().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->method_name().data(), static_cast<int>(this->method_name().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "tensorflow.serving.InferenceTask.method_name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      2, this->method_name(), 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:tensorflow.serving.InferenceTask)
}

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

  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->_internal_model_spec(), deterministic, target);
  }

  // string method_name = 2;
  if (this->method_name().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->method_name().data(), static_cast<int>(this->method_name().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "tensorflow.serving.InferenceTask.method_name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        2, this->method_name(), 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:tensorflow.serving.InferenceTask)
  return target;
}

size_t InferenceTask::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.serving.InferenceTask)
  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()));
  }
  // string method_name = 2;
  if (this->method_name().size() > 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->method_name());
  }

  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *model_spec_);
  }

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

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

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

  if (from.method_name().size() > 0) {
    set_method_name(from.method_name());
  }
  if (from.has_model_spec()) {
    mutable_model_spec()->::tensorflow::serving::ModelSpec::MergeFrom(from.model_spec());
  }
}

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

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

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

void InferenceTask::Swap(InferenceTask* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    InferenceTask* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void InferenceTask::UnsafeArenaSwap(InferenceTask* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void InferenceTask::InternalSwap(InferenceTask* other) {
  using std::swap;
  method_name_.Swap(&other->method_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(model_spec_, other->model_spec_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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

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

void InferenceResult::InitAsDefaultInstance() {
  ::tensorflow::serving::_InferenceResult_default_instance_._instance.get_mutable()->model_spec_ = const_cast< ::tensorflow::serving::ModelSpec*>(
      ::tensorflow::serving::ModelSpec::internal_default_instance());
  ::tensorflow::serving::_InferenceResult_default_instance_.classification_result_ = const_cast< ::tensorflow::serving::ClassificationResult*>(
      ::tensorflow::serving::ClassificationResult::internal_default_instance());
  ::tensorflow::serving::_InferenceResult_default_instance_.regression_result_ = const_cast< ::tensorflow::serving::RegressionResult*>(
      ::tensorflow::serving::RegressionResult::internal_default_instance());
}
void InferenceResult::unsafe_arena_set_allocated_model_spec(
    ::tensorflow::serving::ModelSpec* model_spec) {
  if (GetArenaNoVirtual() == NULL) {
    delete model_spec_;
  }
  model_spec_ = model_spec;
  if (model_spec) {

  } else {

  }
  // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.serving.InferenceResult.model_spec)
}
void InferenceResult::clear_model_spec() {
  if (GetArenaNoVirtual() == NULL && model_spec_ != NULL) {
    delete model_spec_;
  }
  model_spec_ = NULL;
}
void InferenceResult::set_allocated_classification_result(::tensorflow::serving::ClassificationResult* classification_result) {
  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
  clear_result();
  if (classification_result) {
    ::google::protobuf::Arena* submessage_arena =
      reinterpret_cast<::google::protobuf::MessageLite*>(classification_result)->GetArena();
    if (message_arena != submessage_arena) {
      classification_result = ::google::protobuf::internal::GetOwnedMessage(
          message_arena, classification_result, submessage_arena);
    }
    set_has_classification_result();
    result_.classification_result_ = classification_result;
  }
  // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.InferenceResult.classification_result)
}
void InferenceResult::clear_classification_result() {
  if (has_classification_result()) {
    if (GetArenaNoVirtual() == NULL) {
      delete result_.classification_result_;
    }
    clear_has_result();
  }
}
void InferenceResult::set_allocated_regression_result(::tensorflow::serving::RegressionResult* regression_result) {
  ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
  clear_result();
  if (regression_result) {
    ::google::protobuf::Arena* submessage_arena =
      reinterpret_cast<::google::protobuf::MessageLite*>(regression_result)->GetArena();
    if (message_arena != submessage_arena) {
      regression_result = ::google::protobuf::internal::GetOwnedMessage(
          message_arena, regression_result, submessage_arena);
    }
    set_has_regression_result();
    result_.regression_result_ = regression_result;
  }
  // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.InferenceResult.regression_result)
}
void InferenceResult::clear_regression_result() {
  if (has_regression_result()) {
    if (GetArenaNoVirtual() == NULL) {
      delete result_.regression_result_;
    }
    clear_has_result();
  }
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int InferenceResult::kModelSpecFieldNumber;
const int InferenceResult::kClassificationResultFieldNumber;
const int InferenceResult::kRegressionResultFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

InferenceResult::InferenceResult()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceResult.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:tensorflow.serving.InferenceResult)
}
InferenceResult::InferenceResult(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceResult.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:tensorflow.serving.InferenceResult)
}
InferenceResult::InferenceResult(const InferenceResult& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_model_spec()) {
    model_spec_ = new ::tensorflow::serving::ModelSpec(*from.model_spec_);
  } else {
    model_spec_ = NULL;
  }
  clear_has_result();
  switch (from.result_case()) {
    case kClassificationResult: {
      mutable_classification_result()->::tensorflow::serving::ClassificationResult::MergeFrom(from.classification_result());
      break;
    }
    case kRegressionResult: {
      mutable_regression_result()->::tensorflow::serving::RegressionResult::MergeFrom(from.regression_result());
      break;
    }
    case RESULT_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:tensorflow.serving.InferenceResult)
}

void InferenceResult::SharedCtor() {
  model_spec_ = NULL;
  clear_has_result();
}

InferenceResult::~InferenceResult() {
  // @@protoc_insertion_point(destructor:tensorflow.serving.InferenceResult)
  SharedDtor();
}

void InferenceResult::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  if (this != internal_default_instance()) delete model_spec_;
  if (has_result()) {
    clear_result();
  }
}

void InferenceResult::ArenaDtor(void* object) {
  InferenceResult* _this = reinterpret_cast< InferenceResult* >(object);
  (void)_this;
}
void InferenceResult::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void InferenceResult::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* InferenceResult::descriptor() {
  ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const InferenceResult& InferenceResult::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_InferenceResult.base);
  return *internal_default_instance();
}

void InferenceResult::clear_result() {
// @@protoc_insertion_point(one_of_clear_start:tensorflow.serving.InferenceResult)
  switch (result_case()) {
    case kClassificationResult: {
      if (GetArenaNoVirtual() == NULL) {
        delete result_.classification_result_;
      }
      break;
    }
    case kRegressionResult: {
      if (GetArenaNoVirtual() == NULL) {
        delete result_.regression_result_;
      }
      break;
    }
    case RESULT_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = RESULT_NOT_SET;
}

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

  if (GetArenaNoVirtual() == NULL && model_spec_ != NULL) {
    delete model_spec_;
  }
  model_spec_ = NULL;
  clear_result();
  _internal_metadata_.Clear();
}

bool InferenceResult::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:tensorflow.serving.InferenceResult)
  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)) {
      // .tensorflow.serving.ModelSpec model_spec = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_model_spec()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .tensorflow.serving.ClassificationResult classification_result = 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_classification_result()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .tensorflow.serving.RegressionResult regression_result = 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, mutable_regression_result()));
        } 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:tensorflow.serving.InferenceResult)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:tensorflow.serving.InferenceResult)
  return false;
#undef DO_
}

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

  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->_internal_model_spec(), output);
  }

  // .tensorflow.serving.ClassificationResult classification_result = 2;
  if (has_classification_result()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->_internal_classification_result(), output);
  }

  // .tensorflow.serving.RegressionResult regression_result = 3;
  if (has_regression_result()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      3, this->_internal_regression_result(), 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:tensorflow.serving.InferenceResult)
}

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

  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->_internal_model_spec(), deterministic, target);
  }

  // .tensorflow.serving.ClassificationResult classification_result = 2;
  if (has_classification_result()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->_internal_classification_result(), deterministic, target);
  }

  // .tensorflow.serving.RegressionResult regression_result = 3;
  if (has_regression_result()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        3, this->_internal_regression_result(), 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:tensorflow.serving.InferenceResult)
  return target;
}

size_t InferenceResult::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.serving.InferenceResult)
  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()));
  }
  // .tensorflow.serving.ModelSpec model_spec = 1;
  if (this->has_model_spec()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *model_spec_);
  }

  switch (result_case()) {
    // .tensorflow.serving.ClassificationResult classification_result = 2;
    case kClassificationResult: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *result_.classification_result_);
      break;
    }
    // .tensorflow.serving.RegressionResult regression_result = 3;
    case kRegressionResult: {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *result_.regression_result_);
      break;
    }
    case RESULT_NOT_SET: {
      break;
    }
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

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

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

  if (from.has_model_spec()) {
    mutable_model_spec()->::tensorflow::serving::ModelSpec::MergeFrom(from.model_spec());
  }
  switch (from.result_case()) {
    case kClassificationResult: {
      mutable_classification_result()->::tensorflow::serving::ClassificationResult::MergeFrom(from.classification_result());
      break;
    }
    case kRegressionResult: {
      mutable_regression_result()->::tensorflow::serving::RegressionResult::MergeFrom(from.regression_result());
      break;
    }
    case RESULT_NOT_SET: {
      break;
    }
  }
}

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

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

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

void InferenceResult::Swap(InferenceResult* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    InferenceResult* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void InferenceResult::UnsafeArenaSwap(InferenceResult* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void InferenceResult::InternalSwap(InferenceResult* other) {
  using std::swap;
  swap(model_spec_, other->model_spec_);
  swap(result_, other->result_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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

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

void MultiInferenceRequest::InitAsDefaultInstance() {
  ::tensorflow::serving::_MultiInferenceRequest_default_instance_._instance.get_mutable()->input_ = const_cast< ::tensorflow::serving::Input*>(
      ::tensorflow::serving::Input::internal_default_instance());
}
void MultiInferenceRequest::unsafe_arena_set_allocated_input(
    ::tensorflow::serving::Input* input) {
  if (GetArenaNoVirtual() == NULL) {
    delete input_;
  }
  input_ = input;
  if (input) {

  } else {

  }
  // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.serving.MultiInferenceRequest.input)
}
void MultiInferenceRequest::clear_input() {
  if (GetArenaNoVirtual() == NULL && input_ != NULL) {
    delete input_;
  }
  input_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MultiInferenceRequest::kTasksFieldNumber;
const int MultiInferenceRequest::kInputFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

MultiInferenceRequest::MultiInferenceRequest()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceRequest.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:tensorflow.serving.MultiInferenceRequest)
}
MultiInferenceRequest::MultiInferenceRequest(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  tasks_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceRequest.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:tensorflow.serving.MultiInferenceRequest)
}
MultiInferenceRequest::MultiInferenceRequest(const MultiInferenceRequest& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      tasks_(from.tasks_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_input()) {
    input_ = new ::tensorflow::serving::Input(*from.input_);
  } else {
    input_ = NULL;
  }
  // @@protoc_insertion_point(copy_constructor:tensorflow.serving.MultiInferenceRequest)
}

void MultiInferenceRequest::SharedCtor() {
  input_ = NULL;
}

MultiInferenceRequest::~MultiInferenceRequest() {
  // @@protoc_insertion_point(destructor:tensorflow.serving.MultiInferenceRequest)
  SharedDtor();
}

void MultiInferenceRequest::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  if (this != internal_default_instance()) delete input_;
}

void MultiInferenceRequest::ArenaDtor(void* object) {
  MultiInferenceRequest* _this = reinterpret_cast< MultiInferenceRequest* >(object);
  (void)_this;
}
void MultiInferenceRequest::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MultiInferenceRequest::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* MultiInferenceRequest::descriptor() {
  ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const MultiInferenceRequest& MultiInferenceRequest::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceRequest.base);
  return *internal_default_instance();
}

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

  tasks_.Clear();
  if (GetArenaNoVirtual() == NULL && input_ != NULL) {
    delete input_;
  }
  input_ = NULL;
  _internal_metadata_.Clear();
}

bool MultiInferenceRequest::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:tensorflow.serving.MultiInferenceRequest)
  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)) {
      // repeated .tensorflow.serving.InferenceTask tasks = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_tasks()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // .tensorflow.serving.Input input = 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_input()));
        } 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:tensorflow.serving.MultiInferenceRequest)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:tensorflow.serving.MultiInferenceRequest)
  return false;
#undef DO_
}

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

  // repeated .tensorflow.serving.InferenceTask tasks = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->tasks_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1,
      this->tasks(static_cast<int>(i)),
      output);
  }

  // .tensorflow.serving.Input input = 2;
  if (this->has_input()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->_internal_input(), 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:tensorflow.serving.MultiInferenceRequest)
}

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

  // repeated .tensorflow.serving.InferenceTask tasks = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->tasks_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->tasks(static_cast<int>(i)), deterministic, target);
  }

  // .tensorflow.serving.Input input = 2;
  if (this->has_input()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->_internal_input(), 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:tensorflow.serving.MultiInferenceRequest)
  return target;
}

size_t MultiInferenceRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.serving.MultiInferenceRequest)
  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 .tensorflow.serving.InferenceTask tasks = 1;
  {
    unsigned int count = static_cast<unsigned int>(this->tasks_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->tasks(static_cast<int>(i)));
    }
  }

  // .tensorflow.serving.Input input = 2;
  if (this->has_input()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *input_);
  }

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

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

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

  tasks_.MergeFrom(from.tasks_);
  if (from.has_input()) {
    mutable_input()->::tensorflow::serving::Input::MergeFrom(from.input());
  }
}

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

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

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

void MultiInferenceRequest::Swap(MultiInferenceRequest* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    MultiInferenceRequest* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void MultiInferenceRequest::UnsafeArenaSwap(MultiInferenceRequest* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void MultiInferenceRequest::InternalSwap(MultiInferenceRequest* other) {
  using std::swap;
  CastToBase(&tasks_)->InternalSwap(CastToBase(&other->tasks_));
  swap(input_, other->input_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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

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

void MultiInferenceResponse::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MultiInferenceResponse::kResultsFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

MultiInferenceResponse::MultiInferenceResponse()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceResponse.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:tensorflow.serving.MultiInferenceResponse)
}
MultiInferenceResponse::MultiInferenceResponse(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  results_(arena) {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceResponse.base);
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:tensorflow.serving.MultiInferenceResponse)
}
MultiInferenceResponse::MultiInferenceResponse(const MultiInferenceResponse& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      results_(from.results_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:tensorflow.serving.MultiInferenceResponse)
}

void MultiInferenceResponse::SharedCtor() {
}

MultiInferenceResponse::~MultiInferenceResponse() {
  // @@protoc_insertion_point(destructor:tensorflow.serving.MultiInferenceResponse)
  SharedDtor();
}

void MultiInferenceResponse::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}

void MultiInferenceResponse::ArenaDtor(void* object) {
  MultiInferenceResponse* _this = reinterpret_cast< MultiInferenceResponse* >(object);
  (void)_this;
}
void MultiInferenceResponse::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MultiInferenceResponse::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* MultiInferenceResponse::descriptor() {
  ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const MultiInferenceResponse& MultiInferenceResponse::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_tensorflow_5fserving_2fapis_2finference_2eproto::scc_info_MultiInferenceResponse.base);
  return *internal_default_instance();
}

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

  results_.Clear();
  _internal_metadata_.Clear();
}

bool MultiInferenceResponse::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:tensorflow.serving.MultiInferenceResponse)
  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)) {
      // repeated .tensorflow.serving.InferenceResult results = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_results()));
        } 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:tensorflow.serving.MultiInferenceResponse)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:tensorflow.serving.MultiInferenceResponse)
  return false;
#undef DO_
}

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

  // repeated .tensorflow.serving.InferenceResult results = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->results_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1,
      this->results(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:tensorflow.serving.MultiInferenceResponse)
}

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

  // repeated .tensorflow.serving.InferenceResult results = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->results_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->results(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:tensorflow.serving.MultiInferenceResponse)
  return target;
}

size_t MultiInferenceResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.serving.MultiInferenceResponse)
  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 .tensorflow.serving.InferenceResult results = 1;
  {
    unsigned int count = static_cast<unsigned int>(this->results_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->results(static_cast<int>(i)));
    }
  }

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

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

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

  results_.MergeFrom(from.results_);
}

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

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

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

void MultiInferenceResponse::Swap(MultiInferenceResponse* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    MultiInferenceResponse* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void MultiInferenceResponse::UnsafeArenaSwap(MultiInferenceResponse* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void MultiInferenceResponse::InternalSwap(MultiInferenceResponse* other) {
  using std::swap;
  CastToBase(&results_)->InternalSwap(CastToBase(&other->results_));
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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

// @@protoc_insertion_point(namespace_scope)
}  // namespace serving
}  // namespace tensorflow
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::serving::InferenceTask* Arena::CreateMaybeMessage< ::tensorflow::serving::InferenceTask >(Arena* arena) {
  return Arena::CreateMessageInternal< ::tensorflow::serving::InferenceTask >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::serving::InferenceResult* Arena::CreateMaybeMessage< ::tensorflow::serving::InferenceResult >(Arena* arena) {
  return Arena::CreateMessageInternal< ::tensorflow::serving::InferenceResult >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::serving::MultiInferenceRequest* Arena::CreateMaybeMessage< ::tensorflow::serving::MultiInferenceRequest >(Arena* arena) {
  return Arena::CreateMessageInternal< ::tensorflow::serving::MultiInferenceRequest >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::serving::MultiInferenceResponse* Arena::CreateMaybeMessage< ::tensorflow::serving::MultiInferenceResponse >(Arena* arena) {
  return Arena::CreateMessageInternal< ::tensorflow::serving::MultiInferenceResponse >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)


text:
require 'rails_helper'

describe Study do
  it "handles last known status" do
    nct_id='NCT02591940'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.last_known_status).to eq('Enrolling by invitation')
  end

  it "handles expanded access fields" do
    nct_id='NCT03133988'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.expanded_access_type_individual).to be true
    expect(study.expanded_access_type_intermediate).to be nil
    expect(study.expanded_access_type_treatment).to be nil

    nct_id='NCT03147742'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.expanded_access_type_individual).to be nil
    expect(study.expanded_access_type_intermediate).to be true
    expect(study.expanded_access_type_treatment).to be nil

    nct_id='NCT03245528'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.expanded_access_type_individual).to be nil
    expect(study.expanded_access_type_intermediate).to be nil
    expect(study.expanded_access_type_treatment).to be true
    expect(study.study_first_submitted_qc_date).to eq('August 7, 2017'.to_date)
  end

  it "saves expanded access info correctly"  do
    nct_id='NCT01220531'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.study_type).to eq('Expanded Access')
    expect(study.expanded_access_type_intermediate).to eq(true)
    expect(study.expanded_access_type_treatment).to eq(true)
    expect(study.expanded_access_type_individual).to eq(nil)
  end

  it "our validation study should have correct attribs" do
    nct_id='NCT02654730'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.source).to eq('London School of Hygiene and Tropical Medicine')
    expect(study.overall_status).to eq('Terminated')
  end

  it "saves is_unapproved_device" do
    nct_id='NCT02988895'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.is_unapproved_device).to be(false)
    expect(study.is_ppsd).to be(false)
    expect(study.is_us_export).to be(false)
  end

  it "saves expanded access information correctly" do
    nct_id='NCT02970669'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.has_expanded_access).to be(true)
    #  These tags were released 1/11/17, but as of 8/9/17, no studies have this info.  Sent email to NLM asking if these tags are actie.
#    expect(study.expanded_access_type_individual).to be(true)
#    expect(study.expanded_access_type_intermediate).to be(true)
#    expect(study.expanded_access_type_treatment).to be(true)
  end

  it "should have correct date attribs" do
    nct_id='NCT00023673'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    CalculatedValue.new.create_from(study).save!
    expect(study.start_month_year).to eq('July 2001')
    expect(study.start_date.strftime('%m/%d/%Y')).to eq('07/31/2001')
    expect(study.completion_month_year).to eq('November 2013')
    expect(study.completion_date.strftime('%m/%d/%Y')).to eq('11/30/2013')
    expect(study.primary_completion_month_year).to eq('January 2009')
    expect(study.primary_completion_date.strftime('%m/%d/%Y')).to eq('01/31/2009')
    expect(study.verification_month_year).to eq('November 2017')
    expect(study.verification_date.strftime('%m/%d/%Y')).to eq('11/30/2017')

    expect(study.study_first_submitted_date).to eq('September 13, 2001'.to_date)
    expect(study.results_first_submitted_date).to eq('February 12, 2014'.to_date)
    expect(study.last_update_submitted_date).to eq('November 27, 2017'.to_date)

    expect(study.study_first_submitted_qc_date).to eq('April 8, 2003'.to_date)
    expect(study.study_first_posted_date).to eq('April 9, 2003'.to_date)
    expect(study.results_first_submitted_qc_date).to eq('February 12, 2014'.to_date)
    expect(study.results_first_posted_date).to eq('March 27, 2014'.to_date)
    expect(study.disposition_first_submitted_qc_date).to eq(''.to_date)
    expect(study.disposition_first_posted_date).to eq(''.to_date)
    expect(study.last_update_submitted_qc_date).to eq('November 27, 2017'.to_date)
    expect(study.last_update_posted_date).to eq('December 22, 2017'.to_date)

    expect(study.study_first_posted_date_type).to eq('Estimate')
    expect(study.results_first_posted_date_type).to eq('Estimate')
    expect(study.disposition_first_posted_date_type).to be nil
    expect(study.last_update_posted_date_type).to eq('Actual')

    expect(study.start_date).to eq(study.start_month_year.to_date.end_of_month)
    expect(study.verification_date).to eq(study.verification_month_year.to_date.end_of_month)
    expect(study.completion_date).to eq(study.completion_month_year.to_date.end_of_month)
    expect(study.primary_completion_date).to eq(study.primary_completion_month_year.to_date.end_of_month)

    expect(study.result_contacts.first.name).to eq('Wendy Seiferheld')
    expect(study.result_contacts.first.organization).to eq('Radiation Therapy Oncology Group')
    expect(study.result_contacts.first.email).to eq('wseiferheld@acr.org')

    expect(study.design_groups.size).to eq(4)
    g=study.design_groups.select{|x|x.title=='Phase I: 75.25 Gy/36 fx + chemotherapy'}.first
    expect(g.description).to eq('Phase I: Three-dimensional conformal radiation therapy (3DRT) of 75.25 Gy given in 36 fractions (2.15 Gy per fraction) with concurrent chemotherapy consisting of weekly paclitaxel at 50mg/m2 and carboplatin at area under the curve 2mg/m2. Adjuvant systemic chemotherapy (two cycles of paclitaxel and carboplatin) following completion of RT was optional.')
    expect(g.group_type).to eq('Experimental')

    # verify sponsor info
    expect(study.sponsors.size).to eq(2)
    lead=study.sponsors.select{|x|x.lead_or_collaborator=='lead'}.first
    collaborator=study.sponsors.select{|x|x.lead_or_collaborator=='collaborator'}.first
    expect(lead.name).to eq('Radiation Therapy Oncology Group')
    expect(lead.agency_class).to eq('Other')
    expect(collaborator.name).to eq('National Cancer Institute (NCI)')
    expect(collaborator.agency_class).to eq('NIH')

    nct_id='NCT01642004'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.disposition_first_submitted_qc_date).to eq('November 17, 2015'.to_date)
    expect(study.disposition_first_posted_date).to eq('December 16, 2015'.to_date)

  end

  it "should have expected date values" do
    nct_id='NCT02260193'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create
    expect(study.disposition_first_submitted_date).to eq('October 23, 2015'.to_date)
  end

  context 'when loading a study' do
    nct_id='NCT02830269'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create

    it 'should have expected start date values' do
      expect(study.start_date.strftime('%m/%d/%Y')).to eq('08/18/2016')
      expect(study.start_date_type).to eq('Actual')
    end
  end

  context 'study has limitations and caveats' do
    nct_id='NCT00023673'
    xml=Nokogiri::XML(File.read("spec/support/xml_data/#{nct_id}.xml"))
    study=Study.new({xml: xml, nct_id: nct_id}).create

    it 'should have expected limitations and caveats value' do
      expect(study.limitations_and_caveats).to eq('This study was originally designed to escalate 3DRT via increasing doses per fraction. However, due to excessive toxicity at dose level 1 (75.25 Gy, 2.15 Gy/fraction), the protocol was amended in January 2003 to de-escalate 3DRT dose.')
    end

  end

  context 'when patient data section does not exist' do
  end

  context 'when patient data section does not exist' do
    nct_id='NCT02260193'
    xml=Nokogiri::XML(File.read('spec/support/xml_data/example_study.xml'))
    study=Study.new({xml: xml, nct_id: nct_id}).create

    it 'should return empty string for sharing ipd value' do
      expect(study.plan_to_share_ipd).to eq(nil)
    end

    it 'should return empty string for ipd description value' do
      expect(study.plan_to_share_ipd_description).to eq(nil)
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

// @codingStandardsIgnoreFile

namespace Magento\Variable\Model\ResourceModel;

/**
 * Custom variable resource model
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Variable extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
    /**
     * Constructor
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init('variable', 'variable_id');
    }

    /**
     * Load variable by code
     *
     * @param \Magento\Variable\Model\Variable $object
     * @param string $code
     * @return $this
     */
    public function loadByCode(\Magento\Variable\Model\Variable $object, $code)
    {
        if ($result = $this->getVariableByCode($code, true, $object->getStoreId())) {
            $object->setData($result);
        }
        return $this;
    }

    /**
     * Retrieve variable data by code
     *
     * @param string $code
     * @param bool $withValue
     * @param integer $storeId
     * @return array
     */
    public function getVariableByCode($code, $withValue = false, $storeId = 0)
    {
        $select = $this->getConnection()->select()->from(
            $this->getMainTable()
        )->where(
            $this->getMainTable() . '.code = ?',
            $code
        );
        if ($withValue) {
            $this->_addValueToSelect($select, $storeId);
        }
        return $this->getConnection()->fetchRow($select);
    }

    /**
     * Perform actions after object save
     *
     * @param \Magento\Framework\Model\AbstractModel $object
     * @return $this
     */
    protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
    {
        parent::_afterSave($object);
        if ($object->getUseDefaultValue()) {
            /*
             * remove store value
             */
            $this->getConnection()->delete(
                $this->getTable('variable_value'),
                ['variable_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()]
            );
        } else {
            $data = [
                'variable_id' => $object->getId(),
                'store_id' => $object->getStoreId(),
                'plain_value' => $object->getPlainValue(),
                'html_value' => $object->getHtmlValue(),
            ];
            $data = $this->_prepareDataForTable(new \Magento\Framework\DataObject($data), $this->getTable('variable_value'));
            $this->getConnection()->insertOnDuplicate(
                $this->getTable('variable_value'),
                $data,
                ['plain_value', 'html_value']
            );
        }
        return $this;
    }

    /**
     * Retrieve select object for load object data
     *
     * @param string $field
     * @param mixed $value
     * @param \Magento\Framework\Model\AbstractModel $object
     * @return $this
     */
    protected function _getLoadSelect($field, $value, $object)
    {
        $select = parent::_getLoadSelect($field, $value, $object);
        $this->_addValueToSelect($select, $object->getStoreId());
        return $select;
    }

    /**
     * Add variable store and default value to select
     *
     * @param \Magento\Framework\DB\Select $select
     * @param integer $storeId
     * @return \Magento\Variable\Model\ResourceModel\Variable
     */
    protected function _addValueToSelect(
        \Magento\Framework\DB\Select $select,
        $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID
    ) {
        $connection = $this->getConnection();
        $ifNullPlainValue = $connection->getCheckSql('store.plain_value IS NULL', 'def.plain_value', 'store.plain_value');
        $ifNullHtmlValue = $connection->getCheckSql('store.html_value IS NULL', 'def.html_value', 'store.html_value');

        $select->joinLeft(
            ['def' => $this->getTable('variable_value')],
            'def.variable_id = ' . $this->getMainTable() . '.variable_id AND def.store_id = 0',
            []
        )->joinLeft(
            ['store' => $this->getTable('variable_value')],
            'store.variable_id = def.variable_id AND store.store_id = ' . $connection->quote($storeId),
            []
        )->columns(
            [
                'plain_value' => $ifNullPlainValue,
                'html_value' => $ifNullHtmlValue,
                'store_plain_value' => 'store.plain_value',
                'store_html_value' => 'store.html_value',
            ]
        );

        return $this;
    }
}


text:
package at.tuwien.ldlab.statspace.exploration;

import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import at.tuwien.ldlab.statspace.metadata.MetaData;

public class ExploreDataSet  extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException{
		doGet(request, response);
	}

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
    	String sMDUri  = request.getParameter("id1");

        if(sMDUri!=null && !sMDUri.isEmpty()){
        	MetaData md = new MetaData();
        	md.setUri(sMDUri);
        	md.queryMetaDataInfor();
           	ArrayList<MetaData> results = new ArrayList<MetaData>();
           	results = md.searchComparableDataSet();
           	//swap inputMetaData to the first position of results
           	int i;
           	for(i=0; i<results.size(); i++){
           		if(results.get(i).getUri().equals(sMDUri)){
           			MetaData tmp = results.get(0);
           			results.set(0, results.get(i));
           			results.set(i, tmp);
           			break;
           		}
           	}

           	//return to users
           	request.setAttribute("result", results);
    		RequestDispatcher view = request.getRequestDispatcher("/exploration/dataset.jsp");
    		view.forward(request, response);
        }else{
        	response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
        	response.addHeader("Access-Control-Allow-Origin", "*");
        	response.getWriter().println("No result");
        }
    }
}


text:
package com.icfcc.cache.ehcache;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.bootstrap.BootstrapCacheLoader;
import net.sf.ehcache.constructs.blocking.*;
import net.sf.ehcache.event.CacheEventListener;
import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.util.Assert;

import java.io.IOException;
import java.util.Set;

/**
 * {@link FactoryBean} that creates a named EHCache {@link net.sf.ehcache.Cache} instance
 * (or a decorator that implements the {@link net.sf.ehcache.Ehcache} interface),
 * representing a cache region within an EHCache {@link net.sf.ehcache.CacheManager}.
 *
 *
If the specified named cache is not configured in the cache configuration descriptor,
 * this FactoryBean will construct an instance of a Cache with the provided name and the
 * specified cache properties and add it to the CacheManager for later retrieval. If some
 * or all properties are not set at configuration time, this FactoryBean will use defaults.
 *
 *
Note: If the named Cache instance is found, the properties will be ignored and the
 * Cache instance will be retrieved from the CacheManager.
 *
 *
Note: As of Spring 3.0, Spring's EHCache support requires EHCache 1.3 or higher.

 * @author Dmitriy Kopylenko
 * @author Juergen Hoeller
 * @since 1.1.1
 * @see #setCacheManager
 * @see org.springframework.cache.ehcache.EhCacheManagerFactoryBean
 * @see net.sf.ehcache.Cache
 */
public class EhCacheFactoryBean implements FactoryBean, BeanNameAware, InitializingBean {

	protected final Log logger = LogFactory.getLog(getClass());

	private CacheManager cacheManager;

	private String cacheName;

	private int maxElementsInMemory = 10000;

	private int maxElementsOnDisk = 10000000;

	private MemoryStoreEvictionPolicy memoryStoreEvictionPolicy = MemoryStoreEvictionPolicy.LRU;

	private boolean overflowToDisk = true;

	private boolean eternal = false;

	private int timeToLive = 120;

	private int timeToIdle = 120;

	private boolean diskPersistent = false;

	private int diskExpiryThreadIntervalSeconds = 120;

	private int diskSpoolBufferSize = 0;

	private boolean clearOnFlush = true;

	private boolean blocking = false;

	private CacheEntryFactory cacheEntryFactory;

	private BootstrapCacheLoader bootstrapCacheLoader;

	private Set<CacheEventListener> cacheEventListeners;

	private boolean statisticsEnabled = false;

	private boolean sampledStatisticsEnabled = false;

	private boolean disabled = false;

	private String beanName;

	private Ehcache cache;

	/**
	 * Set a CacheManager from which to retrieve a named Cache instance.
	 * By default, CacheManager.getInstance() will be called.
	 *
Note that in particular for persistent caches, it is advisable to
	 * properly handle the shutdown of the CacheManager: Set up a separate
	 * EhCacheManagerFactoryBean and pass a reference to this bean property.
	 *
A separate EhCacheManagerFactoryBean is also necessary for loading
	 * EHCache configuration from a non-default config location.
	 * @see EhCacheManagerFactoryBean
	 * @see net.sf.ehcache.CacheManager#getInstance
	 */
	public void setCacheManager(CacheManager cacheManager) {
		this.cacheManager = cacheManager;
	}

	/**
	 * Set a name for which to retrieve or create a cache instance.
	 * Default is the bean name of this EhCacheFactoryBean.
	 */
	public void setCacheName(String cacheName) {
		this.cacheName = cacheName;
	}

	/**
	 * Specify the maximum number of cached objects in memory.
	 * Default is 10000 elements.
	 */
	public void setMaxElementsInMemory(int maxElementsInMemory) {
		this.maxElementsInMemory = maxElementsInMemory;
	}

	/**
	 * Specify the maximum number of cached objects on disk.
	 * Default is 10000000 elements.
	 */
	public void setMaxElementsOnDisk(int maxElementsOnDisk) {
		this.maxElementsOnDisk = maxElementsOnDisk;
	}

	/**
	 * Set the memory style eviction policy for this cache.
	 *
Supported values are "LRU", "LFU" and "FIFO", according to the
	 * constants defined in EHCache's MemoryStoreEvictionPolicy class.
	 * Default is "LRU".
	 */
	public void setMemoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy) {
		Assert.notNull(memoryStoreEvictionPolicy, "memoryStoreEvictionPolicy must not be null");
		this.memoryStoreEvictionPolicy = memoryStoreEvictionPolicy;
	}

	/**
	 * Set whether elements can overflow to disk when the in-memory cache
	 * has reached the maximum size limit. Default is "true".
	 */
	public void setOverflowToDisk(boolean overflowToDisk) {
		this.overflowToDisk = overflowToDisk;
	}

	/**
	 * Set whether elements are considered as eternal. If "true", timeouts
	 * are ignored and the element is never expired. Default is "false".
	 */
	public void setEternal(boolean eternal) {
		this.eternal = eternal;
	}

	/**
	 * Set the time in seconds to live for an element before it expires,
	 * i.e. the maximum time between creation time and when an element expires.
	 *
This is only used if the element is not eternal. Default is 120 seconds.
	 */
	public void setTimeToLive(int timeToLive) {
		this.timeToLive = timeToLive;
	}

	/**
	 * Set the time in seconds to idle for an element before it expires, that is,
	 * the maximum amount of time between accesses before an element expires.
	 *
This is only used if the element is not eternal. Default is 120 seconds.
	 */
	public void setTimeToIdle(int timeToIdle) {
		this.timeToIdle = timeToIdle;
	}

	/**
	 * Set whether the disk store persists between restarts of the Virtual Machine.
	 * Default is "false".
	 */
	public void setDiskPersistent(boolean diskPersistent) {
		this.diskPersistent = diskPersistent;
	}

	/**
	 * Set the number of seconds between runs of the disk expiry thread.
	 * Default is 120 seconds.
	 */
	public void setDiskExpiryThreadIntervalSeconds(int diskExpiryThreadIntervalSeconds) {
		this.diskExpiryThreadIntervalSeconds = diskExpiryThreadIntervalSeconds;
	}

	/**
	 * Set the amount of memory to allocate the write buffer for puts to the disk store.
	 * Default is 0.
	 */
	public void setDiskSpoolBufferSize(int diskSpoolBufferSize) {
		this.diskSpoolBufferSize = diskSpoolBufferSize;
	}

	/**
	 * Set whether the memory store should be cleared when flush is called on the cache.
	 * Default is "true".
	 */
	public void setClearOnFlush(boolean clearOnFlush) {
		this.clearOnFlush = clearOnFlush;
	}

	/**
	 * Set whether to use a blocking cache that lets read attempts block
	 * until the requested element is created.
	 *
If you intend to build a self-populating blocking cache,
	 * consider specifying a {@link #setCacheEntryFactory CacheEntryFactory}.
	 * @see net.sf.ehcache.constructs.blocking.BlockingCache
	 * @see #setCacheEntryFactory
	 */
	public void setBlocking(boolean blocking) {
		this.blocking = blocking;
	}

	/**
	 * Set an EHCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
	 * to use for a self-populating cache. If such a factory is specified,
	 * the cache will be decorated with EHCache's
	 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
	 *
The specified factory can be of type
	 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
	 * which will lead to the use of an
	 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
	 *
Note: Any such self-populating cache is automatically a blocking cache.
	 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
	 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
	 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
	 */
	public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
		this.cacheEntryFactory = cacheEntryFactory;
	}

	/**
	 * Set an EHCache {@link net.sf.ehcache.bootstrap.BootstrapCacheLoader}
	 * for this cache, if any.
	 */
	public void setBootstrapCacheLoader(BootstrapCacheLoader bootstrapCacheLoader) {
		this.bootstrapCacheLoader = bootstrapCacheLoader;
	}

	/**
	 * Specify EHCache {@link net.sf.ehcache.event.CacheEventListener cache event listeners}
	 * to registered with this cache.
	 */
	public void setCacheEventListeners(Set<CacheEventListener> cacheEventListeners) {
		this.cacheEventListeners = cacheEventListeners;
	}

	/**
	 * Set whether to enable EhCache statistics on this cache.
	 * @see net.sf.ehcache.Cache#setStatisticsEnabled
	 */
	public void setStatisticsEnabled(boolean statisticsEnabled) {
		this.statisticsEnabled = statisticsEnabled;
	}

	/**
	 * Set whether to enable EhCache's sampled statistics on this cache.
	 * @see net.sf.ehcache.Cache#setSampledStatisticsEnabled
	 */
	public void setSampledStatisticsEnabled(boolean sampledStatisticsEnabled) {
		this.sampledStatisticsEnabled = sampledStatisticsEnabled;
	}

	/**
	 * Set whether this cache should be marked as disabled.
	 * @see net.sf.ehcache.Cache#setDisabled
	 */
	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	public void setBeanName(String name) {
		this.beanName = name;
	}

	public void afterPropertiesSet() throws CacheException, IOException {
		// If no CacheManager given, fetch the default.
		if (this.cacheManager == null) {
			if (logger.isDebugEnabled()) {
				logger.debug("Using default EHCache CacheManager for cache region '" + this.cacheName + "'");
			}
			this.cacheManager = CacheManager.getInstance();
		}

		// If no cache name given, use bean name as cache name.
		if (this.cacheName == null) {
			this.cacheName = this.beanName;
		}

		// Fetch cache region: If none with the given name exists,
		// create one on the fly.
		Ehcache rawCache;
		if (this.cacheManager.cacheExists(this.cacheName)) {
			if (logger.isDebugEnabled()) {
				logger.debug("Using existing EHCache cache region '" + this.cacheName + "'");
			}
			rawCache = this.cacheManager.getEhcache(this.cacheName);
		}
		else {
			if (logger.isDebugEnabled()) {
				logger.debug("Creating new EHCache cache region '" + this.cacheName + "'");
			}
			rawCache = createCache();
			this.cacheManager.addCache(rawCache);
		}

		// Decorate cache if necessary.
		Ehcache decoratedCache = decorateCache(rawCache);
		if (decoratedCache != rawCache) {
			this.cacheManager.replaceCacheWithDecoratedCache(rawCache, decoratedCache);
		}
		this.cache = decoratedCache;
	}

	/**
	 * Create a raw Cache object based on the configuration of this FactoryBean.
	 */
	protected Cache createCache() {
		// Only call EHCache 1.6 constructor if actually necessary (for compatibility with EHCache 1.3+)
		Cache cache = (!this.clearOnFlush) ?
				new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy,
						this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle,
						this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null,
						this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize,
						this.clearOnFlush) :
				new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy,
						this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle,
						this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null,
						this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize);

		if (this.cacheEventListeners != null) {
			for (CacheEventListener listener : this.cacheEventListeners) {
				cache.getCacheEventNotificationService().registerListener(listener);
			}
		}
		if (this.statisticsEnabled) {
			cache.setStatisticsEnabled(true);
		}
		if (this.sampledStatisticsEnabled) {
			cache.setSampledStatisticsEnabled(true);
		}
		if (this.disabled) {
			cache.setDisabled(true);
		}
		return cache;
	}

	/**
	 * Decorate the given Cache, if necessary.
	 * @param cache the raw Cache object, based on the configuration of this FactoryBean
	 * @return the (potentially decorated) cache object to be registered with the CacheManager
	 */
	protected Ehcache decorateCache(Ehcache cache) {
		if (this.cacheEntryFactory != null) {
			if (this.cacheEntryFactory instanceof UpdatingCacheEntryFactory) {
				return new UpdatingSelfPopulatingCache(cache, (UpdatingCacheEntryFactory) this.cacheEntryFactory);
			}
			else {
				return new SelfPopulatingCache(cache, this.cacheEntryFactory);
			}
		}
		if (this.blocking) {
			return new BlockingCache(cache);
		}
		return cache;
	}

	public Ehcache getObject() {
		return this.cache;
	}

	public Class<? extends Ehcache> getObjectType() {
		return (this.cache != null ? this.cache.getClass() : Ehcache.class);
	}

	public boolean isSingleton() {
		return true;
	}

}