#include "ThriftTest_types.h"

#include <algorithm>
#include <ostream>

#include <thrift/TToString.h>

namespace thrift { namespace test {

int _kNumberzValues[] = {
  Numberz::ONE,
  Numberz::TWO,
  Numberz::THREE,
  Numberz::FIVE,
  Numberz::SIX,
  Numberz::EIGHT
};
const char* _kNumberzNames[] = {
  "ONE",
  "TWO",
  "THREE",
  "FIVE",
  "SIX",
  "EIGHT"
};
const std::map<int, const char*> _Numberz_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(6, _kNumberzValues, _kNumberzNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));

Bonk::~Bonk() throw() {
}

void Bonk::__set_message(const std::string& val) {
  this->message = val;
}

void Bonk::__set_type(const int32_t val) {
  this->type = val;
}

uint32_t Bonk::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;

  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->message);
          this->__isset.message = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->type);
          this->__isset.type = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Bonk &a, Bonk &b) {
  using ::std::swap;
  swap(a.message, b.message);
  swap(a.type, b.type);
  swap(a.__isset, b.__isset);
}

Bonk::Bonk(const Bonk& other0) {
  message = other0.message;
  type = other0.type;
  __isset = other0.__isset;
}
Bonk& Bonk::operator=(const Bonk& other1) {
  message = other1.message;
  type = other1.type;
  __isset = other1.__isset;
  return *this;
}
void Bonk::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Bonk(";
  out << "message=" << to_string(message);
  out << ", " << "type=" << to_string(type);
  out << ")";
}

Bools::~Bools() throw() {
}

void Bools::__set_im_true(const bool val) {
  this->im_true = val;
}

void Bools::__set_im_false(const bool val) {
  this->im_false = val;
}

uint32_t Bools::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;

  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->im_true);
          this->__isset.im_true = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->im_false);
          this->__isset.im_false = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Bools &a, Bools &b) {
  using ::std::swap;
  swap(a.im_true, b.im_true);
  swap(a.im_false, b.im_false);
  swap(a.__isset, b.__isset);
}

Bools::Bools(const Bools& other2) {
  im_true = other2.im_true;
  im_false = other2.im_false;
  __isset = other2.__isset;
}
Bools& Bools::operator=(const Bools& other3) {
  im_true = other3.im_true;
  im_false = other3.im_false;
  __isset = other3.__isset;
  return *this;
}
void Bools::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Bools(";
  out << "im_true=" << to_string(im_true);
  out << ", " << "im_false=" << to_string(im_false);
  out << ")";
}

Xtruct::~Xtruct() throw() {
}

void Xtruct::__set_string_thing(const std::string& val) {
  this->string_thing = val;
}

void Xtruct::__set_byte_thing(const int8_t val) {
  this->byte_thing = val;
}

void Xtruct::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

void Xtruct::__set_i64_thing(const int64_t val) {
  this->i64_thing = val;
}

uint32_t Xtruct::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;

  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->string_thing);
          this->__isset.string_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_BYTE) {
          xfer += iprot->readByte(this->byte_thing);
          this->__isset.byte_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->i64_thing);
          this->__isset.i64_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

  xfer += oprot->writeFieldBegin("byte_thing", ::apache::thrift::protocol::T_BYTE, 4);
  xfer += oprot->writeByte(this->byte_thing);
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(Xtruct &a, Xtruct &b) {
  using ::std::swap;
  swap(a.string_thing, b.string_thing);
  swap(a.byte_thing, b.byte_thing);
  swap(a.i32_thing, b.i32_thing);
  swap(a.i64_thing, b.i64_thing);
  swap(a.__isset, b.__isset);
}

Xtruct::Xtruct(const Xtruct& other4) {
  string_thing = other4.string_thing;
  byte_thing = other4.byte_thing;
  i32_thing = other4.i32_thing;
  i64_thing = other4.i64_thing;
  __isset = other4.__isset;
}
Xtruct& Xtruct::operator=(const Xtruct& other5) {
  string_thing = other5.string_thing;
  byte_thing = other5.byte_thing;
  i32_thing = other5.i32_thing;
  i64_thing = other5.i64_thing;
  __isset = other5.__isset;
  return *this;
}
void Xtruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct(";
  out << "string_thing=" << to_string(string_thing);
  out << ", " << "byte_thing=" << to_string(byte_thing);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ", " << "i64_thing=" << to_string(i64_thing);
  out << ")";
}

Xtruct2::~Xtruct2() throw() {
}

void Xtruct2::__set_byte_thing(const int8_t val) {
  this->byte_thing = val;
}

void Xtruct2::__set_struct_thing(const Xtruct& val) {
  this->struct_thing = val;
}

void Xtruct2::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

uint32_t Xtruct2::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;

  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_BYTE) {
          xfer += iprot->readByte(this->byte_thing);
          this->__isset.byte_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->struct_thing.read(iprot);
          this->__isset.struct_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("byte_thing", ::apache::thrift::protocol::T_BYTE, 1);
  xfer += oprot->writeByte(this->byte_thing);
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(Xtruct2 &a, Xtruct2 &b) {
  using ::std::swap;
  swap(a.byte_thing, b.byte_thing);
  swap(a.struct_thing, b.struct_thing);
  swap(a.i32_thing, b.i32_thing);
  swap(a.__isset, b.__isset);
}

Xtruct2::Xtruct2(const Xtruct2& other6) {
  byte_thing = other6.byte_thing;
  struct_thing = other6.struct_thing;
  i32_thing = other6.i32_thing;
  __isset = other6.__isset;
}
Xtruct2& Xtruct2::operator=(const Xtruct2& other7) {
  byte_thing = other7.byte_thing;
  struct_thing = other7.struct_thing;
  i32_thing = other7.i32_thing;
  __isset = other7.__isset;
  return *this;
}
void Xtruct2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct2(";
  out << "byte_thing=" << to_string(byte_thing);
  out << ", " << "struct_thing=" << to_string(struct_thing);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ")";
}

Xtruct3::~Xtruct3() throw() {
}

void Xtruct3::__set_string_thing(const std::string& val) {
  this->string_thing = val;
}

void Xtruct3::__set_changed(const int32_t val) {
  this->changed = val;
}

void Xtruct3::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

void Xtruct3::__set_i64_thing(const int64_t val) {
  this->i64_thing = val;
}

uint32_t Xtruct3::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;

  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->string_thing);
          this->__isset.string_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->changed);
          this->__isset.changed = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->i64_thing);
          this->__isset.i64_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

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

void swap(Xtruct3 &a, Xtruct3 &b) {
  using ::std::swap;
  swap(a.string_thing, b.string_thing);
  swap(a.changed, b.changed);
  swap(a.i32_thing, b.i32_thing);
  swap(a.i64_thing, b.i64_thing);
  swap(a.__isset, b.__isset);
}

Xtruct3::Xtruct3(const Xtruct3& other8) {
  string_thing = other8.string_thing;
  changed = other8.changed;
  i32_thing = other8.i32_thing;
  i64_thing = other8.i64_thing;
  __isset = other8.__isset;
}
Xtruct3& Xtruct3::operator=(const Xtruct3& other9) {
  string_thing = other9.string_thing;
  changed = other9.changed;
  i32_thing = other9.i32_thing;
  i64_thing = other9.i64_thing;
  __isset = other9.__isset;
  return *this;
}
void Xtruct3::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct3(";
  out << "string_thing=" << to_string(string_thing);
  out << ", " << "changed=" << to_string(changed);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ", " << "i64_thing=" << to_string(i64_thing);
  out << ")";
}

Insanity::~Insanity() throw() {
}

void Insanity::__set_userMap(const std::map<Numberz::type, UserId> & val) {
  this->userMap = val;
}

void Insanity::__set_xtructs(const std::vector<Xtruct> & val) {
  this->xtructs = val;
}

uint32_t Insanity::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;

  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_MAP) {
          {
            this->userMap.clear();
            uint32_t _size10;
            ::apache::thrift::protocol::TType _ktype11;
            ::apache::thrift::protocol::TType _vtype12;
            xfer += iprot->readMapBegin(_ktype11, _vtype12, _size10);
            uint32_t _i14;
            for (_i14 = 0; _i14 < _size10; ++_i14)
            {
              Numberz::type _key15;
              int32_t ecast17;
              xfer += iprot->readI32(ecast17);
              _key15 = (Numberz::type)ecast17;
              UserId& _val16 = this->userMap[_key15];
              xfer += iprot->readI64(_val16);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.userMap = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->xtructs.clear();
            uint32_t _size18;
            ::apache::thrift::protocol::TType _etype21;
            xfer += iprot->readListBegin(_etype21, _size18);
            this->xtructs.resize(_size18);
            uint32_t _i22;
            for (_i22 = 0; _i22 < _size18; ++_i22)
            {
              xfer += this->xtructs[_i22].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.xtructs = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("userMap", ::apache::thrift::protocol::T_MAP, 1);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->userMap.size()));
    std::map<Numberz::type, UserId> ::const_iterator _iter23;
    for (_iter23 = this->userMap.begin(); _iter23 != this->userMap.end(); ++_iter23)
    {
      xfer += oprot->writeI32((int32_t)_iter23->first);
      xfer += oprot->writeI64(_iter23->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(Insanity &a, Insanity &b) {
  using ::std::swap;
  swap(a.userMap, b.userMap);
  swap(a.xtructs, b.xtructs);
  swap(a.__isset, b.__isset);
}

Insanity::Insanity(const Insanity& other25) {
  userMap = other25.userMap;
  xtructs = other25.xtructs;
  __isset = other25.__isset;
}
Insanity& Insanity::operator=(const Insanity& other26) {
  userMap = other26.userMap;
  xtructs = other26.xtructs;
  __isset = other26.__isset;
  return *this;
}
void Insanity::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Insanity(";
  out << "userMap=" << to_string(userMap);
  out << ", " << "xtructs=" << to_string(xtructs);
  out << ")";
}

CrazyNesting::~CrazyNesting() throw() {
}

void CrazyNesting::__set_string_field(const std::string& val) {
  this->string_field = val;
}

void CrazyNesting::__set_set_field(const std::set<Insanity> & val) {
  this->set_field = val;
__isset.set_field = true;
}

void CrazyNesting::__set_list_field(const std::vector<std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > > & val) {
  this->list_field = val;
}

void CrazyNesting::__set_binary_field(const std::string& val) {
  this->binary_field = val;
}

uint32_t CrazyNesting::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_list_field = 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->string_field);
          this->__isset.string_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->set_field.clear();
            uint32_t _size27;
            ::apache::thrift::protocol::TType _etype30;
            xfer += iprot->readSetBegin(_etype30, _size27);
            uint32_t _i31;
            for (_i31 = 0; _i31 < _size27; ++_i31)
            {
              Insanity _elem32;
              xfer += _elem32.read(iprot);
              this->set_field.insert(_elem32);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.set_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->list_field.clear();
            uint32_t _size33;
            ::apache::thrift::protocol::TType _etype36;
            xfer += iprot->readListBegin(_etype36, _size33);
            this->list_field.resize(_size33);
            uint32_t _i37;
            for (_i37 = 0; _i37 < _size33; ++_i37)
            {
              {
                this->list_field[_i37].clear();
                uint32_t _size38;
                ::apache::thrift::protocol::TType _ktype39;
                ::apache::thrift::protocol::TType _vtype40;
                xfer += iprot->readMapBegin(_ktype39, _vtype40, _size38);
                uint32_t _i42;
                for (_i42 = 0; _i42 < _size38; ++_i42)
                {
                  std::set<int32_t>  _key43;
                  {
                    _key43.clear();
                    uint32_t _size45;
                    ::apache::thrift::protocol::TType _etype48;
                    xfer += iprot->readSetBegin(_etype48, _size45);
                    uint32_t _i49;
                    for (_i49 = 0; _i49 < _size45; ++_i49)
                    {
                      int32_t _elem50;
                      xfer += iprot->readI32(_elem50);
                      _key43.insert(_elem50);
                    }
                    xfer += iprot->readSetEnd();
                  }
                  std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > & _val44 = this->list_field[_i37][_key43];
                  {
                    _val44.clear();
                    uint32_t _size51;
                    ::apache::thrift::protocol::TType _ktype52;
                    ::apache::thrift::protocol::TType _vtype53;
                    xfer += iprot->readMapBegin(_ktype52, _vtype53, _size51);
                    uint32_t _i55;
                    for (_i55 = 0; _i55 < _size51; ++_i55)
                    {
                      int32_t _key56;
                      xfer += iprot->readI32(_key56);
                      std::set<std::vector<std::map<Insanity, std::string> > > & _val57 = _val44[_key56];
                      {
                        _val57.clear();
                        uint32_t _size58;
                        ::apache::thrift::protocol::TType _etype61;
                        xfer += iprot->readSetBegin(_etype61, _size58);
                        uint32_t _i62;
                        for (_i62 = 0; _i62 < _size58; ++_i62)
                        {
                          std::vector<std::map<Insanity, std::string> >  _elem63;
                          {
                            _elem63.clear();
                            uint32_t _size64;
                            ::apache::thrift::protocol::TType _etype67;
                            xfer += iprot->readListBegin(_etype67, _size64);
                            _elem63.resize(_size64);
                            uint32_t _i68;
                            for (_i68 = 0; _i68 < _size64; ++_i68)
                            {
                              {
                                _elem63[_i68].clear();
                                uint32_t _size69;
                                ::apache::thrift::protocol::TType _ktype70;
                                ::apache::thrift::protocol::TType _vtype71;
                                xfer += iprot->readMapBegin(_ktype70, _vtype71, _size69);
                                uint32_t _i73;
                                for (_i73 = 0; _i73 < _size69; ++_i73)
                                {
                                  Insanity _key74;
                                  xfer += _key74.read(iprot);
                                  std::string& _val75 = _elem63[_i68][_key74];
                                  xfer += iprot->readString(_val75);
                                }
                                xfer += iprot->readMapEnd();
                              }
                            }
                            xfer += iprot->readListEnd();
                          }
                          _val57.insert(_elem63);
                        }
                        xfer += iprot->readSetEnd();
                      }
                    }
                    xfer += iprot->readMapEnd();
                  }
                }
                xfer += iprot->readMapEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          isset_list_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readBinary(this->binary_field);
          this->__isset.binary_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

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

  if (this->__isset.set_field) {
    xfer += oprot->writeFieldBegin("set_field", ::apache::thrift::protocol::T_SET, 2);
    {
      xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->set_field.size()));
      std::set<Insanity> ::const_iterator _iter76;
      for (_iter76 = this->set_field.begin(); _iter76 != this->set_field.end(); ++_iter76)
      {
        xfer += (*_iter76).write(oprot);
      }
      xfer += oprot->writeSetEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldBegin("list_field", ::apache::thrift::protocol::T_LIST, 3);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>(this->list_field.size()));
    std::vector<std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > > ::const_iterator _iter77;
    for (_iter77 = this->list_field.begin(); _iter77 != this->list_field.end(); ++_iter77)
    {
      {
        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_SET, ::apache::thrift::protocol::T_MAP, static_cast<uint32_t>((*_iter77).size()));
        std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > ::const_iterator _iter78;
        for (_iter78 = (*_iter77).begin(); _iter78 != (*_iter77).end(); ++_iter78)
        {
          {
            xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(_iter78->first.size()));
            std::set<int32_t> ::const_iterator _iter79;
            for (_iter79 = _iter78->first.begin(); _iter79 != _iter78->first.end(); ++_iter79)
            {
              xfer += oprot->writeI32((*_iter79));
            }
            xfer += oprot->writeSetEnd();
          }
          {
            xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>(_iter78->second.size()));
            std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > ::const_iterator _iter80;
            for (_iter80 = _iter78->second.begin(); _iter80 != _iter78->second.end(); ++_iter80)
            {
              xfer += oprot->writeI32(_iter80->first);
              {
                xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(_iter80->second.size()));
                std::set<std::vector<std::map<Insanity, std::string> > > ::const_iterator _iter81;
                for (_iter81 = _iter80->second.begin(); _iter81 != _iter80->second.end(); ++_iter81)
                {
                  {
                    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>((*_iter81).size()));
                    std::vector<std::map<Insanity, std::string> > ::const_iterator _iter82;
                    for (_iter82 = (*_iter81).begin(); _iter82 != (*_iter81).end(); ++_iter82)
                    {
                      {
                        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRUCT, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>((*_iter82).size()));
                        std::map<Insanity, std::string> ::const_iterator _iter83;
                        for (_iter83 = (*_iter82).begin(); _iter83 != (*_iter82).end(); ++_iter83)
                        {
                          xfer += _iter83->first.write(oprot);
                          xfer += oprot->writeString(_iter83->second);
                        }
                        xfer += oprot->writeMapEnd();
                      }
                    }
                    xfer += oprot->writeListEnd();
                  }
                }
                xfer += oprot->writeSetEnd();
              }
            }
            xfer += oprot->writeMapEnd();
          }
        }
        xfer += oprot->writeMapEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("binary_field", ::apache::thrift::protocol::T_STRING, 4);
  xfer += oprot->writeBinary(this->binary_field);
  xfer += oprot->writeFieldEnd();

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

void swap(CrazyNesting &a, CrazyNesting &b) {
  using ::std::swap;
  swap(a.string_field, b.string_field);
  swap(a.set_field, b.set_field);
  swap(a.list_field, b.list_field);
  swap(a.binary_field, b.binary_field);
  swap(a.__isset, b.__isset);
}

CrazyNesting::CrazyNesting(const CrazyNesting& other84) {
  string_field = other84.string_field;
  set_field = other84.set_field;
  list_field = other84.list_field;
  binary_field = other84.binary_field;
  __isset = other84.__isset;
}
CrazyNesting& CrazyNesting::operator=(const CrazyNesting& other85) {
  string_field = other85.string_field;
  set_field = other85.set_field;
  list_field = other85.list_field;
  binary_field = other85.binary_field;
  __isset = other85.__isset;
  return *this;
}
void CrazyNesting::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "CrazyNesting(";
  out << "string_field=" << to_string(string_field);
  out << ", " << "set_field="; (__isset.set_field ? (out << to_string(set_field)) : (out << "<null>"));
  out << ", " << "list_field=" << to_string(list_field);
  out << ", " << "binary_field=" << to_string(binary_field);
  out << ")";
}

Xception::~Xception() throw() {
}

void Xception::__set_errorCode(const int32_t val) {
  this->errorCode = val;
}

void Xception::__set_message(const std::string& val) {
  this->message = val;
}

uint32_t Xception::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;

  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) {
          xfer += iprot->readI32(this->errorCode);
          this->__isset.errorCode = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->message);
          this->__isset.message = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Xception &a, Xception &b) {
  using ::std::swap;
  swap(a.errorCode, b.errorCode);
  swap(a.message, b.message);
  swap(a.__isset, b.__isset);
}

Xception::Xception(const Xception& other86) : TException() {
  errorCode = other86.errorCode;
  message = other86.message;
  __isset = other86.__isset;
}
Xception& Xception::operator=(const Xception& other87) {
  errorCode = other87.errorCode;
  message = other87.message;
  __isset = other87.__isset;
  return *this;
}
void Xception::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xception(";
  out << "errorCode=" << to_string(errorCode);
  out << ", " << "message=" << to_string(message);
  out << ")";
}

const char* Xception::what() const throw() {
  try {
    std::stringstream ss;
    ss << "TException - service has thrown: " << *this;
    this->thriftTExceptionMessageHolder_ = ss.str();
    return this->thriftTExceptionMessageHolder_.c_str();
  } catch (const std::exception&) {
    return "TException - service has thrown: Xception";
  }
}

Xception2::~Xception2() throw() {
}

void Xception2::__set_errorCode(const int32_t val) {
  this->errorCode = val;
}

void Xception2::__set_struct_thing(const Xtruct& val) {
  this->struct_thing = val;
}

uint32_t Xception2::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;

  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) {
          xfer += iprot->readI32(this->errorCode);
          this->__isset.errorCode = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->struct_thing.read(iprot);
          this->__isset.struct_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Xception2 &a, Xception2 &b) {
  using ::std::swap;
  swap(a.errorCode, b.errorCode);
  swap(a.struct_thing, b.struct_thing);
  swap(a.__isset, b.__isset);
}

Xception2::Xception2(const Xception2& other88) : TException() {
  errorCode = other88.errorCode;
  struct_thing = other88.struct_thing;
  __isset = other88.__isset;
}
Xception2& Xception2::operator=(const Xception2& other89) {
  errorCode = other89.errorCode;
  struct_thing = other89.struct_thing;
  __isset = other89.__isset;
  return *this;
}
void Xception2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xception2(";
  out << "errorCode=" << to_string(errorCode);
  out << ", " << "struct_thing=" << to_string(struct_thing);
  out << ")";
}

const char* Xception2::what() const throw() {
  try {
    std::stringstream ss;
    ss << "TException - service has thrown: " << *this;
    this->thriftTExceptionMessageHolder_ = ss.str();
    return this->thriftTExceptionMessageHolder_.c_str();
  } catch (const std::exception&) {
    return "TException - service has thrown: Xception2";
  }
}

EmptyStruct::~EmptyStruct() throw() {
}

uint32_t EmptyStruct::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;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    xfer += iprot->skip(ftype);
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

void swap(EmptyStruct &a, EmptyStruct &b) {
  using ::std::swap;
  (void) a;
  (void) b;
}

EmptyStruct::EmptyStruct(const EmptyStruct& other90) {
  (void) other90;
}
EmptyStruct& EmptyStruct::operator=(const EmptyStruct& other91) {
  (void) other91;
  return *this;
}
void EmptyStruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "EmptyStruct(";
  out << ")";
}

OneField::~OneField() throw() {
}

void OneField::__set_field(const EmptyStruct& val) {
  this->field = val;
}

uint32_t OneField::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;

  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->field.read(iprot);
          this->__isset.field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

void swap(OneField &a, OneField &b) {
  using ::std::swap;
  swap(a.field, b.field);
  swap(a.__isset, b.__isset);
}

OneField::OneField(const OneField& other92) {
  field = other92.field;
  __isset = other92.__isset;
}
OneField& OneField::operator=(const OneField& other93) {
  field = other93.field;
  __isset = other93.__isset;
  return *this;
}
void OneField::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "OneField(";
  out << "field=" << to_string(field);
  out << ")";
}

VersioningTestV1::~VersioningTestV1() throw() {
}

void VersioningTestV1::__set_begin_in_both(const int32_t val) {
  this->begin_in_both = val;
}

void VersioningTestV1::__set_old_string(const std::string& val) {
  this->old_string = val;
}

void VersioningTestV1::__set_end_in_both(const int32_t val) {
  this->end_in_both = val;
}

uint32_t VersioningTestV1::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;

  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) {
          xfer += iprot->readI32(this->begin_in_both);
          this->__isset.begin_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->old_string);
          this->__isset.old_string = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 12:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->end_in_both);
          this->__isset.end_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

void swap(VersioningTestV1 &a, VersioningTestV1 &b) {
  using ::std::swap;
  swap(a.begin_in_both, b.begin_in_both);
  swap(a.old_string, b.old_string);
  swap(a.end_in_both, b.end_in_both);
  swap(a.__isset, b.__isset);
}

VersioningTestV1::VersioningTestV1(const VersioningTestV1& other94) {
  begin_in_both = other94.begin_in_both;
  old_string = other94.old_string;
  end_in_both = other94.end_in_both;
  __isset = other94.__isset;
}
VersioningTestV1& VersioningTestV1::operator=(const VersioningTestV1& other95) {
  begin_in_both = other95.begin_in_both;
  old_string = other95.old_string;
  end_in_both = other95.end_in_both;
  __isset = other95.__isset;
  return *this;
}
void VersioningTestV1::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "VersioningTestV1(";
  out << "begin_in_both=" << to_string(begin_in_both);
  out << ", " << "old_string=" << to_string(old_string);
  out << ", " << "end_in_both=" << to_string(end_in_both);
  out << ")";
}

VersioningTestV2::~VersioningTestV2() throw() {
}

void VersioningTestV2::__set_begin_in_both(const int32_t val) {
  this->begin_in_both = val;
}

void VersioningTestV2::__set_newint(const int32_t val) {
  this->newint = val;
}

void VersioningTestV2::__set_newbyte(const int8_t val) {
  this->newbyte = val;
}

void VersioningTestV2::__set_newshort(const int16_t val) {
  this->newshort = val;
}

void VersioningTestV2::__set_newlong(const int64_t val) {
  this->newlong = val;
}

void VersioningTestV2::__set_newdouble(const double val) {
  this->newdouble = val;
}

void VersioningTestV2::__set_newstruct(const Bonk& val) {
  this->newstruct = val;
}

void VersioningTestV2::__set_newlist(const std::vector<int32_t> & val) {
  this->newlist = val;
}

void VersioningTestV2::__set_newset(const std::set<int32_t> & val) {
  this->newset = val;
}

void VersioningTestV2::__set_newmap(const std::map<int32_t, int32_t> & val) {
  this->newmap = val;
}

void VersioningTestV2::__set_newstring(const std::string& val) {
  this->newstring = val;
}

void VersioningTestV2::__set_end_in_both(const int32_t val) {
  this->end_in_both = val;
}

uint32_t VersioningTestV2::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;

  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) {
          xfer += iprot->readI32(this->begin_in_both);
          this->__isset.begin_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->newint);
          this->__isset.newint = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_BYTE) {
          xfer += iprot->readByte(this->newbyte);
          this->__isset.newbyte = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I16) {
          xfer += iprot->readI16(this->newshort);
          this->__isset.newshort = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->newlong);
          this->__isset.newlong = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 6:
        if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
          xfer += iprot->readDouble(this->newdouble);
          this->__isset.newdouble = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 7:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->newstruct.read(iprot);
          this->__isset.newstruct = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 8:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->newlist.clear();
            uint32_t _size96;
            ::apache::thrift::protocol::TType _etype99;
            xfer += iprot->readListBegin(_etype99, _size96);
            this->newlist.resize(_size96);
            uint32_t _i100;
            for (_i100 = 0; _i100 < _size96; ++_i100)
            {
              xfer += iprot->readI32(this->newlist[_i100]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.newlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->newset.clear();
            uint32_t _size101;
            ::apache::thrift::protocol::TType _etype104;
            xfer += iprot->readSetBegin(_etype104, _size101);
            uint32_t _i105;
            for (_i105 = 0; _i105 < _size101; ++_i105)
            {
              int32_t _elem106;
              xfer += iprot->readI32(_elem106);
              this->newset.insert(_elem106);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.newset = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 10:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->newmap.clear();
            uint32_t _size107;
            ::apache::thrift::protocol::TType _ktype108;
            ::apache::thrift::protocol::TType _vtype109;
            xfer += iprot->readMapBegin(_ktype108, _vtype109, _size107);
            uint32_t _i111;
            for (_i111 = 0; _i111 < _size107; ++_i111)
            {
              int32_t _key112;
              xfer += iprot->readI32(_key112);
              int32_t& _val113 = this->newmap[_key112];
              xfer += iprot->readI32(_val113);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.newmap = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->newstring);
          this->__isset.newstring = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 12:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->end_in_both);
          this->__isset.end_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

  xfer += oprot->writeFieldBegin("newbyte", ::apache::thrift::protocol::T_BYTE, 3);
  xfer += oprot->writeByte(this->newbyte);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newshort", ::apache::thrift::protocol::T_I16, 4);
  xfer += oprot->writeI16(this->newshort);
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("newdouble", ::apache::thrift::protocol::T_DOUBLE, 6);
  xfer += oprot->writeDouble(this->newdouble);
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("newlist", ::apache::thrift::protocol::T_LIST, 8);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newlist.size()));
    std::vector<int32_t> ::const_iterator _iter114;
    for (_iter114 = this->newlist.begin(); _iter114 != this->newlist.end(); ++_iter114)
    {
      xfer += oprot->writeI32((*_iter114));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newset", ::apache::thrift::protocol::T_SET, 9);
  {
    xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newset.size()));
    std::set<int32_t> ::const_iterator _iter115;
    for (_iter115 = this->newset.begin(); _iter115 != this->newset.end(); ++_iter115)
    {
      xfer += oprot->writeI32((*_iter115));
    }
    xfer += oprot->writeSetEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newmap", ::apache::thrift::protocol::T_MAP, 10);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newmap.size()));
    std::map<int32_t, int32_t> ::const_iterator _iter116;
    for (_iter116 = this->newmap.begin(); _iter116 != this->newmap.end(); ++_iter116)
    {
      xfer += oprot->writeI32(_iter116->first);
      xfer += oprot->writeI32(_iter116->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(VersioningTestV2 &a, VersioningTestV2 &b) {
  using ::std::swap;
  swap(a.begin_in_both, b.begin_in_both);
  swap(a.newint, b.newint);
  swap(a.newbyte, b.newbyte);
  swap(a.newshort, b.newshort);
  swap(a.newlong, b.newlong);
  swap(a.newdouble, b.newdouble);
  swap(a.newstruct, b.newstruct);
  swap(a.newlist, b.newlist);
  swap(a.newset, b.newset);
  swap(a.newmap, b.newmap);
  swap(a.newstring, b.newstring);
  swap(a.end_in_both, b.end_in_both);
  swap(a.__isset, b.__isset);
}

VersioningTestV2::VersioningTestV2(const VersioningTestV2& other117) {
  begin_in_both = other117.begin_in_both;
  newint = other117.newint;
  newbyte = other117.newbyte;
  newshort = other117.newshort;
  newlong = other117.newlong;
  newdouble = other117.newdouble;
  newstruct = other117.newstruct;
  newlist = other117.newlist;
  newset = other117.newset;
  newmap = other117.newmap;
  newstring = other117.newstring;
  end_in_both = other117.end_in_both;
  __isset = other117.__isset;
}
VersioningTestV2& VersioningTestV2::operator=(const VersioningTestV2& other118) {
  begin_in_both = other118.begin_in_both;
  newint = other118.newint;
  newbyte = other118.newbyte;
  newshort = other118.newshort;
  newlong = other118.newlong;
  newdouble = other118.newdouble;
  newstruct = other118.newstruct;
  newlist = other118.newlist;
  newset = other118.newset;
  newmap = other118.newmap;
  newstring = other118.newstring;
  end_in_both = other118.end_in_both;
  __isset = other118.__isset;
  return *this;
}
void VersioningTestV2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "VersioningTestV2(";
  out << "begin_in_both=" << to_string(begin_in_both);
  out << ", " << "newint=" << to_string(newint);
  out << ", " << "newbyte=" << to_string(newbyte);
  out << ", " << "newshort=" << to_string(newshort);
  out << ", " << "newlong=" << to_string(newlong);
  out << ", " << "newdouble=" << to_string(newdouble);
  out << ", " << "newstruct=" << to_string(newstruct);
  out << ", " << "newlist=" << to_string(newlist);
  out << ", " << "newset=" << to_string(newset);
  out << ", " << "newmap=" << to_string(newmap);
  out << ", " << "newstring=" << to_string(newstring);
  out << ", " << "end_in_both=" << to_string(end_in_both);
  out << ")";
}

ListTypeVersioningV1::~ListTypeVersioningV1() throw() {
}

void ListTypeVersioningV1::__set_myints(const std::vector<int32_t> & val) {
  this->myints = val;
}

void ListTypeVersioningV1::__set_hello(const std::string& val) {
  this->hello = val;
}

uint32_t ListTypeVersioningV1::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;

  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_LIST) {
          {
            this->myints.clear();
            uint32_t _size119;
            ::apache::thrift::protocol::TType _etype122;
            xfer += iprot->readListBegin(_etype122, _size119);
            this->myints.resize(_size119);
            uint32_t _i123;
            for (_i123 = 0; _i123 < _size119; ++_i123)
            {
              xfer += iprot->readI32(this->myints[_i123]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.myints = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->hello);
          this->__isset.hello = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("myints", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->myints.size()));
    std::vector<int32_t> ::const_iterator _iter124;
    for (_iter124 = this->myints.begin(); _iter124 != this->myints.end(); ++_iter124)
    {
      xfer += oprot->writeI32((*_iter124));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(ListTypeVersioningV1 &a, ListTypeVersioningV1 &b) {
  using ::std::swap;
  swap(a.myints, b.myints);
  swap(a.hello, b.hello);
  swap(a.__isset, b.__isset);
}

ListTypeVersioningV1::ListTypeVersioningV1(const ListTypeVersioningV1& other125) {
  myints = other125.myints;
  hello = other125.hello;
  __isset = other125.__isset;
}
ListTypeVersioningV1& ListTypeVersioningV1::operator=(const ListTypeVersioningV1& other126) {
  myints = other126.myints;
  hello = other126.hello;
  __isset = other126.__isset;
  return *this;
}
void ListTypeVersioningV1::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListTypeVersioningV1(";
  out << "myints=" << to_string(myints);
  out << ", " << "hello=" << to_string(hello);
  out << ")";
}

ListTypeVersioningV2::~ListTypeVersioningV2() throw() {
}

void ListTypeVersioningV2::__set_strings(const std::vector<std::string> & val) {
  this->strings = val;
}

void ListTypeVersioningV2::__set_hello(const std::string& val) {
  this->hello = val;
}

uint32_t ListTypeVersioningV2::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;

  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_LIST) {
          {
            this->strings.clear();
            uint32_t _size127;
            ::apache::thrift::protocol::TType _etype130;
            xfer += iprot->readListBegin(_etype130, _size127);
            this->strings.resize(_size127);
            uint32_t _i131;
            for (_i131 = 0; _i131 < _size127; ++_i131)
            {
              xfer += iprot->readString(this->strings[_i131]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.strings = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->hello);
          this->__isset.hello = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("strings", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->strings.size()));
    std::vector<std::string> ::const_iterator _iter132;
    for (_iter132 = this->strings.begin(); _iter132 != this->strings.end(); ++_iter132)
    {
      xfer += oprot->writeString((*_iter132));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(ListTypeVersioningV2 &a, ListTypeVersioningV2 &b) {
  using ::std::swap;
  swap(a.strings, b.strings);
  swap(a.hello, b.hello);
  swap(a.__isset, b.__isset);
}

ListTypeVersioningV2::ListTypeVersioningV2(const ListTypeVersioningV2& other133) {
  strings = other133.strings;
  hello = other133.hello;
  __isset = other133.__isset;
}
ListTypeVersioningV2& ListTypeVersioningV2::operator=(const ListTypeVersioningV2& other134) {
  strings = other134.strings;
  hello = other134.hello;
  __isset = other134.__isset;
  return *this;
}
void ListTypeVersioningV2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListTypeVersioningV2(";
  out << "strings=" << to_string(strings);
  out << ", " << "hello=" << to_string(hello);
  out << ")";
}

GuessProtocolStruct::~GuessProtocolStruct() throw() {
}

void GuessProtocolStruct::__set_map_field(const std::map<std::string, std::string> & val) {
  this->map_field = val;
}

uint32_t GuessProtocolStruct::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;

  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 7:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->map_field.clear();
            uint32_t _size135;
            ::apache::thrift::protocol::TType _ktype136;
            ::apache::thrift::protocol::TType _vtype137;
            xfer += iprot->readMapBegin(_ktype136, _vtype137, _size135);
            uint32_t _i139;
            for (_i139 = 0; _i139 < _size135; ++_i139)
            {
              std::string _key140;
              xfer += iprot->readString(_key140);
              std::string& _val141 = this->map_field[_key140];
              xfer += iprot->readString(_val141);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.map_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("map_field", ::apache::thrift::protocol::T_MAP, 7);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->map_field.size()));
    std::map<std::string, std::string> ::const_iterator _iter142;
    for (_iter142 = this->map_field.begin(); _iter142 != this->map_field.end(); ++_iter142)
    {
      xfer += oprot->writeString(_iter142->first);
      xfer += oprot->writeString(_iter142->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(GuessProtocolStruct &a, GuessProtocolStruct &b) {
  using ::std::swap;
  swap(a.map_field, b.map_field);
  swap(a.__isset, b.__isset);
}

GuessProtocolStruct::GuessProtocolStruct(const GuessProtocolStruct& other143) {
  map_field = other143.map_field;
  __isset = other143.__isset;
}
GuessProtocolStruct& GuessProtocolStruct::operator=(const GuessProtocolStruct& other144) {
  map_field = other144.map_field;
  __isset = other144.__isset;
  return *this;
}
void GuessProtocolStruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "GuessProtocolStruct(";
  out << "map_field=" << to_string(map_field);
  out << ")";
}

LargeDeltas::~LargeDeltas() throw() {
}

void LargeDeltas::__set_b1(const Bools& val) {
  this->b1 = val;
}

void LargeDeltas::__set_b10(const Bools& val) {
  this->b10 = val;
}

void LargeDeltas::__set_b100(const Bools& val) {
  this->b100 = val;
}

void LargeDeltas::__set_check_true(const bool val) {
  this->check_true = val;
}

void LargeDeltas::__set_b1000(const Bools& val) {
  this->b1000 = val;
}

void LargeDeltas::__set_check_false(const bool val) {
  this->check_false = val;
}

void LargeDeltas::__set_vertwo2000(const VersioningTestV2& val) {
  this->vertwo2000 = val;
}

void LargeDeltas::__set_a_set2500(const std::set<std::string> & val) {
  this->a_set2500 = val;
}

void LargeDeltas::__set_vertwo3000(const VersioningTestV2& val) {
  this->vertwo3000 = val;
}

void LargeDeltas::__set_big_numbers(const std::vector<int32_t> & val) {
  this->big_numbers = val;
}

uint32_t LargeDeltas::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;

  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->b1.read(iprot);
          this->__isset.b1 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 10:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b10.read(iprot);
          this->__isset.b10 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 100:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b100.read(iprot);
          this->__isset.b100 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 500:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->check_true);
          this->__isset.check_true = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 1000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b1000.read(iprot);
          this->__isset.b1000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 1500:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->check_false);
          this->__isset.check_false = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->vertwo2000.read(iprot);
          this->__isset.vertwo2000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2500:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->a_set2500.clear();
            uint32_t _size145;
            ::apache::thrift::protocol::TType _etype148;
            xfer += iprot->readSetBegin(_etype148, _size145);
            uint32_t _i149;
            for (_i149 = 0; _i149 < _size145; ++_i149)
            {
              std::string _elem150;
              xfer += iprot->readString(_elem150);
              this->a_set2500.insert(_elem150);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.a_set2500 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->vertwo3000.read(iprot);
          this->__isset.vertwo3000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4000:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->big_numbers.clear();
            uint32_t _size151;
            ::apache::thrift::protocol::TType _etype154;
            xfer += iprot->readListBegin(_etype154, _size151);
            this->big_numbers.resize(_size151);
            uint32_t _i155;
            for (_i155 = 0; _i155 < _size151; ++_i155)
            {
              xfer += iprot->readI32(this->big_numbers[_i155]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.big_numbers = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

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

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

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

  xfer += oprot->writeFieldBegin("a_set2500", ::apache::thrift::protocol::T_SET, 2500);
  {
    xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->a_set2500.size()));
    std::set<std::string> ::const_iterator _iter156;
    for (_iter156 = this->a_set2500.begin(); _iter156 != this->a_set2500.end(); ++_iter156)
    {
      xfer += oprot->writeString((*_iter156));
    }
    xfer += oprot->writeSetEnd();
  }
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("big_numbers", ::apache::thrift::protocol::T_LIST, 4000);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->big_numbers.size()));
    std::vector<int32_t> ::const_iterator _iter157;
    for (_iter157 = this->big_numbers.begin(); _iter157 != this->big_numbers.end(); ++_iter157)
    {
      xfer += oprot->writeI32((*_iter157));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(LargeDeltas &a, LargeDeltas &b) {
  using ::std::swap;
  swap(a.b1, b.b1);
  swap(a.b10, b.b10);
  swap(a.b100, b.b100);
  swap(a.check_true, b.check_true);
  swap(a.b1000, b.b1000);
  swap(a.check_false, b.check_false);
  swap(a.vertwo2000, b.vertwo2000);
  swap(a.a_set2500, b.a_set2500);
  swap(a.vertwo3000, b.vertwo3000);
  swap(a.big_numbers, b.big_numbers);
  swap(a.__isset, b.__isset);
}

LargeDeltas::LargeDeltas(const LargeDeltas& other158) {
  b1 = other158.b1;
  b10 = other158.b10;
  b100 = other158.b100;
  check_true = other158.check_true;
  b1000 = other158.b1000;
  check_false = other158.check_false;
  vertwo2000 = other158.vertwo2000;
  a_set2500 = other158.a_set2500;
  vertwo3000 = other158.vertwo3000;
  big_numbers = other158.big_numbers;
  __isset = other158.__isset;
}
LargeDeltas& LargeDeltas::operator=(const LargeDeltas& other159) {
  b1 = other159.b1;
  b10 = other159.b10;
  b100 = other159.b100;
  check_true = other159.check_true;
  b1000 = other159.b1000;
  check_false = other159.check_false;
  vertwo2000 = other159.vertwo2000;
  a_set2500 = other159.a_set2500;
  vertwo3000 = other159.vertwo3000;
  big_numbers = other159.big_numbers;
  __isset = other159.__isset;
  return *this;
}
void LargeDeltas::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "LargeDeltas(";
  out << "b1=" << to_string(b1);
  out << ", " << "b10=" << to_string(b10);
  out << ", " << "b100=" << to_string(b100);
  out << ", " << "check_true=" << to_string(check_true);
  out << ", " << "b1000=" << to_string(b1000);
  out << ", " << "check_false=" << to_string(check_false);
  out << ", " << "vertwo2000=" << to_string(vertwo2000);
  out << ", " << "a_set2500=" << to_string(a_set2500);
  out << ", " << "vertwo3000=" << to_string(vertwo3000);
  out << ", " << "big_numbers=" << to_string(big_numbers);
  out << ")";
}

NestedListsI32x2::~NestedListsI32x2() throw() {
}

void NestedListsI32x2::__set_integerlist(const std::vector<std::vector<int32_t> > & val) {
  this->integerlist = val;
}

uint32_t NestedListsI32x2::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;

  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_LIST) {
          {
            this->integerlist.clear();
            uint32_t _size160;
            ::apache::thrift::protocol::TType _etype163;
            xfer += iprot->readListBegin(_etype163, _size160);
            this->integerlist.resize(_size160);
            uint32_t _i164;
            for (_i164 = 0; _i164 < _size160; ++_i164)
            {
              {
                this->integerlist[_i164].clear();
                uint32_t _size165;
                ::apache::thrift::protocol::TType _etype168;
                xfer += iprot->readListBegin(_etype168, _size165);
                this->integerlist[_i164].resize(_size165);
                uint32_t _i169;
                for (_i169 = 0; _i169 < _size165; ++_i169)
                {
                  xfer += iprot->readI32(this->integerlist[_i164][_i169]);
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.integerlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("integerlist", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->integerlist.size()));
    std::vector<std::vector<int32_t> > ::const_iterator _iter170;
    for (_iter170 = this->integerlist.begin(); _iter170 != this->integerlist.end(); ++_iter170)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter170).size()));
        std::vector<int32_t> ::const_iterator _iter171;
        for (_iter171 = (*_iter170).begin(); _iter171 != (*_iter170).end(); ++_iter171)
        {
          xfer += oprot->writeI32((*_iter171));
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsI32x2 &a, NestedListsI32x2 &b) {
  using ::std::swap;
  swap(a.integerlist, b.integerlist);
  swap(a.__isset, b.__isset);
}

NestedListsI32x2::NestedListsI32x2(const NestedListsI32x2& other172) {
  integerlist = other172.integerlist;
  __isset = other172.__isset;
}
NestedListsI32x2& NestedListsI32x2::operator=(const NestedListsI32x2& other173) {
  integerlist = other173.integerlist;
  __isset = other173.__isset;
  return *this;
}
void NestedListsI32x2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsI32x2(";
  out << "integerlist=" << to_string(integerlist);
  out << ")";
}

NestedListsI32x3::~NestedListsI32x3() throw() {
}

void NestedListsI32x3::__set_integerlist(const std::vector<std::vector<std::vector<int32_t> > > & val) {
  this->integerlist = val;
}

uint32_t NestedListsI32x3::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;

  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_LIST) {
          {
            this->integerlist.clear();
            uint32_t _size174;
            ::apache::thrift::protocol::TType _etype177;
            xfer += iprot->readListBegin(_etype177, _size174);
            this->integerlist.resize(_size174);
            uint32_t _i178;
            for (_i178 = 0; _i178 < _size174; ++_i178)
            {
              {
                this->integerlist[_i178].clear();
                uint32_t _size179;
                ::apache::thrift::protocol::TType _etype182;
                xfer += iprot->readListBegin(_etype182, _size179);
                this->integerlist[_i178].resize(_size179);
                uint32_t _i183;
                for (_i183 = 0; _i183 < _size179; ++_i183)
                {
                  {
                    this->integerlist[_i178][_i183].clear();
                    uint32_t _size184;
                    ::apache::thrift::protocol::TType _etype187;
                    xfer += iprot->readListBegin(_etype187, _size184);
                    this->integerlist[_i178][_i183].resize(_size184);
                    uint32_t _i188;
                    for (_i188 = 0; _i188 < _size184; ++_i188)
                    {
                      xfer += iprot->readI32(this->integerlist[_i178][_i183][_i188]);
                    }
                    xfer += iprot->readListEnd();
                  }
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.integerlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("integerlist", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->integerlist.size()));
    std::vector<std::vector<std::vector<int32_t> > > ::const_iterator _iter189;
    for (_iter189 = this->integerlist.begin(); _iter189 != this->integerlist.end(); ++_iter189)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*_iter189).size()));
        std::vector<std::vector<int32_t> > ::const_iterator _iter190;
        for (_iter190 = (*_iter189).begin(); _iter190 != (*_iter189).end(); ++_iter190)
        {
          {
            xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter190).size()));
            std::vector<int32_t> ::const_iterator _iter191;
            for (_iter191 = (*_iter190).begin(); _iter191 != (*_iter190).end(); ++_iter191)
            {
              xfer += oprot->writeI32((*_iter191));
            }
            xfer += oprot->writeListEnd();
          }
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsI32x3 &a, NestedListsI32x3 &b) {
  using ::std::swap;
  swap(a.integerlist, b.integerlist);
  swap(a.__isset, b.__isset);
}

NestedListsI32x3::NestedListsI32x3(const NestedListsI32x3& other192) {
  integerlist = other192.integerlist;
  __isset = other192.__isset;
}
NestedListsI32x3& NestedListsI32x3::operator=(const NestedListsI32x3& other193) {
  integerlist = other193.integerlist;
  __isset = other193.__isset;
  return *this;
}
void NestedListsI32x3::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsI32x3(";
  out << "integerlist=" << to_string(integerlist);
  out << ")";
}

NestedMixedx2::~NestedMixedx2() throw() {
}

void NestedMixedx2::__set_int_set_list(const std::vector<std::set<int32_t> > & val) {
  this->int_set_list = val;
}

void NestedMixedx2::__set_map_int_strset(const std::map<int32_t, std::set<std::string> > & val) {
  this->map_int_strset = val;
}

void NestedMixedx2::__set_map_int_strset_list(const std::vector<std::map<int32_t, std::set<std::string> > > & val) {
  this->map_int_strset_list = val;
}

uint32_t NestedMixedx2::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;

  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_LIST) {
          {
            this->int_set_list.clear();
            uint32_t _size194;
            ::apache::thrift::protocol::TType _etype197;
            xfer += iprot->readListBegin(_etype197, _size194);
            this->int_set_list.resize(_size194);
            uint32_t _i198;
            for (_i198 = 0; _i198 < _size194; ++_i198)
            {
              {
                this->int_set_list[_i198].clear();
                uint32_t _size199;
                ::apache::thrift::protocol::TType _etype202;
                xfer += iprot->readSetBegin(_etype202, _size199);
                uint32_t _i203;
                for (_i203 = 0; _i203 < _size199; ++_i203)
                {
                  int32_t _elem204;
                  xfer += iprot->readI32(_elem204);
                  this->int_set_list[_i198].insert(_elem204);
                }
                xfer += iprot->readSetEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.int_set_list = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->map_int_strset.clear();
            uint32_t _size205;
            ::apache::thrift::protocol::TType _ktype206;
            ::apache::thrift::protocol::TType _vtype207;
            xfer += iprot->readMapBegin(_ktype206, _vtype207, _size205);
            uint32_t _i209;
            for (_i209 = 0; _i209 < _size205; ++_i209)
            {
              int32_t _key210;
              xfer += iprot->readI32(_key210);
              std::set<std::string> & _val211 = this->map_int_strset[_key210];
              {
                _val211.clear();
                uint32_t _size212;
                ::apache::thrift::protocol::TType _etype215;
                xfer += iprot->readSetBegin(_etype215, _size212);
                uint32_t _i216;
                for (_i216 = 0; _i216 < _size212; ++_i216)
                {
                  std::string _elem217;
                  xfer += iprot->readString(_elem217);
                  _val211.insert(_elem217);
                }
                xfer += iprot->readSetEnd();
              }
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.map_int_strset = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->map_int_strset_list.clear();
            uint32_t _size218;
            ::apache::thrift::protocol::TType _etype221;
            xfer += iprot->readListBegin(_etype221, _size218);
            this->map_int_strset_list.resize(_size218);
            uint32_t _i222;
            for (_i222 = 0; _i222 < _size218; ++_i222)
            {
              {
                this->map_int_strset_list[_i222].clear();
                uint32_t _size223;
                ::apache::thrift::protocol::TType _ktype224;
                ::apache::thrift::protocol::TType _vtype225;
                xfer += iprot->readMapBegin(_ktype224, _vtype225, _size223);
                uint32_t _i227;
                for (_i227 = 0; _i227 < _size223; ++_i227)
                {
                  int32_t _key228;
                  xfer += iprot->readI32(_key228);
                  std::set<std::string> & _val229 = this->map_int_strset_list[_i222][_key228];
                  {
                    _val229.clear();
                    uint32_t _size230;
                    ::apache::thrift::protocol::TType _etype233;
                    xfer += iprot->readSetBegin(_etype233, _size230);
                    uint32_t _i234;
                    for (_i234 = 0; _i234 < _size230; ++_i234)
                    {
                      std::string _elem235;
                      xfer += iprot->readString(_elem235);
                      _val229.insert(_elem235);
                    }
                    xfer += iprot->readSetEnd();
                  }
                }
                xfer += iprot->readMapEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.map_int_strset_list = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("int_set_list", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_SET, static_cast<uint32_t>(this->int_set_list.size()));
    std::vector<std::set<int32_t> > ::const_iterator _iter236;
    for (_iter236 = this->int_set_list.begin(); _iter236 != this->int_set_list.end(); ++_iter236)
    {
      {
        xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter236).size()));
        std::set<int32_t> ::const_iterator _iter237;
        for (_iter237 = (*_iter236).begin(); _iter237 != (*_iter236).end(); ++_iter237)
        {
          xfer += oprot->writeI32((*_iter237));
        }
        xfer += oprot->writeSetEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("map_int_strset", ::apache::thrift::protocol::T_MAP, 2);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>(this->map_int_strset.size()));
    std::map<int32_t, std::set<std::string> > ::const_iterator _iter238;
    for (_iter238 = this->map_int_strset.begin(); _iter238 != this->map_int_strset.end(); ++_iter238)
    {
      xfer += oprot->writeI32(_iter238->first);
      {
        xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(_iter238->second.size()));
        std::set<std::string> ::const_iterator _iter239;
        for (_iter239 = _iter238->second.begin(); _iter239 != _iter238->second.end(); ++_iter239)
        {
          xfer += oprot->writeString((*_iter239));
        }
        xfer += oprot->writeSetEnd();
      }
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("map_int_strset_list", ::apache::thrift::protocol::T_LIST, 3);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>(this->map_int_strset_list.size()));
    std::vector<std::map<int32_t, std::set<std::string> > > ::const_iterator _iter240;
    for (_iter240 = this->map_int_strset_list.begin(); _iter240 != this->map_int_strset_list.end(); ++_iter240)
    {
      {
        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>((*_iter240).size()));
        std::map<int32_t, std::set<std::string> > ::const_iterator _iter241;
        for (_iter241 = (*_iter240).begin(); _iter241 != (*_iter240).end(); ++_iter241)
        {
          xfer += oprot->writeI32(_iter241->first);
          {
            xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(_iter241->second.size()));
            std::set<std::string> ::const_iterator _iter242;
            for (_iter242 = _iter241->second.begin(); _iter242 != _iter241->second.end(); ++_iter242)
            {
              xfer += oprot->writeString((*_iter242));
            }
            xfer += oprot->writeSetEnd();
          }
        }
        xfer += oprot->writeMapEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedMixedx2 &a, NestedMixedx2 &b) {
  using ::std::swap;
  swap(a.int_set_list, b.int_set_list);
  swap(a.map_int_strset, b.map_int_strset);
  swap(a.map_int_strset_list, b.map_int_strset_list);
  swap(a.__isset, b.__isset);
}

NestedMixedx2::NestedMixedx2(const NestedMixedx2& other243) {
  int_set_list = other243.int_set_list;
  map_int_strset = other243.map_int_strset;
  map_int_strset_list = other243.map_int_strset_list;
  __isset = other243.__isset;
}
NestedMixedx2& NestedMixedx2::operator=(const NestedMixedx2& other244) {
  int_set_list = other244.int_set_list;
  map_int_strset = other244.map_int_strset;
  map_int_strset_list = other244.map_int_strset_list;
  __isset = other244.__isset;
  return *this;
}
void NestedMixedx2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedMixedx2(";
  out << "int_set_list=" << to_string(int_set_list);
  out << ", " << "map_int_strset=" << to_string(map_int_strset);
  out << ", " << "map_int_strset_list=" << to_string(map_int_strset_list);
  out << ")";
}

ListBonks::~ListBonks() throw() {
}

void ListBonks::__set_bonk(const std::vector<Bonk> & val) {
  this->bonk = val;
}

uint32_t ListBonks::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;

  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_LIST) {
          {
            this->bonk.clear();
            uint32_t _size245;
            ::apache::thrift::protocol::TType _etype248;
            xfer += iprot->readListBegin(_etype248, _size245);
            this->bonk.resize(_size245);
            uint32_t _i249;
            for (_i249 = 0; _i249 < _size245; ++_i249)
            {
              xfer += this->bonk[_i249].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.bonk = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

void swap(ListBonks &a, ListBonks &b) {
  using ::std::swap;
  swap(a.bonk, b.bonk);
  swap(a.__isset, b.__isset);
}

ListBonks::ListBonks(const ListBonks& other251) {
  bonk = other251.bonk;
  __isset = other251.__isset;
}
ListBonks& ListBonks::operator=(const ListBonks& other252) {
  bonk = other252.bonk;
  __isset = other252.__isset;
  return *this;
}
void ListBonks::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListBonks(";
  out << "bonk=" << to_string(bonk);
  out << ")";
}

NestedListsBonk::~NestedListsBonk() throw() {
}

void NestedListsBonk::__set_bonk(const std::vector<std::vector<std::vector<Bonk> > > & val) {
  this->bonk = val;
}

uint32_t NestedListsBonk::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;

  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_LIST) {
          {
            this->bonk.clear();
            uint32_t _size253;
            ::apache::thrift::protocol::TType _etype256;
            xfer += iprot->readListBegin(_etype256, _size253);
            this->bonk.resize(_size253);
            uint32_t _i257;
            for (_i257 = 0; _i257 < _size253; ++_i257)
            {
              {
                this->bonk[_i257].clear();
                uint32_t _size258;
                ::apache::thrift::protocol::TType _etype261;
                xfer += iprot->readListBegin(_etype261, _size258);
                this->bonk[_i257].resize(_size258);
                uint32_t _i262;
                for (_i262 = 0; _i262 < _size258; ++_i262)
                {
                  {
                    this->bonk[_i257][_i262].clear();
                    uint32_t _size263;
                    ::apache::thrift::protocol::TType _etype266;
                    xfer += iprot->readListBegin(_etype266, _size263);
                    this->bonk[_i257][_i262].resize(_size263);
                    uint32_t _i267;
                    for (_i267 = 0; _i267 < _size263; ++_i267)
                    {
                      xfer += this->bonk[_i257][_i262][_i267].read(iprot);
                    }
                    xfer += iprot->readListEnd();
                  }
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.bonk = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("bonk", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->bonk.size()));
    std::vector<std::vector<std::vector<Bonk> > > ::const_iterator _iter268;
    for (_iter268 = this->bonk.begin(); _iter268 != this->bonk.end(); ++_iter268)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*_iter268).size()));
        std::vector<std::vector<Bonk> > ::const_iterator _iter269;
        for (_iter269 = (*_iter268).begin(); _iter269 != (*_iter268).end(); ++_iter269)
        {
          {
            xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*_iter269).size()));
            std::vector<Bonk> ::const_iterator _iter270;
            for (_iter270 = (*_iter269).begin(); _iter270 != (*_iter269).end(); ++_iter270)
            {
              xfer += (*_iter270).write(oprot);
            }
            xfer += oprot->writeListEnd();
          }
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsBonk &a, NestedListsBonk &b) {
  using ::std::swap;
  swap(a.bonk, b.bonk);
  swap(a.__isset, b.__isset);
}

NestedListsBonk::NestedListsBonk(const NestedListsBonk& other271) {
  bonk = other271.bonk;
  __isset = other271.__isset;
}
NestedListsBonk& NestedListsBonk::operator=(const NestedListsBonk& other272) {
  bonk = other272.bonk;
  __isset = other272.__isset;
  return *this;
}
void NestedListsBonk::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsBonk(";
  out << "bonk=" << to_string(bonk);
  out << ")";
}

BoolTest::~BoolTest() throw() {
}

void BoolTest::__set_b(const bool val) {
  this->b = val;
__isset.b = true;
}

void BoolTest::__set_s(const std::string& val) {
  this->s = val;
__isset.s = true;
}

uint32_t BoolTest::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;

  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->b);
          this->__isset.b = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->s);
          this->__isset.s = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  if (this->__isset.b) {
    xfer += oprot->writeFieldBegin("b", ::apache::thrift::protocol::T_BOOL, 1);
    xfer += oprot->writeBool(this->b);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.s) {
    xfer += oprot->writeFieldBegin("s", ::apache::thrift::protocol::T_STRING, 2);
    xfer += oprot->writeString(this->s);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(BoolTest &a, BoolTest &b) {
  using ::std::swap;
  swap(a.b, b.b);
  swap(a.s, b.s);
  swap(a.__isset, b.__isset);
}

BoolTest::BoolTest(const BoolTest& other273) {
  b = other273.b;
  s = other273.s;
  __isset = other273.__isset;
}
BoolTest& BoolTest::operator=(const BoolTest& other274) {
  b = other274.b;
  s = other274.s;
  __isset = other274.__isset;
  return *this;
}
void BoolTest::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "BoolTest(";
  out << "b="; (__isset.b ? (out << to_string(b)) : (out << "<null>"));
  out << ", " << "s="; (__isset.s ? (out << to_string(s)) : (out << "<null>"));
  out << ")";
}

StructA::~StructA() throw() {
}

void StructA::__set_s(const std::string& val) {
  this->s = val;
}

uint32_t StructA::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_s = 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->s);
          isset_s = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

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

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

void swap(StructA &a, StructA &b) {
  using ::std::swap;
  swap(a.s, b.s);
}

StructA::StructA(const StructA& other275) {
  s = other275.s;
}
StructA& StructA::operator=(const StructA& other276) {
  s = other276.s;
  return *this;
}
void StructA::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "StructA(";
  out << "s=" << to_string(s);
  out << ")";
}

StructB::~StructB() throw() {
}

void StructB::__set_aa(const StructA& val) {
  this->aa = val;
__isset.aa = true;
}

void StructB::__set_ab(const StructA& val) {
  this->ab = val;
}

uint32_t StructB::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_ab = 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->aa.read(iprot);
          this->__isset.aa = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->ab.read(iprot);
          isset_ab = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

  if (this->__isset.aa) {
    xfer += oprot->writeFieldBegin("aa", ::apache::thrift::protocol::T_STRUCT, 1);
    xfer += this->aa.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldBegin("ab", ::apache::thrift::protocol::T_STRUCT, 2);
  xfer += this->ab.write(oprot);
  xfer += oprot->writeFieldEnd();

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

void swap(StructB &a, StructB &b) {
  using ::std::swap;
  swap(a.aa, b.aa);
  swap(a.ab, b.ab);
  swap(a.__isset, b.__isset);
}

StructB::StructB(const StructB& other277) {
  aa = other277.aa;
  ab = other277.ab;
  __isset = other277.__isset;
}
StructB& StructB::operator=(const StructB& other278) {
  aa = other278.aa;
  ab = other278.ab;
  __isset = other278.__isset;
  return *this;
}
void StructB::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "StructB(";
  out << "aa="; (__isset.aa ? (out << to_string(aa)) : (out << "<null>"));
  out << ", " << "ab=" << to_string(ab);
  out << ")";
}

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

#include <algorithm>
#include <ostream>

#include <thrift/TToString.h>

namespace thrift { namespace test {

int _kNumberzValues[] = {
  Numberz::ONE,
  Numberz::TWO,
  Numberz::THREE,
  Numberz::FIVE,
  Numberz::SIX,
  Numberz::EIGHT
};
const char* _kNumberzNames[] = {
  "ONE",
  "TWO",
  "THREE",
  "FIVE",
  "SIX",
  "EIGHT"
};
const std::map<int, const char*> _Numberz_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(6, _kNumberzValues, _kNumberzNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));


Bonk::~Bonk() throw() {
}


void Bonk::__set_message(const std::string& val) {
  this->message = val;
}

void Bonk::__set_type(const int32_t val) {
  this->type = val;
}

uint32_t Bonk::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;


  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->message);
          this->__isset.message = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->type);
          this->__isset.type = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Bonk &a, Bonk &b) {
  using ::std::swap;
  swap(a.message, b.message);
  swap(a.type, b.type);
  swap(a.__isset, b.__isset);
}

Bonk::Bonk(const Bonk& other0) {
  message = other0.message;
  type = other0.type;
  __isset = other0.__isset;
}
Bonk& Bonk::operator=(const Bonk& other1) {
  message = other1.message;
  type = other1.type;
  __isset = other1.__isset;
  return *this;
}
void Bonk::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Bonk(";
  out << "message=" << to_string(message);
  out << ", " << "type=" << to_string(type);
  out << ")";
}


Bools::~Bools() throw() {
}


void Bools::__set_im_true(const bool val) {
  this->im_true = val;
}

void Bools::__set_im_false(const bool val) {
  this->im_false = val;
}

uint32_t Bools::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;


  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->im_true);
          this->__isset.im_true = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->im_false);
          this->__isset.im_false = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Bools &a, Bools &b) {
  using ::std::swap;
  swap(a.im_true, b.im_true);
  swap(a.im_false, b.im_false);
  swap(a.__isset, b.__isset);
}

Bools::Bools(const Bools& other2) {
  im_true = other2.im_true;
  im_false = other2.im_false;
  __isset = other2.__isset;
}
Bools& Bools::operator=(const Bools& other3) {
  im_true = other3.im_true;
  im_false = other3.im_false;
  __isset = other3.__isset;
  return *this;
}
void Bools::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Bools(";
  out << "im_true=" << to_string(im_true);
  out << ", " << "im_false=" << to_string(im_false);
  out << ")";
}


Xtruct::~Xtruct() throw() {
}


void Xtruct::__set_string_thing(const std::string& val) {
  this->string_thing = val;
}

void Xtruct::__set_byte_thing(const int8_t val) {
  this->byte_thing = val;
}

void Xtruct::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

void Xtruct::__set_i64_thing(const int64_t val) {
  this->i64_thing = val;
}

uint32_t Xtruct::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;


  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->string_thing);
          this->__isset.string_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_BYTE) {
          xfer += iprot->readByte(this->byte_thing);
          this->__isset.byte_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->i64_thing);
          this->__isset.i64_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

  xfer += oprot->writeFieldBegin("byte_thing", ::apache::thrift::protocol::T_BYTE, 4);
  xfer += oprot->writeByte(this->byte_thing);
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(Xtruct &a, Xtruct &b) {
  using ::std::swap;
  swap(a.string_thing, b.string_thing);
  swap(a.byte_thing, b.byte_thing);
  swap(a.i32_thing, b.i32_thing);
  swap(a.i64_thing, b.i64_thing);
  swap(a.__isset, b.__isset);
}

Xtruct::Xtruct(const Xtruct& other4) {
  string_thing = other4.string_thing;
  byte_thing = other4.byte_thing;
  i32_thing = other4.i32_thing;
  i64_thing = other4.i64_thing;
  __isset = other4.__isset;
}
Xtruct& Xtruct::operator=(const Xtruct& other5) {
  string_thing = other5.string_thing;
  byte_thing = other5.byte_thing;
  i32_thing = other5.i32_thing;
  i64_thing = other5.i64_thing;
  __isset = other5.__isset;
  return *this;
}
void Xtruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct(";
  out << "string_thing=" << to_string(string_thing);
  out << ", " << "byte_thing=" << to_string(byte_thing);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ", " << "i64_thing=" << to_string(i64_thing);
  out << ")";
}


Xtruct2::~Xtruct2() throw() {
}


void Xtruct2::__set_byte_thing(const int8_t val) {
  this->byte_thing = val;
}

void Xtruct2::__set_struct_thing(const Xtruct& val) {
  this->struct_thing = val;
}

void Xtruct2::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

uint32_t Xtruct2::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;


  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_BYTE) {
          xfer += iprot->readByte(this->byte_thing);
          this->__isset.byte_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->struct_thing.read(iprot);
          this->__isset.struct_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("byte_thing", ::apache::thrift::protocol::T_BYTE, 1);
  xfer += oprot->writeByte(this->byte_thing);
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(Xtruct2 &a, Xtruct2 &b) {
  using ::std::swap;
  swap(a.byte_thing, b.byte_thing);
  swap(a.struct_thing, b.struct_thing);
  swap(a.i32_thing, b.i32_thing);
  swap(a.__isset, b.__isset);
}

Xtruct2::Xtruct2(const Xtruct2& other6) {
  byte_thing = other6.byte_thing;
  struct_thing = other6.struct_thing;
  i32_thing = other6.i32_thing;
  __isset = other6.__isset;
}
Xtruct2& Xtruct2::operator=(const Xtruct2& other7) {
  byte_thing = other7.byte_thing;
  struct_thing = other7.struct_thing;
  i32_thing = other7.i32_thing;
  __isset = other7.__isset;
  return *this;
}
void Xtruct2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct2(";
  out << "byte_thing=" << to_string(byte_thing);
  out << ", " << "struct_thing=" << to_string(struct_thing);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ")";
}


Xtruct3::~Xtruct3() throw() {
}


void Xtruct3::__set_string_thing(const std::string& val) {
  this->string_thing = val;
}

void Xtruct3::__set_changed(const int32_t val) {
  this->changed = val;
}

void Xtruct3::__set_i32_thing(const int32_t val) {
  this->i32_thing = val;
}

void Xtruct3::__set_i64_thing(const int64_t val) {
  this->i64_thing = val;
}

uint32_t Xtruct3::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;


  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->string_thing);
          this->__isset.string_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->changed);
          this->__isset.changed = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->i32_thing);
          this->__isset.i32_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->i64_thing);
          this->__isset.i64_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

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

void swap(Xtruct3 &a, Xtruct3 &b) {
  using ::std::swap;
  swap(a.string_thing, b.string_thing);
  swap(a.changed, b.changed);
  swap(a.i32_thing, b.i32_thing);
  swap(a.i64_thing, b.i64_thing);
  swap(a.__isset, b.__isset);
}

Xtruct3::Xtruct3(const Xtruct3& other8) {
  string_thing = other8.string_thing;
  changed = other8.changed;
  i32_thing = other8.i32_thing;
  i64_thing = other8.i64_thing;
  __isset = other8.__isset;
}
Xtruct3& Xtruct3::operator=(const Xtruct3& other9) {
  string_thing = other9.string_thing;
  changed = other9.changed;
  i32_thing = other9.i32_thing;
  i64_thing = other9.i64_thing;
  __isset = other9.__isset;
  return *this;
}
void Xtruct3::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xtruct3(";
  out << "string_thing=" << to_string(string_thing);
  out << ", " << "changed=" << to_string(changed);
  out << ", " << "i32_thing=" << to_string(i32_thing);
  out << ", " << "i64_thing=" << to_string(i64_thing);
  out << ")";
}


Insanity::~Insanity() throw() {
}


void Insanity::__set_userMap(const std::map<Numberz::type, UserId> & val) {
  this->userMap = val;
}

void Insanity::__set_xtructs(const std::vector<Xtruct> & val) {
  this->xtructs = val;
}

uint32_t Insanity::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;


  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_MAP) {
          {
            this->userMap.clear();
            uint32_t _size10;
            ::apache::thrift::protocol::TType _ktype11;
            ::apache::thrift::protocol::TType _vtype12;
            xfer += iprot->readMapBegin(_ktype11, _vtype12, _size10);
            uint32_t _i14;
            for (_i14 = 0; _i14 < _size10; ++_i14)
            {
              Numberz::type _key15;
              int32_t ecast17;
              xfer += iprot->readI32(ecast17);
              _key15 = (Numberz::type)ecast17;
              UserId& _val16 = this->userMap[_key15];
              xfer += iprot->readI64(_val16);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.userMap = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->xtructs.clear();
            uint32_t _size18;
            ::apache::thrift::protocol::TType _etype21;
            xfer += iprot->readListBegin(_etype21, _size18);
            this->xtructs.resize(_size18);
            uint32_t _i22;
            for (_i22 = 0; _i22 < _size18; ++_i22)
            {
              xfer += this->xtructs[_i22].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.xtructs = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("userMap", ::apache::thrift::protocol::T_MAP, 1);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->userMap.size()));
    std::map<Numberz::type, UserId> ::const_iterator _iter23;
    for (_iter23 = this->userMap.begin(); _iter23 != this->userMap.end(); ++_iter23)
    {
      xfer += oprot->writeI32((int32_t)_iter23->first);
      xfer += oprot->writeI64(_iter23->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(Insanity &a, Insanity &b) {
  using ::std::swap;
  swap(a.userMap, b.userMap);
  swap(a.xtructs, b.xtructs);
  swap(a.__isset, b.__isset);
}

Insanity::Insanity(const Insanity& other25) {
  userMap = other25.userMap;
  xtructs = other25.xtructs;
  __isset = other25.__isset;
}
Insanity& Insanity::operator=(const Insanity& other26) {
  userMap = other26.userMap;
  xtructs = other26.xtructs;
  __isset = other26.__isset;
  return *this;
}
void Insanity::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Insanity(";
  out << "userMap=" << to_string(userMap);
  out << ", " << "xtructs=" << to_string(xtructs);
  out << ")";
}


CrazyNesting::~CrazyNesting() throw() {
}


void CrazyNesting::__set_string_field(const std::string& val) {
  this->string_field = val;
}

void CrazyNesting::__set_set_field(const std::set<Insanity> & val) {
  this->set_field = val;
__isset.set_field = true;
}

void CrazyNesting::__set_list_field(const std::vector<std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > > & val) {
  this->list_field = val;
}

void CrazyNesting::__set_binary_field(const std::string& val) {
  this->binary_field = val;
}

uint32_t CrazyNesting::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_list_field = 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->string_field);
          this->__isset.string_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->set_field.clear();
            uint32_t _size27;
            ::apache::thrift::protocol::TType _etype30;
            xfer += iprot->readSetBegin(_etype30, _size27);
            uint32_t _i31;
            for (_i31 = 0; _i31 < _size27; ++_i31)
            {
              Insanity _elem32;
              xfer += _elem32.read(iprot);
              this->set_field.insert(_elem32);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.set_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->list_field.clear();
            uint32_t _size33;
            ::apache::thrift::protocol::TType _etype36;
            xfer += iprot->readListBegin(_etype36, _size33);
            this->list_field.resize(_size33);
            uint32_t _i37;
            for (_i37 = 0; _i37 < _size33; ++_i37)
            {
              {
                this->list_field[_i37].clear();
                uint32_t _size38;
                ::apache::thrift::protocol::TType _ktype39;
                ::apache::thrift::protocol::TType _vtype40;
                xfer += iprot->readMapBegin(_ktype39, _vtype40, _size38);
                uint32_t _i42;
                for (_i42 = 0; _i42 < _size38; ++_i42)
                {
                  std::set<int32_t>  _key43;
                  {
                    _key43.clear();
                    uint32_t _size45;
                    ::apache::thrift::protocol::TType _etype48;
                    xfer += iprot->readSetBegin(_etype48, _size45);
                    uint32_t _i49;
                    for (_i49 = 0; _i49 < _size45; ++_i49)
                    {
                      int32_t _elem50;
                      xfer += iprot->readI32(_elem50);
                      _key43.insert(_elem50);
                    }
                    xfer += iprot->readSetEnd();
                  }
                  std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > & _val44 = this->list_field[_i37][_key43];
                  {
                    _val44.clear();
                    uint32_t _size51;
                    ::apache::thrift::protocol::TType _ktype52;
                    ::apache::thrift::protocol::TType _vtype53;
                    xfer += iprot->readMapBegin(_ktype52, _vtype53, _size51);
                    uint32_t _i55;
                    for (_i55 = 0; _i55 < _size51; ++_i55)
                    {
                      int32_t _key56;
                      xfer += iprot->readI32(_key56);
                      std::set<std::vector<std::map<Insanity, std::string> > > & _val57 = _val44[_key56];
                      {
                        _val57.clear();
                        uint32_t _size58;
                        ::apache::thrift::protocol::TType _etype61;
                        xfer += iprot->readSetBegin(_etype61, _size58);
                        uint32_t _i62;
                        for (_i62 = 0; _i62 < _size58; ++_i62)
                        {
                          std::vector<std::map<Insanity, std::string> >  _elem63;
                          {
                            _elem63.clear();
                            uint32_t _size64;
                            ::apache::thrift::protocol::TType _etype67;
                            xfer += iprot->readListBegin(_etype67, _size64);
                            _elem63.resize(_size64);
                            uint32_t _i68;
                            for (_i68 = 0; _i68 < _size64; ++_i68)
                            {
                              {
                                _elem63[_i68].clear();
                                uint32_t _size69;
                                ::apache::thrift::protocol::TType _ktype70;
                                ::apache::thrift::protocol::TType _vtype71;
                                xfer += iprot->readMapBegin(_ktype70, _vtype71, _size69);
                                uint32_t _i73;
                                for (_i73 = 0; _i73 < _size69; ++_i73)
                                {
                                  Insanity _key74;
                                  xfer += _key74.read(iprot);
                                  std::string& _val75 = _elem63[_i68][_key74];
                                  xfer += iprot->readString(_val75);
                                }
                                xfer += iprot->readMapEnd();
                              }
                            }
                            xfer += iprot->readListEnd();
                          }
                          _val57.insert(_elem63);
                        }
                        xfer += iprot->readSetEnd();
                      }
                    }
                    xfer += iprot->readMapEnd();
                  }
                }
                xfer += iprot->readMapEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          isset_list_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readBinary(this->binary_field);
          this->__isset.binary_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

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

  if (this->__isset.set_field) {
    xfer += oprot->writeFieldBegin("set_field", ::apache::thrift::protocol::T_SET, 2);
    {
      xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->set_field.size()));
      std::set<Insanity> ::const_iterator _iter76;
      for (_iter76 = this->set_field.begin(); _iter76 != this->set_field.end(); ++_iter76)
      {
        xfer += (*_iter76).write(oprot);
      }
      xfer += oprot->writeSetEnd();
    }
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldBegin("list_field", ::apache::thrift::protocol::T_LIST, 3);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>(this->list_field.size()));
    std::vector<std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > > ::const_iterator _iter77;
    for (_iter77 = this->list_field.begin(); _iter77 != this->list_field.end(); ++_iter77)
    {
      {
        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_SET, ::apache::thrift::protocol::T_MAP, static_cast<uint32_t>((*_iter77).size()));
        std::map<std::set<int32_t> , std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > > ::const_iterator _iter78;
        for (_iter78 = (*_iter77).begin(); _iter78 != (*_iter77).end(); ++_iter78)
        {
          {
            xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(_iter78->first.size()));
            std::set<int32_t> ::const_iterator _iter79;
            for (_iter79 = _iter78->first.begin(); _iter79 != _iter78->first.end(); ++_iter79)
            {
              xfer += oprot->writeI32((*_iter79));
            }
            xfer += oprot->writeSetEnd();
          }
          {
            xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>(_iter78->second.size()));
            std::map<int32_t, std::set<std::vector<std::map<Insanity, std::string> > > > ::const_iterator _iter80;
            for (_iter80 = _iter78->second.begin(); _iter80 != _iter78->second.end(); ++_iter80)
            {
              xfer += oprot->writeI32(_iter80->first);
              {
                xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(_iter80->second.size()));
                std::set<std::vector<std::map<Insanity, std::string> > > ::const_iterator _iter81;
                for (_iter81 = _iter80->second.begin(); _iter81 != _iter80->second.end(); ++_iter81)
                {
                  {
                    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>((*_iter81).size()));
                    std::vector<std::map<Insanity, std::string> > ::const_iterator _iter82;
                    for (_iter82 = (*_iter81).begin(); _iter82 != (*_iter81).end(); ++_iter82)
                    {
                      {
                        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRUCT, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>((*_iter82).size()));
                        std::map<Insanity, std::string> ::const_iterator _iter83;
                        for (_iter83 = (*_iter82).begin(); _iter83 != (*_iter82).end(); ++_iter83)
                        {
                          xfer += _iter83->first.write(oprot);
                          xfer += oprot->writeString(_iter83->second);
                        }
                        xfer += oprot->writeMapEnd();
                      }
                    }
                    xfer += oprot->writeListEnd();
                  }
                }
                xfer += oprot->writeSetEnd();
              }
            }
            xfer += oprot->writeMapEnd();
          }
        }
        xfer += oprot->writeMapEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("binary_field", ::apache::thrift::protocol::T_STRING, 4);
  xfer += oprot->writeBinary(this->binary_field);
  xfer += oprot->writeFieldEnd();

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

void swap(CrazyNesting &a, CrazyNesting &b) {
  using ::std::swap;
  swap(a.string_field, b.string_field);
  swap(a.set_field, b.set_field);
  swap(a.list_field, b.list_field);
  swap(a.binary_field, b.binary_field);
  swap(a.__isset, b.__isset);
}

CrazyNesting::CrazyNesting(const CrazyNesting& other84) {
  string_field = other84.string_field;
  set_field = other84.set_field;
  list_field = other84.list_field;
  binary_field = other84.binary_field;
  __isset = other84.__isset;
}
CrazyNesting& CrazyNesting::operator=(const CrazyNesting& other85) {
  string_field = other85.string_field;
  set_field = other85.set_field;
  list_field = other85.list_field;
  binary_field = other85.binary_field;
  __isset = other85.__isset;
  return *this;
}
void CrazyNesting::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "CrazyNesting(";
  out << "string_field=" << to_string(string_field);
  out << ", " << "set_field="; (__isset.set_field ? (out << to_string(set_field)) : (out << "<null>"));
  out << ", " << "list_field=" << to_string(list_field);
  out << ", " << "binary_field=" << to_string(binary_field);
  out << ")";
}


Xception::~Xception() throw() {
}


void Xception::__set_errorCode(const int32_t val) {
  this->errorCode = val;
}

void Xception::__set_message(const std::string& val) {
  this->message = val;
}

uint32_t Xception::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;


  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) {
          xfer += iprot->readI32(this->errorCode);
          this->__isset.errorCode = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->message);
          this->__isset.message = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Xception &a, Xception &b) {
  using ::std::swap;
  swap(a.errorCode, b.errorCode);
  swap(a.message, b.message);
  swap(a.__isset, b.__isset);
}

Xception::Xception(const Xception& other86) : TException() {
  errorCode = other86.errorCode;
  message = other86.message;
  __isset = other86.__isset;
}
Xception& Xception::operator=(const Xception& other87) {
  errorCode = other87.errorCode;
  message = other87.message;
  __isset = other87.__isset;
  return *this;
}
void Xception::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xception(";
  out << "errorCode=" << to_string(errorCode);
  out << ", " << "message=" << to_string(message);
  out << ")";
}

const char* Xception::what() const throw() {
  try {
    std::stringstream ss;
    ss << "TException - service has thrown: " << *this;
    this->thriftTExceptionMessageHolder_ = ss.str();
    return this->thriftTExceptionMessageHolder_.c_str();
  } catch (const std::exception&) {
    return "TException - service has thrown: Xception";
  }
}


Xception2::~Xception2() throw() {
}


void Xception2::__set_errorCode(const int32_t val) {
  this->errorCode = val;
}

void Xception2::__set_struct_thing(const Xtruct& val) {
  this->struct_thing = val;
}

uint32_t Xception2::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;


  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) {
          xfer += iprot->readI32(this->errorCode);
          this->__isset.errorCode = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->struct_thing.read(iprot);
          this->__isset.struct_thing = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

void swap(Xception2 &a, Xception2 &b) {
  using ::std::swap;
  swap(a.errorCode, b.errorCode);
  swap(a.struct_thing, b.struct_thing);
  swap(a.__isset, b.__isset);
}

Xception2::Xception2(const Xception2& other88) : TException() {
  errorCode = other88.errorCode;
  struct_thing = other88.struct_thing;
  __isset = other88.__isset;
}
Xception2& Xception2::operator=(const Xception2& other89) {
  errorCode = other89.errorCode;
  struct_thing = other89.struct_thing;
  __isset = other89.__isset;
  return *this;
}
void Xception2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "Xception2(";
  out << "errorCode=" << to_string(errorCode);
  out << ", " << "struct_thing=" << to_string(struct_thing);
  out << ")";
}

const char* Xception2::what() const throw() {
  try {
    std::stringstream ss;
    ss << "TException - service has thrown: " << *this;
    this->thriftTExceptionMessageHolder_ = ss.str();
    return this->thriftTExceptionMessageHolder_.c_str();
  } catch (const std::exception&) {
    return "TException - service has thrown: Xception2";
  }
}


EmptyStruct::~EmptyStruct() throw() {
}


uint32_t EmptyStruct::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;


  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    xfer += iprot->skip(ftype);
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

void swap(EmptyStruct &a, EmptyStruct &b) {
  using ::std::swap;
  (void) a;
  (void) b;
}

EmptyStruct::EmptyStruct(const EmptyStruct& other90) {
  (void) other90;
}
EmptyStruct& EmptyStruct::operator=(const EmptyStruct& other91) {
  (void) other91;
  return *this;
}
void EmptyStruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "EmptyStruct(";
  out << ")";
}


OneField::~OneField() throw() {
}


void OneField::__set_field(const EmptyStruct& val) {
  this->field = val;
}

uint32_t OneField::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;


  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->field.read(iprot);
          this->__isset.field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

void swap(OneField &a, OneField &b) {
  using ::std::swap;
  swap(a.field, b.field);
  swap(a.__isset, b.__isset);
}

OneField::OneField(const OneField& other92) {
  field = other92.field;
  __isset = other92.__isset;
}
OneField& OneField::operator=(const OneField& other93) {
  field = other93.field;
  __isset = other93.__isset;
  return *this;
}
void OneField::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "OneField(";
  out << "field=" << to_string(field);
  out << ")";
}


VersioningTestV1::~VersioningTestV1() throw() {
}


void VersioningTestV1::__set_begin_in_both(const int32_t val) {
  this->begin_in_both = val;
}

void VersioningTestV1::__set_old_string(const std::string& val) {
  this->old_string = val;
}

void VersioningTestV1::__set_end_in_both(const int32_t val) {
  this->end_in_both = val;
}

uint32_t VersioningTestV1::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;


  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) {
          xfer += iprot->readI32(this->begin_in_both);
          this->__isset.begin_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->old_string);
          this->__isset.old_string = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 12:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->end_in_both);
          this->__isset.end_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

void swap(VersioningTestV1 &a, VersioningTestV1 &b) {
  using ::std::swap;
  swap(a.begin_in_both, b.begin_in_both);
  swap(a.old_string, b.old_string);
  swap(a.end_in_both, b.end_in_both);
  swap(a.__isset, b.__isset);
}

VersioningTestV1::VersioningTestV1(const VersioningTestV1& other94) {
  begin_in_both = other94.begin_in_both;
  old_string = other94.old_string;
  end_in_both = other94.end_in_both;
  __isset = other94.__isset;
}
VersioningTestV1& VersioningTestV1::operator=(const VersioningTestV1& other95) {
  begin_in_both = other95.begin_in_both;
  old_string = other95.old_string;
  end_in_both = other95.end_in_both;
  __isset = other95.__isset;
  return *this;
}
void VersioningTestV1::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "VersioningTestV1(";
  out << "begin_in_both=" << to_string(begin_in_both);
  out << ", " << "old_string=" << to_string(old_string);
  out << ", " << "end_in_both=" << to_string(end_in_both);
  out << ")";
}


VersioningTestV2::~VersioningTestV2() throw() {
}


void VersioningTestV2::__set_begin_in_both(const int32_t val) {
  this->begin_in_both = val;
}

void VersioningTestV2::__set_newint(const int32_t val) {
  this->newint = val;
}

void VersioningTestV2::__set_newbyte(const int8_t val) {
  this->newbyte = val;
}

void VersioningTestV2::__set_newshort(const int16_t val) {
  this->newshort = val;
}

void VersioningTestV2::__set_newlong(const int64_t val) {
  this->newlong = val;
}

void VersioningTestV2::__set_newdouble(const double val) {
  this->newdouble = val;
}

void VersioningTestV2::__set_newstruct(const Bonk& val) {
  this->newstruct = val;
}

void VersioningTestV2::__set_newlist(const std::vector<int32_t> & val) {
  this->newlist = val;
}

void VersioningTestV2::__set_newset(const std::set<int32_t> & val) {
  this->newset = val;
}

void VersioningTestV2::__set_newmap(const std::map<int32_t, int32_t> & val) {
  this->newmap = val;
}

void VersioningTestV2::__set_newstring(const std::string& val) {
  this->newstring = val;
}

void VersioningTestV2::__set_end_in_both(const int32_t val) {
  this->end_in_both = val;
}

uint32_t VersioningTestV2::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;


  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) {
          xfer += iprot->readI32(this->begin_in_both);
          this->__isset.begin_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->newint);
          this->__isset.newint = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_BYTE) {
          xfer += iprot->readByte(this->newbyte);
          this->__isset.newbyte = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I16) {
          xfer += iprot->readI16(this->newshort);
          this->__isset.newshort = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->newlong);
          this->__isset.newlong = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 6:
        if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
          xfer += iprot->readDouble(this->newdouble);
          this->__isset.newdouble = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 7:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->newstruct.read(iprot);
          this->__isset.newstruct = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 8:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->newlist.clear();
            uint32_t _size96;
            ::apache::thrift::protocol::TType _etype99;
            xfer += iprot->readListBegin(_etype99, _size96);
            this->newlist.resize(_size96);
            uint32_t _i100;
            for (_i100 = 0; _i100 < _size96; ++_i100)
            {
              xfer += iprot->readI32(this->newlist[_i100]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.newlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 9:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->newset.clear();
            uint32_t _size101;
            ::apache::thrift::protocol::TType _etype104;
            xfer += iprot->readSetBegin(_etype104, _size101);
            uint32_t _i105;
            for (_i105 = 0; _i105 < _size101; ++_i105)
            {
              int32_t _elem106;
              xfer += iprot->readI32(_elem106);
              this->newset.insert(_elem106);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.newset = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 10:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->newmap.clear();
            uint32_t _size107;
            ::apache::thrift::protocol::TType _ktype108;
            ::apache::thrift::protocol::TType _vtype109;
            xfer += iprot->readMapBegin(_ktype108, _vtype109, _size107);
            uint32_t _i111;
            for (_i111 = 0; _i111 < _size107; ++_i111)
            {
              int32_t _key112;
              xfer += iprot->readI32(_key112);
              int32_t& _val113 = this->newmap[_key112];
              xfer += iprot->readI32(_val113);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.newmap = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 11:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->newstring);
          this->__isset.newstring = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 12:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->end_in_both);
          this->__isset.end_in_both = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

  xfer += oprot->writeFieldBegin("newbyte", ::apache::thrift::protocol::T_BYTE, 3);
  xfer += oprot->writeByte(this->newbyte);
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newshort", ::apache::thrift::protocol::T_I16, 4);
  xfer += oprot->writeI16(this->newshort);
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("newdouble", ::apache::thrift::protocol::T_DOUBLE, 6);
  xfer += oprot->writeDouble(this->newdouble);
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("newlist", ::apache::thrift::protocol::T_LIST, 8);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newlist.size()));
    std::vector<int32_t> ::const_iterator _iter114;
    for (_iter114 = this->newlist.begin(); _iter114 != this->newlist.end(); ++_iter114)
    {
      xfer += oprot->writeI32((*_iter114));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newset", ::apache::thrift::protocol::T_SET, 9);
  {
    xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newset.size()));
    std::set<int32_t> ::const_iterator _iter115;
    for (_iter115 = this->newset.begin(); _iter115 != this->newset.end(); ++_iter115)
    {
      xfer += oprot->writeI32((*_iter115));
    }
    xfer += oprot->writeSetEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("newmap", ::apache::thrift::protocol::T_MAP, 10);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->newmap.size()));
    std::map<int32_t, int32_t> ::const_iterator _iter116;
    for (_iter116 = this->newmap.begin(); _iter116 != this->newmap.end(); ++_iter116)
    {
      xfer += oprot->writeI32(_iter116->first);
      xfer += oprot->writeI32(_iter116->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

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

void swap(VersioningTestV2 &a, VersioningTestV2 &b) {
  using ::std::swap;
  swap(a.begin_in_both, b.begin_in_both);
  swap(a.newint, b.newint);
  swap(a.newbyte, b.newbyte);
  swap(a.newshort, b.newshort);
  swap(a.newlong, b.newlong);
  swap(a.newdouble, b.newdouble);
  swap(a.newstruct, b.newstruct);
  swap(a.newlist, b.newlist);
  swap(a.newset, b.newset);
  swap(a.newmap, b.newmap);
  swap(a.newstring, b.newstring);
  swap(a.end_in_both, b.end_in_both);
  swap(a.__isset, b.__isset);
}

VersioningTestV2::VersioningTestV2(const VersioningTestV2& other117) {
  begin_in_both = other117.begin_in_both;
  newint = other117.newint;
  newbyte = other117.newbyte;
  newshort = other117.newshort;
  newlong = other117.newlong;
  newdouble = other117.newdouble;
  newstruct = other117.newstruct;
  newlist = other117.newlist;
  newset = other117.newset;
  newmap = other117.newmap;
  newstring = other117.newstring;
  end_in_both = other117.end_in_both;
  __isset = other117.__isset;
}
VersioningTestV2& VersioningTestV2::operator=(const VersioningTestV2& other118) {
  begin_in_both = other118.begin_in_both;
  newint = other118.newint;
  newbyte = other118.newbyte;
  newshort = other118.newshort;
  newlong = other118.newlong;
  newdouble = other118.newdouble;
  newstruct = other118.newstruct;
  newlist = other118.newlist;
  newset = other118.newset;
  newmap = other118.newmap;
  newstring = other118.newstring;
  end_in_both = other118.end_in_both;
  __isset = other118.__isset;
  return *this;
}
void VersioningTestV2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "VersioningTestV2(";
  out << "begin_in_both=" << to_string(begin_in_both);
  out << ", " << "newint=" << to_string(newint);
  out << ", " << "newbyte=" << to_string(newbyte);
  out << ", " << "newshort=" << to_string(newshort);
  out << ", " << "newlong=" << to_string(newlong);
  out << ", " << "newdouble=" << to_string(newdouble);
  out << ", " << "newstruct=" << to_string(newstruct);
  out << ", " << "newlist=" << to_string(newlist);
  out << ", " << "newset=" << to_string(newset);
  out << ", " << "newmap=" << to_string(newmap);
  out << ", " << "newstring=" << to_string(newstring);
  out << ", " << "end_in_both=" << to_string(end_in_both);
  out << ")";
}


ListTypeVersioningV1::~ListTypeVersioningV1() throw() {
}


void ListTypeVersioningV1::__set_myints(const std::vector<int32_t> & val) {
  this->myints = val;
}

void ListTypeVersioningV1::__set_hello(const std::string& val) {
  this->hello = val;
}

uint32_t ListTypeVersioningV1::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;


  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_LIST) {
          {
            this->myints.clear();
            uint32_t _size119;
            ::apache::thrift::protocol::TType _etype122;
            xfer += iprot->readListBegin(_etype122, _size119);
            this->myints.resize(_size119);
            uint32_t _i123;
            for (_i123 = 0; _i123 < _size119; ++_i123)
            {
              xfer += iprot->readI32(this->myints[_i123]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.myints = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->hello);
          this->__isset.hello = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("myints", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->myints.size()));
    std::vector<int32_t> ::const_iterator _iter124;
    for (_iter124 = this->myints.begin(); _iter124 != this->myints.end(); ++_iter124)
    {
      xfer += oprot->writeI32((*_iter124));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(ListTypeVersioningV1 &a, ListTypeVersioningV1 &b) {
  using ::std::swap;
  swap(a.myints, b.myints);
  swap(a.hello, b.hello);
  swap(a.__isset, b.__isset);
}

ListTypeVersioningV1::ListTypeVersioningV1(const ListTypeVersioningV1& other125) {
  myints = other125.myints;
  hello = other125.hello;
  __isset = other125.__isset;
}
ListTypeVersioningV1& ListTypeVersioningV1::operator=(const ListTypeVersioningV1& other126) {
  myints = other126.myints;
  hello = other126.hello;
  __isset = other126.__isset;
  return *this;
}
void ListTypeVersioningV1::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListTypeVersioningV1(";
  out << "myints=" << to_string(myints);
  out << ", " << "hello=" << to_string(hello);
  out << ")";
}


ListTypeVersioningV2::~ListTypeVersioningV2() throw() {
}


void ListTypeVersioningV2::__set_strings(const std::vector<std::string> & val) {
  this->strings = val;
}

void ListTypeVersioningV2::__set_hello(const std::string& val) {
  this->hello = val;
}

uint32_t ListTypeVersioningV2::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;


  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_LIST) {
          {
            this->strings.clear();
            uint32_t _size127;
            ::apache::thrift::protocol::TType _etype130;
            xfer += iprot->readListBegin(_etype130, _size127);
            this->strings.resize(_size127);
            uint32_t _i131;
            for (_i131 = 0; _i131 < _size127; ++_i131)
            {
              xfer += iprot->readString(this->strings[_i131]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.strings = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->hello);
          this->__isset.hello = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("strings", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->strings.size()));
    std::vector<std::string> ::const_iterator _iter132;
    for (_iter132 = this->strings.begin(); _iter132 != this->strings.end(); ++_iter132)
    {
      xfer += oprot->writeString((*_iter132));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

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

void swap(ListTypeVersioningV2 &a, ListTypeVersioningV2 &b) {
  using ::std::swap;
  swap(a.strings, b.strings);
  swap(a.hello, b.hello);
  swap(a.__isset, b.__isset);
}

ListTypeVersioningV2::ListTypeVersioningV2(const ListTypeVersioningV2& other133) {
  strings = other133.strings;
  hello = other133.hello;
  __isset = other133.__isset;
}
ListTypeVersioningV2& ListTypeVersioningV2::operator=(const ListTypeVersioningV2& other134) {
  strings = other134.strings;
  hello = other134.hello;
  __isset = other134.__isset;
  return *this;
}
void ListTypeVersioningV2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListTypeVersioningV2(";
  out << "strings=" << to_string(strings);
  out << ", " << "hello=" << to_string(hello);
  out << ")";
}


GuessProtocolStruct::~GuessProtocolStruct() throw() {
}


void GuessProtocolStruct::__set_map_field(const std::map<std::string, std::string> & val) {
  this->map_field = val;
}

uint32_t GuessProtocolStruct::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;


  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 7:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->map_field.clear();
            uint32_t _size135;
            ::apache::thrift::protocol::TType _ktype136;
            ::apache::thrift::protocol::TType _vtype137;
            xfer += iprot->readMapBegin(_ktype136, _vtype137, _size135);
            uint32_t _i139;
            for (_i139 = 0; _i139 < _size135; ++_i139)
            {
              std::string _key140;
              xfer += iprot->readString(_key140);
              std::string& _val141 = this->map_field[_key140];
              xfer += iprot->readString(_val141);
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.map_field = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("map_field", ::apache::thrift::protocol::T_MAP, 7);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->map_field.size()));
    std::map<std::string, std::string> ::const_iterator _iter142;
    for (_iter142 = this->map_field.begin(); _iter142 != this->map_field.end(); ++_iter142)
    {
      xfer += oprot->writeString(_iter142->first);
      xfer += oprot->writeString(_iter142->second);
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(GuessProtocolStruct &a, GuessProtocolStruct &b) {
  using ::std::swap;
  swap(a.map_field, b.map_field);
  swap(a.__isset, b.__isset);
}

GuessProtocolStruct::GuessProtocolStruct(const GuessProtocolStruct& other143) {
  map_field = other143.map_field;
  __isset = other143.__isset;
}
GuessProtocolStruct& GuessProtocolStruct::operator=(const GuessProtocolStruct& other144) {
  map_field = other144.map_field;
  __isset = other144.__isset;
  return *this;
}
void GuessProtocolStruct::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "GuessProtocolStruct(";
  out << "map_field=" << to_string(map_field);
  out << ")";
}


LargeDeltas::~LargeDeltas() throw() {
}


void LargeDeltas::__set_b1(const Bools& val) {
  this->b1 = val;
}

void LargeDeltas::__set_b10(const Bools& val) {
  this->b10 = val;
}

void LargeDeltas::__set_b100(const Bools& val) {
  this->b100 = val;
}

void LargeDeltas::__set_check_true(const bool val) {
  this->check_true = val;
}

void LargeDeltas::__set_b1000(const Bools& val) {
  this->b1000 = val;
}

void LargeDeltas::__set_check_false(const bool val) {
  this->check_false = val;
}

void LargeDeltas::__set_vertwo2000(const VersioningTestV2& val) {
  this->vertwo2000 = val;
}

void LargeDeltas::__set_a_set2500(const std::set<std::string> & val) {
  this->a_set2500 = val;
}

void LargeDeltas::__set_vertwo3000(const VersioningTestV2& val) {
  this->vertwo3000 = val;
}

void LargeDeltas::__set_big_numbers(const std::vector<int32_t> & val) {
  this->big_numbers = val;
}

uint32_t LargeDeltas::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;


  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->b1.read(iprot);
          this->__isset.b1 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 10:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b10.read(iprot);
          this->__isset.b10 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 100:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b100.read(iprot);
          this->__isset.b100 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 500:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->check_true);
          this->__isset.check_true = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 1000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->b1000.read(iprot);
          this->__isset.b1000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 1500:
        if (ftype == ::apache::thrift::protocol::T_BOOL) {
          xfer += iprot->readBool(this->check_false);
          this->__isset.check_false = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->vertwo2000.read(iprot);
          this->__isset.vertwo2000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2500:
        if (ftype == ::apache::thrift::protocol::T_SET) {
          {
            this->a_set2500.clear();
            uint32_t _size145;
            ::apache::thrift::protocol::TType _etype148;
            xfer += iprot->readSetBegin(_etype148, _size145);
            uint32_t _i149;
            for (_i149 = 0; _i149 < _size145; ++_i149)
            {
              std::string _elem150;
              xfer += iprot->readString(_elem150);
              this->a_set2500.insert(_elem150);
            }
            xfer += iprot->readSetEnd();
          }
          this->__isset.a_set2500 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3000:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->vertwo3000.read(iprot);
          this->__isset.vertwo3000 = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4000:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->big_numbers.clear();
            uint32_t _size151;
            ::apache::thrift::protocol::TType _etype154;
            xfer += iprot->readListBegin(_etype154, _size151);
            this->big_numbers.resize(_size151);
            uint32_t _i155;
            for (_i155 = 0; _i155 < _size151; ++_i155)
            {
              xfer += iprot->readI32(this->big_numbers[_i155]);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.big_numbers = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

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

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

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

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

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

  xfer += oprot->writeFieldBegin("a_set2500", ::apache::thrift::protocol::T_SET, 2500);
  {
    xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->a_set2500.size()));
    std::set<std::string> ::const_iterator _iter156;
    for (_iter156 = this->a_set2500.begin(); _iter156 != this->a_set2500.end(); ++_iter156)
    {
      xfer += oprot->writeString((*_iter156));
    }
    xfer += oprot->writeSetEnd();
  }
  xfer += oprot->writeFieldEnd();

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

  xfer += oprot->writeFieldBegin("big_numbers", ::apache::thrift::protocol::T_LIST, 4000);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>(this->big_numbers.size()));
    std::vector<int32_t> ::const_iterator _iter157;
    for (_iter157 = this->big_numbers.begin(); _iter157 != this->big_numbers.end(); ++_iter157)
    {
      xfer += oprot->writeI32((*_iter157));
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(LargeDeltas &a, LargeDeltas &b) {
  using ::std::swap;
  swap(a.b1, b.b1);
  swap(a.b10, b.b10);
  swap(a.b100, b.b100);
  swap(a.check_true, b.check_true);
  swap(a.b1000, b.b1000);
  swap(a.check_false, b.check_false);
  swap(a.vertwo2000, b.vertwo2000);
  swap(a.a_set2500, b.a_set2500);
  swap(a.vertwo3000, b.vertwo3000);
  swap(a.big_numbers, b.big_numbers);
  swap(a.__isset, b.__isset);
}

LargeDeltas::LargeDeltas(const LargeDeltas& other158) {
  b1 = other158.b1;
  b10 = other158.b10;
  b100 = other158.b100;
  check_true = other158.check_true;
  b1000 = other158.b1000;
  check_false = other158.check_false;
  vertwo2000 = other158.vertwo2000;
  a_set2500 = other158.a_set2500;
  vertwo3000 = other158.vertwo3000;
  big_numbers = other158.big_numbers;
  __isset = other158.__isset;
}
LargeDeltas& LargeDeltas::operator=(const LargeDeltas& other159) {
  b1 = other159.b1;
  b10 = other159.b10;
  b100 = other159.b100;
  check_true = other159.check_true;
  b1000 = other159.b1000;
  check_false = other159.check_false;
  vertwo2000 = other159.vertwo2000;
  a_set2500 = other159.a_set2500;
  vertwo3000 = other159.vertwo3000;
  big_numbers = other159.big_numbers;
  __isset = other159.__isset;
  return *this;
}
void LargeDeltas::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "LargeDeltas(";
  out << "b1=" << to_string(b1);
  out << ", " << "b10=" << to_string(b10);
  out << ", " << "b100=" << to_string(b100);
  out << ", " << "check_true=" << to_string(check_true);
  out << ", " << "b1000=" << to_string(b1000);
  out << ", " << "check_false=" << to_string(check_false);
  out << ", " << "vertwo2000=" << to_string(vertwo2000);
  out << ", " << "a_set2500=" << to_string(a_set2500);
  out << ", " << "vertwo3000=" << to_string(vertwo3000);
  out << ", " << "big_numbers=" << to_string(big_numbers);
  out << ")";
}


NestedListsI32x2::~NestedListsI32x2() throw() {
}


void NestedListsI32x2::__set_integerlist(const std::vector<std::vector<int32_t> > & val) {
  this->integerlist = val;
}

uint32_t NestedListsI32x2::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;


  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_LIST) {
          {
            this->integerlist.clear();
            uint32_t _size160;
            ::apache::thrift::protocol::TType _etype163;
            xfer += iprot->readListBegin(_etype163, _size160);
            this->integerlist.resize(_size160);
            uint32_t _i164;
            for (_i164 = 0; _i164 < _size160; ++_i164)
            {
              {
                this->integerlist[_i164].clear();
                uint32_t _size165;
                ::apache::thrift::protocol::TType _etype168;
                xfer += iprot->readListBegin(_etype168, _size165);
                this->integerlist[_i164].resize(_size165);
                uint32_t _i169;
                for (_i169 = 0; _i169 < _size165; ++_i169)
                {
                  xfer += iprot->readI32(this->integerlist[_i164][_i169]);
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.integerlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("integerlist", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->integerlist.size()));
    std::vector<std::vector<int32_t> > ::const_iterator _iter170;
    for (_iter170 = this->integerlist.begin(); _iter170 != this->integerlist.end(); ++_iter170)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter170).size()));
        std::vector<int32_t> ::const_iterator _iter171;
        for (_iter171 = (*_iter170).begin(); _iter171 != (*_iter170).end(); ++_iter171)
        {
          xfer += oprot->writeI32((*_iter171));
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsI32x2 &a, NestedListsI32x2 &b) {
  using ::std::swap;
  swap(a.integerlist, b.integerlist);
  swap(a.__isset, b.__isset);
}

NestedListsI32x2::NestedListsI32x2(const NestedListsI32x2& other172) {
  integerlist = other172.integerlist;
  __isset = other172.__isset;
}
NestedListsI32x2& NestedListsI32x2::operator=(const NestedListsI32x2& other173) {
  integerlist = other173.integerlist;
  __isset = other173.__isset;
  return *this;
}
void NestedListsI32x2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsI32x2(";
  out << "integerlist=" << to_string(integerlist);
  out << ")";
}


NestedListsI32x3::~NestedListsI32x3() throw() {
}


void NestedListsI32x3::__set_integerlist(const std::vector<std::vector<std::vector<int32_t> > > & val) {
  this->integerlist = val;
}

uint32_t NestedListsI32x3::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;


  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_LIST) {
          {
            this->integerlist.clear();
            uint32_t _size174;
            ::apache::thrift::protocol::TType _etype177;
            xfer += iprot->readListBegin(_etype177, _size174);
            this->integerlist.resize(_size174);
            uint32_t _i178;
            for (_i178 = 0; _i178 < _size174; ++_i178)
            {
              {
                this->integerlist[_i178].clear();
                uint32_t _size179;
                ::apache::thrift::protocol::TType _etype182;
                xfer += iprot->readListBegin(_etype182, _size179);
                this->integerlist[_i178].resize(_size179);
                uint32_t _i183;
                for (_i183 = 0; _i183 < _size179; ++_i183)
                {
                  {
                    this->integerlist[_i178][_i183].clear();
                    uint32_t _size184;
                    ::apache::thrift::protocol::TType _etype187;
                    xfer += iprot->readListBegin(_etype187, _size184);
                    this->integerlist[_i178][_i183].resize(_size184);
                    uint32_t _i188;
                    for (_i188 = 0; _i188 < _size184; ++_i188)
                    {
                      xfer += iprot->readI32(this->integerlist[_i178][_i183][_i188]);
                    }
                    xfer += iprot->readListEnd();
                  }
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.integerlist = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("integerlist", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->integerlist.size()));
    std::vector<std::vector<std::vector<int32_t> > > ::const_iterator _iter189;
    for (_iter189 = this->integerlist.begin(); _iter189 != this->integerlist.end(); ++_iter189)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*_iter189).size()));
        std::vector<std::vector<int32_t> > ::const_iterator _iter190;
        for (_iter190 = (*_iter189).begin(); _iter190 != (*_iter189).end(); ++_iter190)
        {
          {
            xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter190).size()));
            std::vector<int32_t> ::const_iterator _iter191;
            for (_iter191 = (*_iter190).begin(); _iter191 != (*_iter190).end(); ++_iter191)
            {
              xfer += oprot->writeI32((*_iter191));
            }
            xfer += oprot->writeListEnd();
          }
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsI32x3 &a, NestedListsI32x3 &b) {
  using ::std::swap;
  swap(a.integerlist, b.integerlist);
  swap(a.__isset, b.__isset);
}

NestedListsI32x3::NestedListsI32x3(const NestedListsI32x3& other192) {
  integerlist = other192.integerlist;
  __isset = other192.__isset;
}
NestedListsI32x3& NestedListsI32x3::operator=(const NestedListsI32x3& other193) {
  integerlist = other193.integerlist;
  __isset = other193.__isset;
  return *this;
}
void NestedListsI32x3::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsI32x3(";
  out << "integerlist=" << to_string(integerlist);
  out << ")";
}


NestedMixedx2::~NestedMixedx2() throw() {
}


void NestedMixedx2::__set_int_set_list(const std::vector<std::set<int32_t> > & val) {
  this->int_set_list = val;
}

void NestedMixedx2::__set_map_int_strset(const std::map<int32_t, std::set<std::string> > & val) {
  this->map_int_strset = val;
}

void NestedMixedx2::__set_map_int_strset_list(const std::vector<std::map<int32_t, std::set<std::string> > > & val) {
  this->map_int_strset_list = val;
}

uint32_t NestedMixedx2::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;


  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_LIST) {
          {
            this->int_set_list.clear();
            uint32_t _size194;
            ::apache::thrift::protocol::TType _etype197;
            xfer += iprot->readListBegin(_etype197, _size194);
            this->int_set_list.resize(_size194);
            uint32_t _i198;
            for (_i198 = 0; _i198 < _size194; ++_i198)
            {
              {
                this->int_set_list[_i198].clear();
                uint32_t _size199;
                ::apache::thrift::protocol::TType _etype202;
                xfer += iprot->readSetBegin(_etype202, _size199);
                uint32_t _i203;
                for (_i203 = 0; _i203 < _size199; ++_i203)
                {
                  int32_t _elem204;
                  xfer += iprot->readI32(_elem204);
                  this->int_set_list[_i198].insert(_elem204);
                }
                xfer += iprot->readSetEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.int_set_list = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_MAP) {
          {
            this->map_int_strset.clear();
            uint32_t _size205;
            ::apache::thrift::protocol::TType _ktype206;
            ::apache::thrift::protocol::TType _vtype207;
            xfer += iprot->readMapBegin(_ktype206, _vtype207, _size205);
            uint32_t _i209;
            for (_i209 = 0; _i209 < _size205; ++_i209)
            {
              int32_t _key210;
              xfer += iprot->readI32(_key210);
              std::set<std::string> & _val211 = this->map_int_strset[_key210];
              {
                _val211.clear();
                uint32_t _size212;
                ::apache::thrift::protocol::TType _etype215;
                xfer += iprot->readSetBegin(_etype215, _size212);
                uint32_t _i216;
                for (_i216 = 0; _i216 < _size212; ++_i216)
                {
                  std::string _elem217;
                  xfer += iprot->readString(_elem217);
                  _val211.insert(_elem217);
                }
                xfer += iprot->readSetEnd();
              }
            }
            xfer += iprot->readMapEnd();
          }
          this->__isset.map_int_strset = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_LIST) {
          {
            this->map_int_strset_list.clear();
            uint32_t _size218;
            ::apache::thrift::protocol::TType _etype221;
            xfer += iprot->readListBegin(_etype221, _size218);
            this->map_int_strset_list.resize(_size218);
            uint32_t _i222;
            for (_i222 = 0; _i222 < _size218; ++_i222)
            {
              {
                this->map_int_strset_list[_i222].clear();
                uint32_t _size223;
                ::apache::thrift::protocol::TType _ktype224;
                ::apache::thrift::protocol::TType _vtype225;
                xfer += iprot->readMapBegin(_ktype224, _vtype225, _size223);
                uint32_t _i227;
                for (_i227 = 0; _i227 < _size223; ++_i227)
                {
                  int32_t _key228;
                  xfer += iprot->readI32(_key228);
                  std::set<std::string> & _val229 = this->map_int_strset_list[_i222][_key228];
                  {
                    _val229.clear();
                    uint32_t _size230;
                    ::apache::thrift::protocol::TType _etype233;
                    xfer += iprot->readSetBegin(_etype233, _size230);
                    uint32_t _i234;
                    for (_i234 = 0; _i234 < _size230; ++_i234)
                    {
                      std::string _elem235;
                      xfer += iprot->readString(_elem235);
                      _val229.insert(_elem235);
                    }
                    xfer += iprot->readSetEnd();
                  }
                }
                xfer += iprot->readMapEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.map_int_strset_list = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("int_set_list", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_SET, static_cast<uint32_t>(this->int_set_list.size()));
    std::vector<std::set<int32_t> > ::const_iterator _iter236;
    for (_iter236 = this->int_set_list.begin(); _iter236 != this->int_set_list.end(); ++_iter236)
    {
      {
        xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I32, static_cast<uint32_t>((*_iter236).size()));
        std::set<int32_t> ::const_iterator _iter237;
        for (_iter237 = (*_iter236).begin(); _iter237 != (*_iter236).end(); ++_iter237)
        {
          xfer += oprot->writeI32((*_iter237));
        }
        xfer += oprot->writeSetEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("map_int_strset", ::apache::thrift::protocol::T_MAP, 2);
  {
    xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>(this->map_int_strset.size()));
    std::map<int32_t, std::set<std::string> > ::const_iterator _iter238;
    for (_iter238 = this->map_int_strset.begin(); _iter238 != this->map_int_strset.end(); ++_iter238)
    {
      xfer += oprot->writeI32(_iter238->first);
      {
        xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(_iter238->second.size()));
        std::set<std::string> ::const_iterator _iter239;
        for (_iter239 = _iter238->second.begin(); _iter239 != _iter238->second.end(); ++_iter239)
        {
          xfer += oprot->writeString((*_iter239));
        }
        xfer += oprot->writeSetEnd();
      }
    }
    xfer += oprot->writeMapEnd();
  }
  xfer += oprot->writeFieldEnd();

  xfer += oprot->writeFieldBegin("map_int_strset_list", ::apache::thrift::protocol::T_LIST, 3);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_MAP, static_cast<uint32_t>(this->map_int_strset_list.size()));
    std::vector<std::map<int32_t, std::set<std::string> > > ::const_iterator _iter240;
    for (_iter240 = this->map_int_strset_list.begin(); _iter240 != this->map_int_strset_list.end(); ++_iter240)
    {
      {
        xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_I32, ::apache::thrift::protocol::T_SET, static_cast<uint32_t>((*_iter240).size()));
        std::map<int32_t, std::set<std::string> > ::const_iterator _iter241;
        for (_iter241 = (*_iter240).begin(); _iter241 != (*_iter240).end(); ++_iter241)
        {
          xfer += oprot->writeI32(_iter241->first);
          {
            xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(_iter241->second.size()));
            std::set<std::string> ::const_iterator _iter242;
            for (_iter242 = _iter241->second.begin(); _iter242 != _iter241->second.end(); ++_iter242)
            {
              xfer += oprot->writeString((*_iter242));
            }
            xfer += oprot->writeSetEnd();
          }
        }
        xfer += oprot->writeMapEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedMixedx2 &a, NestedMixedx2 &b) {
  using ::std::swap;
  swap(a.int_set_list, b.int_set_list);
  swap(a.map_int_strset, b.map_int_strset);
  swap(a.map_int_strset_list, b.map_int_strset_list);
  swap(a.__isset, b.__isset);
}

NestedMixedx2::NestedMixedx2(const NestedMixedx2& other243) {
  int_set_list = other243.int_set_list;
  map_int_strset = other243.map_int_strset;
  map_int_strset_list = other243.map_int_strset_list;
  __isset = other243.__isset;
}
NestedMixedx2& NestedMixedx2::operator=(const NestedMixedx2& other244) {
  int_set_list = other244.int_set_list;
  map_int_strset = other244.map_int_strset;
  map_int_strset_list = other244.map_int_strset_list;
  __isset = other244.__isset;
  return *this;
}
void NestedMixedx2::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedMixedx2(";
  out << "int_set_list=" << to_string(int_set_list);
  out << ", " << "map_int_strset=" << to_string(map_int_strset);
  out << ", " << "map_int_strset_list=" << to_string(map_int_strset_list);
  out << ")";
}


ListBonks::~ListBonks() throw() {
}


void ListBonks::__set_bonk(const std::vector<Bonk> & val) {
  this->bonk = val;
}

uint32_t ListBonks::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;


  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_LIST) {
          {
            this->bonk.clear();
            uint32_t _size245;
            ::apache::thrift::protocol::TType _etype248;
            xfer += iprot->readListBegin(_etype248, _size245);
            this->bonk.resize(_size245);
            uint32_t _i249;
            for (_i249 = 0; _i249 < _size245; ++_i249)
            {
              xfer += this->bonk[_i249].read(iprot);
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.bonk = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

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

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

void swap(ListBonks &a, ListBonks &b) {
  using ::std::swap;
  swap(a.bonk, b.bonk);
  swap(a.__isset, b.__isset);
}

ListBonks::ListBonks(const ListBonks& other251) {
  bonk = other251.bonk;
  __isset = other251.__isset;
}
ListBonks& ListBonks::operator=(const ListBonks& other252) {
  bonk = other252.bonk;
  __isset = other252.__isset;
  return *this;
}
void ListBonks::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "ListBonks(";
  out << "bonk=" << to_string(bonk);
  out << ")";
}


NestedListsBonk::~NestedListsBonk() throw() {
}


void NestedListsBonk::__set_bonk(const std::vector<std::vector<std::vector<Bonk> > > & val) {
  this->bonk = val;
}

uint32_t NestedListsBonk::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;


  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_LIST) {
          {
            this->bonk.clear();
            uint32_t _size253;
            ::apache::thrift::protocol::TType _etype256;
            xfer += iprot->readListBegin(_etype256, _size253);
            this->bonk.resize(_size253);
            uint32_t _i257;
            for (_i257 = 0; _i257 < _size253; ++_i257)
            {
              {
                this->bonk[_i257].clear();
                uint32_t _size258;
                ::apache::thrift::protocol::TType _etype261;
                xfer += iprot->readListBegin(_etype261, _size258);
                this->bonk[_i257].resize(_size258);
                uint32_t _i262;
                for (_i262 = 0; _i262 < _size258; ++_i262)
                {
                  {
                    this->bonk[_i257][_i262].clear();
                    uint32_t _size263;
                    ::apache::thrift::protocol::TType _etype266;
                    xfer += iprot->readListBegin(_etype266, _size263);
                    this->bonk[_i257][_i262].resize(_size263);
                    uint32_t _i267;
                    for (_i267 = 0; _i267 < _size263; ++_i267)
                    {
                      xfer += this->bonk[_i257][_i262][_i267].read(iprot);
                    }
                    xfer += iprot->readListEnd();
                  }
                }
                xfer += iprot->readListEnd();
              }
            }
            xfer += iprot->readListEnd();
          }
          this->__isset.bonk = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  xfer += oprot->writeFieldBegin("bonk", ::apache::thrift::protocol::T_LIST, 1);
  {
    xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->bonk.size()));
    std::vector<std::vector<std::vector<Bonk> > > ::const_iterator _iter268;
    for (_iter268 = this->bonk.begin(); _iter268 != this->bonk.end(); ++_iter268)
    {
      {
        xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*_iter268).size()));
        std::vector<std::vector<Bonk> > ::const_iterator _iter269;
        for (_iter269 = (*_iter268).begin(); _iter269 != (*_iter268).end(); ++_iter269)
        {
          {
            xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*_iter269).size()));
            std::vector<Bonk> ::const_iterator _iter270;
            for (_iter270 = (*_iter269).begin(); _iter270 != (*_iter269).end(); ++_iter270)
            {
              xfer += (*_iter270).write(oprot);
            }
            xfer += oprot->writeListEnd();
          }
        }
        xfer += oprot->writeListEnd();
      }
    }
    xfer += oprot->writeListEnd();
  }
  xfer += oprot->writeFieldEnd();

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

void swap(NestedListsBonk &a, NestedListsBonk &b) {
  using ::std::swap;
  swap(a.bonk, b.bonk);
  swap(a.__isset, b.__isset);
}

NestedListsBonk::NestedListsBonk(const NestedListsBonk& other271) {
  bonk = other271.bonk;
  __isset = other271.__isset;
}
NestedListsBonk& NestedListsBonk::operator=(const NestedListsBonk& other272) {
  bonk = other272.bonk;
  __isset = other272.__isset;
  return *this;
}
void NestedListsBonk::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "NestedListsBonk(";
  out << "bonk=" << to_string(bonk);
  out << ")";
}


BoolTest::~BoolTest() throw() {
}


void BoolTest::__set_b(const bool val) {
  this->b = val;
__isset.b = true;
}

void BoolTest::__set_s(const std::string& val) {
  this->s = val;
__isset.s = true;
}

uint32_t BoolTest::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;


  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->b);
          this->__isset.b = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->s);
          this->__isset.s = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

  return xfer;
}

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

  if (this->__isset.b) {
    xfer += oprot->writeFieldBegin("b", ::apache::thrift::protocol::T_BOOL, 1);
    xfer += oprot->writeBool(this->b);
    xfer += oprot->writeFieldEnd();
  }
  if (this->__isset.s) {
    xfer += oprot->writeFieldBegin("s", ::apache::thrift::protocol::T_STRING, 2);
    xfer += oprot->writeString(this->s);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}

void swap(BoolTest &a, BoolTest &b) {
  using ::std::swap;
  swap(a.b, b.b);
  swap(a.s, b.s);
  swap(a.__isset, b.__isset);
}

BoolTest::BoolTest(const BoolTest& other273) {
  b = other273.b;
  s = other273.s;
  __isset = other273.__isset;
}
BoolTest& BoolTest::operator=(const BoolTest& other274) {
  b = other274.b;
  s = other274.s;
  __isset = other274.__isset;
  return *this;
}
void BoolTest::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "BoolTest(";
  out << "b="; (__isset.b ? (out << to_string(b)) : (out << "<null>"));
  out << ", " << "s="; (__isset.s ? (out << to_string(s)) : (out << "<null>"));
  out << ")";
}


StructA::~StructA() throw() {
}


void StructA::__set_s(const std::string& val) {
  this->s = val;
}

uint32_t StructA::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_s = 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->s);
          isset_s = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

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

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

void swap(StructA &a, StructA &b) {
  using ::std::swap;
  swap(a.s, b.s);
}

StructA::StructA(const StructA& other275) {
  s = other275.s;
}
StructA& StructA::operator=(const StructA& other276) {
  s = other276.s;
  return *this;
}
void StructA::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "StructA(";
  out << "s=" << to_string(s);
  out << ")";
}


StructB::~StructB() throw() {
}


void StructB::__set_aa(const StructA& val) {
  this->aa = val;
__isset.aa = true;
}

void StructB::__set_ab(const StructA& val) {
  this->ab = val;
}

uint32_t StructB::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_ab = 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->aa.read(iprot);
          this->__isset.aa = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->ab.read(iprot);
          isset_ab = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }

  xfer += iprot->readStructEnd();

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

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

  if (this->__isset.aa) {
    xfer += oprot->writeFieldBegin("aa", ::apache::thrift::protocol::T_STRUCT, 1);
    xfer += this->aa.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldBegin("ab", ::apache::thrift::protocol::T_STRUCT, 2);
  xfer += this->ab.write(oprot);
  xfer += oprot->writeFieldEnd();

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

void swap(StructB &a, StructB &b) {
  using ::std::swap;
  swap(a.aa, b.aa);
  swap(a.ab, b.ab);
  swap(a.__isset, b.__isset);
}

StructB::StructB(const StructB& other277) {
  aa = other277.aa;
  ab = other277.ab;
  __isset = other277.__isset;
}
StructB& StructB::operator=(const StructB& other278) {
  aa = other278.aa;
  ab = other278.ab;
  __isset = other278.__isset;
  return *this;
}
void StructB::printTo(std::ostream& out) const {
  using ::apache::thrift::to_string;
  out << "StructB(";
  out << "aa="; (__isset.aa ? (out << to_string(aa)) : (out << "<null>"));
  out << ", " << "ab=" << to_string(ab);
  out << ")";
}

}} // namespace
