/**
 * Autogenerated by Thrift Compiler (0.14.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#include "jaeger_types.h"

#include <algorithm>
#include <ostream>

#include <thrift/TToString.h>

namespace jaegertracing { namespace thrift {

int _kTagTypeValues[] = {
  TagType::STRING,
  TagType::DOUBLE,
  TagType::BOOL,
  TagType::LONG,
  TagType::BINARY
};
const char* _kTagTypeNames[] = {
  "STRING",
  "DOUBLE",
  "BOOL",
  "LONG",
  "BINARY"
};
const std::map<int, const char*> _TagType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTagTypeValues, _kTagTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr));

std::ostream& operator<<(std::ostream& out, const TagType::type& val) {
  std::map<int, const char*>::const_iterator it = _TagType_VALUES_TO_NAMES.find(val);
  if (it != _TagType_VALUES_TO_NAMES.end()) {
    out << it->second;
  } else {
    out << static_cast<int>(val);
  }
  return out;
}

std::string to_string(const TagType::type& val) {
  std::map<int, const char*>::const_iterator it = _TagType_VALUES_TO_NAMES.find(val);
  if (it != _TagType_VALUES_TO_NAMES.end()) {
    return std::string(it->second);
  } else {
    return std::to_string(static_cast<int>(val));
  }
}

int _kSpanRefTypeValues[] = {
  SpanRefType::CHILD_OF,
  SpanRefType::FOLLOWS_FROM
};
const char* _kSpanRefTypeNames[] = {
  "CHILD_OF",
  "FOLLOWS_FROM"
};
const std::map<int, const char*> _SpanRefType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kSpanRefTypeValues, _kSpanRefTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr));

std::ostream& operator<<(std::ostream& out, const SpanRefType::type& val) {
  std::map<int, const char*>::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val);
  if (it != _SpanRefType_VALUES_TO_NAMES.end()) {
    out << it->second;
  } else {
    out << static_cast<int>(val);
  }
  return out;
}

std::string to_string(const SpanRefType::type& val) {
  std::map<int, const char*>::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val);
  if (it != _SpanRefType_VALUES_TO_NAMES.end()) {
    return std::string(it->second);
  } else {
    return std::to_string(static_cast<int>(val));
  }
}


Tag::~Tag() noexcept {
}


void Tag::__set_key(const std::string& val) {
  this->key = val;
}

void Tag::__set_vType(const TagType::type val) {
  this->vType = val;
}

void Tag::__set_vStr(const std::string& val) {
  this->vStr = val;
__isset.vStr = true;
}

void Tag::__set_vDouble(const double val) {
  this->vDouble = val;
__isset.vDouble = true;
}

void Tag::__set_vBool(const bool val) {
  this->vBool = val;
__isset.vBool = true;
}

void Tag::__set_vLong(const int64_t val) {
  this->vLong = val;
__isset.vLong = true;
}

void Tag::__set_vBinary(const std::string& val) {
  this->vBinary = val;
__isset.vBinary = true;
}
std::ostream& operator<<(std::ostream& out, const Tag& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t Tag::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_key = false;
  bool isset_vType = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->key);
          isset_key = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          int32_t ecast0;
          xfer += iprot->readI32(ecast0);
          this->vType = (TagType::type)ecast0;
          isset_vType = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->vStr);
          this->__isset.vStr = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
          xfer += iprot->readDouble(this->vDouble);
          this->__isset.vDouble = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->vBool);
          this->__isset.vBool = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 6:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->vLong);
          this->__isset.vLong = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 7:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readBinary(this->vBinary);
          this->__isset.vBinary = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_key)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_vType)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t Tag::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("Tag");

  xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->key);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("vType", ::apache::thrift::protocol::T_I32, 2);
  xfer += oprot->writeI32((int32_t)this->vType);
  xfer += oprot->writeFieldEnd();

  if (this->__isset.vStr) {
    xfer += oprot->writeFieldBegin("vStr", ::apache::thrift::protocol::T_STRING, 3);
    xfer += oprot->writeString(this->vStr);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.vDouble) {
    xfer += oprot->writeFieldBegin("vDouble", ::apache::thrift::protocol::T_DOUBLE, 4);
    xfer += oprot->writeDouble(this->vDouble);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.vBool) {
    xfer += oprot->writeFieldBegin("vBool", ::apache::thrift::protocol::T_BOOL, 5);
    xfer += oprot->writeBool(this->vBool);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.vLong) {
    xfer += oprot->writeFieldBegin("vLong", ::apache::thrift::protocol::T_I64, 6);
    xfer += oprot->writeI64(this->vLong);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.vBinary) {
    xfer += oprot->writeFieldBegin("vBinary", ::apache::thrift::protocol::T_STRING, 7);
    xfer += oprot->writeBinary(this->vBinary);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(Tag &a, Tag &b) {
  using ::std::swap;
  swap(a.key, b.key);
  swap(a.vType, b.vType);
  swap(a.vStr, b.vStr);
  swap(a.vDouble, b.vDouble);
  swap(a.vBool, b.vBool);
  swap(a.vLong, b.vLong);
  swap(a.vBinary, b.vBinary);
  swap(a.__isset, b.__isset);
}

Tag::Tag(const Tag& other1) {
  key = other1.key;
  vType = other1.vType;
  vStr = other1.vStr;
  vDouble = other1.vDouble;
  vBool = other1.vBool;
  vLong = other1.vLong;
  vBinary = other1.vBinary;
  __isset = other1.__isset;
}
Tag& Tag::operator=(const Tag& other2) {
  key = other2.key;
  vType = other2.vType;
  vStr = other2.vStr;
  vDouble = other2.vDouble;
  vBool = other2.vBool;
  vLong = other2.vLong;
  vBinary = other2.vBinary;
  __isset = other2.__isset;
  return *this;
}
void Tag::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Tag(";
  out << "key=" << to_string(key);
  out << ", " << "vType=" << to_string(vType);
  out << ", " << "vStr="; (__isset.vStr ? (out << to_string(vStr)) : (out << "<null>"));
  out << ", " << "vDouble="; (__isset.vDouble ? (out << to_string(vDouble)) : (out << "<null>"));
  out << ", " << "vBool="; (__isset.vBool ? (out << to_string(vBool)) : (out << "<null>"));
  out << ", " << "vLong="; (__isset.vLong ? (out << to_string(vLong)) : (out << "<null>"));
  out << ", " << "vBinary="; (__isset.vBinary ? (out << to_string(vBinary)) : (out << "<null>"));
  out << ")";
}


Log::~Log() noexcept {
}


void Log::__set_timestamp(const int64_t val) {
  this->timestamp = val;
}

void Log::__set_fields(const std::vector<Tag> & val) {
  this->fields = val;
}
std::ostream& operator<<(std::ostream& out, const Log& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t Log::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_timestamp = false;
  bool isset_fields = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->timestamp);
          isset_timestamp = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->fields.clear();
            uint32_t _size3;
            ::apache::thrift::protocol::TType _etype6;
            xfer += iprot->readListBegin(_etype6, _size3);
            this->fields.resize(_size3);
            uint32_t _i7;
            for (_i7 = 0; _i7 < _size3; ++_i7)
            {
              xfer += this->fields[_i7].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          isset_fields = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_timestamp)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_fields)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t Log::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("Log");

  xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1);
  xfer += oprot->writeI64(this->timestamp);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("fields", ::apache::thrift::protocol::T_LIST, 2);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->fields.size()));
    std::vector<Tag> ::const_iterator _iter8;
    for (_iter8 = this->fields.begin(); _iter8 != this->fields.end(); ++_iter8)
    {
      xfer += (*_iter8).write(oprot);
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(Log &a, Log &b) {
  using ::std::swap;
  swap(a.timestamp, b.timestamp);
  swap(a.fields, b.fields);
}

Log::Log(const Log& other9) {
  timestamp = other9.timestamp;
  fields = other9.fields;
}
Log& Log::operator=(const Log& other10) {
  timestamp = other10.timestamp;
  fields = other10.fields;
  return *this;
}
void Log::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Log(";
  out << "timestamp=" << to_string(timestamp);
  out << ", " << "fields=" << to_string(fields);
  out << ")";
}


SpanRef::~SpanRef() noexcept {
}


void SpanRef::__set_refType(const SpanRefType::type val) {
  this->refType = val;
}

void SpanRef::__set_traceIdLow(const int64_t val) {
  this->traceIdLow = val;
}

void SpanRef::__set_traceIdHigh(const int64_t val) {
  this->traceIdHigh = val;
}

void SpanRef::__set_spanId(const int64_t val) {
  this->spanId = val;
}
std::ostream& operator<<(std::ostream& out, const SpanRef& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t SpanRef::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_refType = false;
  bool isset_traceIdLow = false;
  bool isset_traceIdHigh = false;
  bool isset_spanId = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          int32_t ecast11;
          xfer += iprot->readI32(ecast11);
          this->refType = (SpanRefType::type)ecast11;
          isset_refType = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->traceIdLow);
          isset_traceIdLow = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->traceIdHigh);
          isset_traceIdHigh = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->spanId);
          isset_spanId = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_refType)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_traceIdLow)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_traceIdHigh)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_spanId)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t SpanRef::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("SpanRef");

  xfer += oprot->writeFieldBegin("refType", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32((int32_t)this->refType);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("traceIdLow", ::apache::thrift::protocol::T_I64, 2);
  xfer += oprot->writeI64(this->traceIdLow);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("traceIdHigh", ::apache::thrift::protocol::T_I64, 3);
  xfer += oprot->writeI64(this->traceIdHigh);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("spanId", ::apache::thrift::protocol::T_I64, 4);
  xfer += oprot->writeI64(this->spanId);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(SpanRef &a, SpanRef &b) {
  using ::std::swap;
  swap(a.refType, b.refType);
  swap(a.traceIdLow, b.traceIdLow);
  swap(a.traceIdHigh, b.traceIdHigh);
  swap(a.spanId, b.spanId);
}

SpanRef::SpanRef(const SpanRef& other12) {
  refType = other12.refType;
  traceIdLow = other12.traceIdLow;
  traceIdHigh = other12.traceIdHigh;
  spanId = other12.spanId;
}
SpanRef& SpanRef::operator=(const SpanRef& other13) {
  refType = other13.refType;
  traceIdLow = other13.traceIdLow;
  traceIdHigh = other13.traceIdHigh;
  spanId = other13.spanId;
  return *this;
}
void SpanRef::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "SpanRef(";
  out << "refType=" << to_string(refType);
  out << ", " << "traceIdLow=" << to_string(traceIdLow);
  out << ", " << "traceIdHigh=" << to_string(traceIdHigh);
  out << ", " << "spanId=" << to_string(spanId);
  out << ")";
}


Span::~Span() noexcept {
}


void Span::__set_traceIdLow(const int64_t val) {
  this->traceIdLow = val;
}

void Span::__set_traceIdHigh(const int64_t val) {
  this->traceIdHigh = val;
}

void Span::__set_spanId(const int64_t val) {
  this->spanId = val;
}

void Span::__set_parentSpanId(const int64_t val) {
  this->parentSpanId = val;
}

void Span::__set_operationName(const std::string& val) {
  this->operationName = val;
}

void Span::__set_references(const std::vector<SpanRef> & val) {
  this->references = val;
__isset.references = true;
}

void Span::__set_flags(const int32_t val) {
  this->flags = val;
}

void Span::__set_startTime(const int64_t val) {
  this->startTime = val;
}

void Span::__set_duration(const int64_t val) {
  this->duration = val;
}

void Span::__set_tags(const std::vector<Tag> & val) {
  this->tags = val;
__isset.tags = true;
}

void Span::__set_logs(const std::vector<Log> & val) {
  this->logs = val;
__isset.logs = true;
}
std::ostream& operator<<(std::ostream& out, const Span& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t Span::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_traceIdLow = false;
  bool isset_traceIdHigh = false;
  bool isset_spanId = false;
  bool isset_parentSpanId = false;
  bool isset_operationName = false;
  bool isset_flags = false;
  bool isset_startTime = false;
  bool isset_duration = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->traceIdLow);
          isset_traceIdLow = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->traceIdHigh);
          isset_traceIdHigh = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->spanId);
          isset_spanId = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->parentSpanId);
          isset_parentSpanId = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->operationName);
          isset_operationName = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 6:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->references.clear();
            uint32_t _size14;
            ::apache::thrift::protocol::TType _etype17;
            xfer += iprot->readListBegin(_etype17, _size14);
            this->references.resize(_size14);
            uint32_t _i18;
            for (_i18 = 0; _i18 < _size14; ++_i18)
            {
              xfer += this->references[_i18].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.references = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 7:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->flags);
          isset_flags = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 8:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->startTime);
          isset_startTime = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->duration);
          isset_duration = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 10:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->tags.clear();
            uint32_t _size19;
            ::apache::thrift::protocol::TType _etype22;
            xfer += iprot->readListBegin(_etype22, _size19);
            this->tags.resize(_size19);
            uint32_t _i23;
            for (_i23 = 0; _i23 < _size19; ++_i23)
            {
              xfer += this->tags[_i23].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.tags = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->logs.clear();
            uint32_t _size24;
            ::apache::thrift::protocol::TType _etype27;
            xfer += iprot->readListBegin(_etype27, _size24);
            this->logs.resize(_size24);
            uint32_t _i28;
            for (_i28 = 0; _i28 < _size24; ++_i28)
            {
              xfer += this->logs[_i28].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.logs = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_traceIdLow)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_traceIdHigh)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_spanId)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_parentSpanId)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_operationName)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_flags)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_startTime)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_duration)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("Span");

  xfer += oprot->writeFieldBegin("traceIdLow", ::apache::thrift::protocol::T_I64, 1);
  xfer += oprot->writeI64(this->traceIdLow);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("traceIdHigh", ::apache::thrift::protocol::T_I64, 2);
  xfer += oprot->writeI64(this->traceIdHigh);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("spanId", ::apache::thrift::protocol::T_I64, 3);
  xfer += oprot->writeI64(this->spanId);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("parentSpanId", ::apache::thrift::protocol::T_I64, 4);
  xfer += oprot->writeI64(this->parentSpanId);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("operationName", ::apache::thrift::protocol::T_STRING, 5);
  xfer += oprot->writeString(this->operationName);
  xfer += oprot->writeFieldEnd();

  if (this->__isset.references) {
    xfer += oprot->writeFieldBegin("references", ::apache::thrift::protocol::T_LIST, 6);
    {
      xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->references.size()));
      std::vector<SpanRef> ::const_iterator _iter29;
      for (_iter29 = this->references.begin(); _iter29 != this->references.end(); ++_iter29)
      {
        xfer += (*_iter29).write(oprot);
      }
      xfer += oprot->writeListEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldBegin("flags", ::apache::thrift::protocol::T_I32, 7);
  xfer += oprot->writeI32(this->flags);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("startTime", ::apache::thrift::protocol::T_I64, 8);
  xfer += oprot->writeI64(this->startTime);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("duration", ::apache::thrift::protocol::T_I64, 9);
  xfer += oprot->writeI64(this->duration);
  xfer += oprot->writeFieldEnd();

  if (this->__isset.tags) {
    xfer += oprot->writeFieldBegin("tags", ::apache::thrift::protocol::T_LIST, 10);
    {
      xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->tags.size()));
      std::vector<Tag> ::const_iterator _iter30;
      for (_iter30 = this->tags.begin(); _iter30 != this->tags.end(); ++_iter30)
      {
        xfer += (*_iter30).write(oprot);
      }
      xfer += oprot->writeListEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.logs) {
    xfer += oprot->writeFieldBegin("logs", ::apache::thrift::protocol::T_LIST, 11);
    {
      xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->logs.size()));
      std::vector<Log> ::const_iterator _iter31;
      for (_iter31 = this->logs.begin(); _iter31 != this->logs.end(); ++_iter31)
      {
        xfer += (*_iter31).write(oprot);
      }
      xfer += oprot->writeListEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(Span &a, Span &b) {
  using ::std::swap;
  swap(a.traceIdLow, b.traceIdLow);
  swap(a.traceIdHigh, b.traceIdHigh);
  swap(a.spanId, b.spanId);
  swap(a.parentSpanId, b.parentSpanId);
  swap(a.operationName, b.operationName);
  swap(a.references, b.references);
  swap(a.flags, b.flags);
  swap(a.startTime, b.startTime);
  swap(a.duration, b.duration);
  swap(a.tags, b.tags);
  swap(a.logs, b.logs);
  swap(a.__isset, b.__isset);
}

Span::Span(const Span& other32) {
  traceIdLow = other32.traceIdLow;
  traceIdHigh = other32.traceIdHigh;
  spanId = other32.spanId;
  parentSpanId = other32.parentSpanId;
  operationName = other32.operationName;
  references = other32.references;
  flags = other32.flags;
  startTime = other32.startTime;
  duration = other32.duration;
  tags = other32.tags;
  logs = other32.logs;
  __isset = other32.__isset;
}
Span& Span::operator=(const Span& other33) {
  traceIdLow = other33.traceIdLow;
  traceIdHigh = other33.traceIdHigh;
  spanId = other33.spanId;
  parentSpanId = other33.parentSpanId;
  operationName = other33.operationName;
  references = other33.references;
  flags = other33.flags;
  startTime = other33.startTime;
  duration = other33.duration;
  tags = other33.tags;
  logs = other33.logs;
  __isset = other33.__isset;
  return *this;
}
void Span::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Span(";
  out << "traceIdLow=" << to_string(traceIdLow);
  out << ", " << "traceIdHigh=" << to_string(traceIdHigh);
  out << ", " << "spanId=" << to_string(spanId);
  out << ", " << "parentSpanId=" << to_string(parentSpanId);
  out << ", " << "operationName=" << to_string(operationName);
  out << ", " << "references="; (__isset.references ? (out << to_string(references)) : (out << "<null>"));
  out << ", " << "flags=" << to_string(flags);
  out << ", " << "startTime=" << to_string(startTime);
  out << ", " << "duration=" << to_string(duration);
  out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "<null>"));
  out << ", " << "logs="; (__isset.logs ? (out << to_string(logs)) : (out << "<null>"));
  out << ")";
}


Process::~Process() noexcept {
}


void Process::__set_serviceName(const std::string& val) {
  this->serviceName = val;
}

void Process::__set_tags(const std::vector<Tag> & val) {
  this->tags = val;
__isset.tags = true;
}
std::ostream& operator<<(std::ostream& out, const Process& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t Process::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_serviceName = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->serviceName);
          isset_serviceName = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->tags.clear();
            uint32_t _size34;
            ::apache::thrift::protocol::TType _etype37;
            xfer += iprot->readListBegin(_etype37, _size34);
            this->tags.resize(_size34);
            uint32_t _i38;
            for (_i38 = 0; _i38 < _size34; ++_i38)
            {
              xfer += this->tags[_i38].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.tags = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_serviceName)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t Process::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("Process");

  xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->serviceName);
  xfer += oprot->writeFieldEnd();

  if (this->__isset.tags) {
    xfer += oprot->writeFieldBegin("tags", ::apache::thrift::protocol::T_LIST, 2);
    {
      xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->tags.size()));
      std::vector<Tag> ::const_iterator _iter39;
      for (_iter39 = this->tags.begin(); _iter39 != this->tags.end(); ++_iter39)
      {
        xfer += (*_iter39).write(oprot);
      }
      xfer += oprot->writeListEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(Process &a, Process &b) {
  using ::std::swap;
  swap(a.serviceName, b.serviceName);
  swap(a.tags, b.tags);
  swap(a.__isset, b.__isset);
}

Process::Process(const Process& other40) {
  serviceName = other40.serviceName;
  tags = other40.tags;
  __isset = other40.__isset;
}
Process& Process::operator=(const Process& other41) {
  serviceName = other41.serviceName;
  tags = other41.tags;
  __isset = other41.__isset;
  return *this;
}
void Process::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Process(";
  out << "serviceName=" << to_string(serviceName);
  out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "<null>"));
  out << ")";
}


Batch::~Batch() noexcept {
}


void Batch::__set_process(const Process& val) {
  this->process = val;
}

void Batch::__set_spans(const std::vector<Span> & val) {
  this->spans = val;
}
std::ostream& operator<<(std::ostream& out, const Batch& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t Batch::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_process = false;
  bool isset_spans = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->process.read(iprot);
          isset_process = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->spans.clear();
            uint32_t _size42;
            ::apache::thrift::protocol::TType _etype45;
            xfer += iprot->readListBegin(_etype45, _size42);
            this->spans.resize(_size42);
            uint32_t _i46;
            for (_i46 = 0; _i46 < _size42; ++_i46)
            {
              xfer += this->spans[_i46].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          isset_spans = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_process)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  if (!isset_spans)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t Batch::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("Batch");

  xfer += oprot->writeFieldBegin("process", ::apache::thrift::protocol::T_STRUCT, 1);
  xfer += this->process.write(oprot);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 2);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->spans.size()));
    std::vector<Span> ::const_iterator _iter47;
    for (_iter47 = this->spans.begin(); _iter47 != this->spans.end(); ++_iter47)
    {
      xfer += (*_iter47).write(oprot);
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(Batch &a, Batch &b) {
  using ::std::swap;
  swap(a.process, b.process);
  swap(a.spans, b.spans);
}

Batch::Batch(const Batch& other48) {
  process = other48.process;
  spans = other48.spans;
}
Batch& Batch::operator=(const Batch& other49) {
  process = other49.process;
  spans = other49.spans;
  return *this;
}
void Batch::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Batch(";
  out << "process=" << to_string(process);
  out << ", " << "spans=" << to_string(spans);
  out << ")";
}


BatchSubmitResponse::~BatchSubmitResponse() noexcept {
}


void BatchSubmitResponse::__set_ok(const bool val) {
  this->ok = val;
}
std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj)
{
  obj.printTo(out);
  return out;
}


uint32_t BatchSubmitResponse::read(::apache::thrift::protocol::TProtocol* iprot) {

  ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;

  xfer += iprot->readStructBegin(fname);

  using ::apache::thrift::protocol::TProtocolException;

  bool isset_ok = false;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->ok);
          isset_ok = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  if (!isset_ok)
    throw TProtocolException(TProtocolException::INVALID_DATA);
  return xfer;
}

uint32_t BatchSubmitResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
  xfer += oprot->writeStructBegin("BatchSubmitResponse");

  xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1);
  xfer += oprot->writeBool(this->ok);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(BatchSubmitResponse &a, BatchSubmitResponse &b) {
  using ::std::swap;
  swap(a.ok, b.ok);
}

BatchSubmitResponse::BatchSubmitResponse(const BatchSubmitResponse& other50) {
  ok = other50.ok;
}
BatchSubmitResponse& BatchSubmitResponse::operator=(const BatchSubmitResponse& other51) {
  ok = other51.ok;
  return *this;
}
void BatchSubmitResponse::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "BatchSubmitResponse(";
  out << "ok=" << to_string(ok);
  out << ")";
}

}} // namespace
