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

#include "OpenOrder.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
extern PROTOBUF_INTERNAL_EXPORT_Contract_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_Contract_Contract_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_Order_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<5> scc_info_Order_Order_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_OrderState_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_OrderState_OrderState_2eproto;
namespace protobuf {
class OpenOrderDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<OpenOrder> _instance;
} _OpenOrder_default_instance_;
}  // namespace protobuf
static void InitDefaultsscc_info_OpenOrder_OpenOrder_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::protobuf::_OpenOrder_default_instance_;
    new (ptr) ::protobuf::OpenOrder();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::protobuf::OpenOrder::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<3> scc_info_OpenOrder_OpenOrder_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, 0, InitDefaultsscc_info_OpenOrder_OpenOrder_2eproto}, {
      &scc_info_Contract_Contract_2eproto.base,
      &scc_info_Order_Order_2eproto.base,
      &scc_info_OrderState_OrderState_2eproto.base,}};

static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_OpenOrder_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_OpenOrder_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_OpenOrder_2eproto = nullptr;

const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_OpenOrder_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, orderid_),
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, contract_),
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, order_),
  PROTOBUF_FIELD_OFFSET(::protobuf::OpenOrder, orderstate_),
  3,
  0,
  1,
  2,
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 9, sizeof(::protobuf::OpenOrder)},
};

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

const char descriptor_table_protodef_OpenOrder_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n\017OpenOrder.proto\022\010protobuf\032\016Contract.pr"
  "oto\032\013Order.proto\032\020OrderState.proto\"\322\001\n\tO"
  "penOrder\022\024\n\007orderId\030\001 \001(\005H\000\210\001\001\022)\n\010contra"
  "ct\030\002 \001(\0132\022.protobuf.ContractH\001\210\001\001\022#\n\005ord"
  "er\030\003 \001(\0132\017.protobuf.OrderH\002\210\001\001\022-\n\norderS"
  "tate\030\004 \001(\0132\024.protobuf.OrderStateH\003\210\001\001B\n\n"
  "\010_orderIdB\013\n\t_contractB\010\n\006_orderB\r\n\013_ord"
  "erStateB9\n\026com.ib.client.protobufB\016OpenO"
  "rderProto\252\002\016IBApi.protobufb\006proto3"
  ;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_OpenOrder_2eproto_deps[3] = {
  &::descriptor_table_Contract_2eproto,
  &::descriptor_table_Order_2eproto,
  &::descriptor_table_OrderState_2eproto,
};
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_OpenOrder_2eproto_sccs[1] = {
  &scc_info_OpenOrder_OpenOrder_2eproto.base,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_OpenOrder_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_OpenOrder_2eproto = {
  false, false, descriptor_table_protodef_OpenOrder_2eproto, "OpenOrder.proto", 354,
  &descriptor_table_OpenOrder_2eproto_once, descriptor_table_OpenOrder_2eproto_sccs, descriptor_table_OpenOrder_2eproto_deps, 1, 3,
  schemas, file_default_instances, TableStruct_OpenOrder_2eproto::offsets,
  file_level_metadata_OpenOrder_2eproto, 1, file_level_enum_descriptors_OpenOrder_2eproto, file_level_service_descriptors_OpenOrder_2eproto,
};

// Force running AddDescriptors() at dynamic initialization time.
static bool dynamic_init_dummy_OpenOrder_2eproto = (static_cast<void>(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_OpenOrder_2eproto)), true);
namespace protobuf {

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

void OpenOrder::InitAsDefaultInstance() {
  ::protobuf::_OpenOrder_default_instance_._instance.get_mutable()->contract_ = const_cast< ::protobuf::Contract*>(
      ::protobuf::Contract::internal_default_instance());
  ::protobuf::_OpenOrder_default_instance_._instance.get_mutable()->order_ = const_cast< ::protobuf::Order*>(
      ::protobuf::Order::internal_default_instance());
  ::protobuf::_OpenOrder_default_instance_._instance.get_mutable()->orderstate_ = const_cast< ::protobuf::OrderState*>(
      ::protobuf::OrderState::internal_default_instance());
}
class OpenOrder::_Internal {
 public:
  using HasBits = decltype(std::declval<OpenOrder>()._has_bits_);
  static void set_has_orderid(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static const ::protobuf::Contract& contract(const OpenOrder* msg);
  static void set_has_contract(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static const ::protobuf::Order& order(const OpenOrder* msg);
  static void set_has_order(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static const ::protobuf::OrderState& orderstate(const OpenOrder* msg);
  static void set_has_orderstate(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
};

const ::protobuf::Contract&
OpenOrder::_Internal::contract(const OpenOrder* msg) {
  return *msg->contract_;
}
const ::protobuf::Order&
OpenOrder::_Internal::order(const OpenOrder* msg) {
  return *msg->order_;
}
const ::protobuf::OrderState&
OpenOrder::_Internal::orderstate(const OpenOrder* msg) {
  return *msg->orderstate_;
}
void OpenOrder::clear_contract() {
  if (GetArena() == nullptr && contract_ != nullptr) {
    delete contract_;
  }
  contract_ = nullptr;
  _has_bits_[0] &= ~0x00000001u;
}
void OpenOrder::clear_order() {
  if (GetArena() == nullptr && order_ != nullptr) {
    delete order_;
  }
  order_ = nullptr;
  _has_bits_[0] &= ~0x00000002u;
}
void OpenOrder::clear_orderstate() {
  if (GetArena() == nullptr && orderstate_ != nullptr) {
    delete orderstate_;
  }
  orderstate_ = nullptr;
  _has_bits_[0] &= ~0x00000004u;
}
OpenOrder::OpenOrder(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:protobuf.OpenOrder)
}
OpenOrder::OpenOrder(const OpenOrder& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  if (from._internal_has_contract()) {
    contract_ = new ::protobuf::Contract(*from.contract_);
  } else {
    contract_ = nullptr;
  }
  if (from._internal_has_order()) {
    order_ = new ::protobuf::Order(*from.order_);
  } else {
    order_ = nullptr;
  }
  if (from._internal_has_orderstate()) {
    orderstate_ = new ::protobuf::OrderState(*from.orderstate_);
  } else {
    orderstate_ = nullptr;
  }
  orderid_ = from.orderid_;
  // @@protoc_insertion_point(copy_constructor:protobuf.OpenOrder)
}

void OpenOrder::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_OpenOrder_OpenOrder_2eproto.base);
  ::memset(&contract_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&orderid_) -
      reinterpret_cast<char*>(&contract_)) + sizeof(orderid_));
}

OpenOrder::~OpenOrder() {
  // @@protoc_insertion_point(destructor:protobuf.OpenOrder)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void OpenOrder::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
  if (this != internal_default_instance()) delete contract_;
  if (this != internal_default_instance()) delete order_;
  if (this != internal_default_instance()) delete orderstate_;
}

void OpenOrder::ArenaDtor(void* object) {
  OpenOrder* _this = reinterpret_cast< OpenOrder* >(object);
  (void)_this;
}
void OpenOrder::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void OpenOrder::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const OpenOrder& OpenOrder::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_OpenOrder_OpenOrder_2eproto.base);
  return *internal_default_instance();
}


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

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      if (GetArena() == nullptr && contract_ != nullptr) {
        delete contract_;
      }
      contract_ = nullptr;
    }
    if (cached_has_bits & 0x00000002u) {
      if (GetArena() == nullptr && order_ != nullptr) {
        delete order_;
      }
      order_ = nullptr;
    }
    if (cached_has_bits & 0x00000004u) {
      if (GetArena() == nullptr && orderstate_ != nullptr) {
        delete orderstate_;
      }
      orderstate_ = nullptr;
    }
  }
  orderid_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* OpenOrder::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena;
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // int32 orderId = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
          _Internal::set_has_orderid(&has_bits);
          orderid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .protobuf.Contract contract = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_contract(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .protobuf.Order order = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_order(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .protobuf.OrderState orderState = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_orderstate(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* OpenOrder::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:protobuf.OpenOrder)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // int32 orderId = 1;
  if (_internal_has_orderid()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_orderid(), target);
  }

  // .protobuf.Contract contract = 2;
  if (_internal_has_contract()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::contract(this), target, stream);
  }

  // .protobuf.Order order = 3;
  if (_internal_has_order()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        3, _Internal::order(this), target, stream);
  }

  // .protobuf.OrderState orderState = 4;
  if (_internal_has_orderstate()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        4, _Internal::orderstate(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:protobuf.OpenOrder)
  return target;
}

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

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    // .protobuf.Contract contract = 2;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *contract_);
    }

    // .protobuf.Order order = 3;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *order_);
    }

    // .protobuf.OrderState orderState = 4;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *orderstate_);
    }

    // int32 orderId = 1;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_orderid());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

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

void OpenOrder::MergeFrom(const OpenOrder& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:protobuf.OpenOrder)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_mutable_contract()->::protobuf::Contract::MergeFrom(from._internal_contract());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_mutable_order()->::protobuf::Order::MergeFrom(from._internal_order());
    }
    if (cached_has_bits & 0x00000004u) {
      _internal_mutable_orderstate()->::protobuf::OrderState::MergeFrom(from._internal_orderstate());
    }
    if (cached_has_bits & 0x00000008u) {
      orderid_ = from.orderid_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

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

void OpenOrder::InternalSwap(OpenOrder* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(OpenOrder, orderid_)
      + sizeof(OpenOrder::orderid_)
      - PROTOBUF_FIELD_OFFSET(OpenOrder, contract_)>(
          reinterpret_cast<char*>(&contract_),
          reinterpret_cast<char*>(&other->contract_));
}

::PROTOBUF_NAMESPACE_ID::Metadata OpenOrder::GetMetadata() const {
  return GetMetadataStatic();
}


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

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