Want more features on Pastebin? Sign Up, it's FREE!
Guest

Raghava

By: a guest on Jul 25th, 2010  |  syntax: C++  |  size: 7.03 KB  |  views: 58  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Autogenerated by Thrift
  3.  *
  4.  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  5.  */
  6. #include "employee_types.h"
  7.  
  8. namespace com { namespace XXXX { namespace thrift { namespace employee {
  9.  
  10. const char* SavingsInfo::ascii_fingerprint = "C712EF0DA8599E55DF4D0F13415232EF";
  11. const uint8_t SavingsInfo::binary_fingerprint[16] = {0xC7,0x12,0xEF,0x0D,0xA8,0x59,0x9E,0x55,0xDF,0x4D,0x0F,0x13,0x41,0x52,0x32,0xEF};
  12.  
  13. uint32_t SavingsInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
  14.  
  15.   uint32_t xfer = 0;
  16.   std::string fname;
  17.   ::apache::thrift::protocol::TType ftype;
  18.   int16_t fid;
  19.  
  20.   xfer += iprot->readStructBegin(fname);
  21.  
  22.   using ::apache::thrift::protocol::TProtocolException;
  23.  
  24.  
  25.   while (true)
  26.   {
  27.     xfer += iprot->readFieldBegin(fname, ftype, fid);
  28.     if (ftype == ::apache::thrift::protocol::T_STOP) {
  29.       break;
  30.     }
  31.     switch (fid)
  32.     {
  33.       case 1:
  34.         if (ftype == ::apache::thrift::protocol::T_STRING) {
  35.           xfer += iprot->readString(this->name);
  36.           this->__isset.name = true;
  37.         } else {
  38.           xfer += iprot->skip(ftype);
  39.         }
  40.         break;
  41.       case 2:
  42.         if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
  43.           xfer += iprot->readDouble(this->amount);
  44.           this->__isset.amount = true;
  45.         } else {
  46.           xfer += iprot->skip(ftype);
  47.         }
  48.         break;
  49.       default:
  50.         xfer += iprot->skip(ftype);
  51.         break;
  52.     }
  53.     xfer += iprot->readFieldEnd();
  54.   }
  55.  
  56.   xfer += iprot->readStructEnd();
  57.  
  58.   return xfer;
  59. }
  60.  
  61. uint32_t SavingsInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
  62.   uint32_t xfer = 0;
  63.   xfer += oprot->writeStructBegin("SavingsInfo");
  64.   xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
  65.   xfer += oprot->writeString(this->name);
  66.   xfer += oprot->writeFieldEnd();
  67.   xfer += oprot->writeFieldBegin("amount", ::apache::thrift::protocol::T_DOUBLE, 2);
  68.   xfer += oprot->writeDouble(this->amount);
  69.   xfer += oprot->writeFieldEnd();
  70.   xfer += oprot->writeFieldStop();
  71.   xfer += oprot->writeStructEnd();
  72.   return xfer;
  73. }
  74.  
  75. const char* EmployeeInfo::ascii_fingerprint = "A4FF48ACFB0D366A1E3031B5F13B70F0";
  76. const uint8_t EmployeeInfo::binary_fingerprint[16] = {0xA4,0xFF,0x48,0xAC,0xFB,0x0D,0x36,0x6A,0x1E,0x30,0x31,0xB5,0xF1,0x3B,0x70,0xF0};
  77.  
  78. uint32_t EmployeeInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
  79.  
  80.   uint32_t xfer = 0;
  81.   std::string fname;
  82.   ::apache::thrift::protocol::TType ftype;
  83.   int16_t fid;
  84.  
  85.   xfer += iprot->readStructBegin(fname);
  86.  
  87.   using ::apache::thrift::protocol::TProtocolException;
  88.  
  89.  
  90.   while (true)
  91.   {
  92.     xfer += iprot->readFieldBegin(fname, ftype, fid);
  93.     if (ftype == ::apache::thrift::protocol::T_STOP) {
  94.       break;
  95.     }
  96.     switch (fid)
  97.     {
  98.       case 1:
  99.         if (ftype == ::apache::thrift::protocol::T_I32) {
  100.           xfer += iprot->readI32(this->id);
  101.           this->__isset.id = true;
  102.         } else {
  103.           xfer += iprot->skip(ftype);
  104.         }
  105.         break;
  106.       case 2:
  107.         if (ftype == ::apache::thrift::protocol::T_STRING) {
  108.           xfer += iprot->readString(this->name);
  109.           this->__isset.name = true;
  110.         } else {
  111.           xfer += iprot->skip(ftype);
  112.         }
  113.         break;
  114.       case 3:
  115.         if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
  116.           xfer += iprot->readDouble(this->salary);
  117.           this->__isset.salary = true;
  118.         } else {
  119.           xfer += iprot->skip(ftype);
  120.         }
  121.         break;
  122.       case 4:
  123.         if (ftype == ::apache::thrift::protocol::T_BOOL) {
  124.           xfer += iprot->readBool(this->contract);
  125.           this->__isset.contract = true;
  126.         } else {
  127.           xfer += iprot->skip(ftype);
  128.         }
  129.         break;
  130.       case 5:
  131.         if (ftype == ::apache::thrift::protocol::T_SET) {
  132.           {
  133.             this->dependents.clear();
  134.             uint32_t _size0;
  135.             ::apache::thrift::protocol::TType _etype3;
  136.             iprot->readSetBegin(_etype3, _size0);
  137.             uint32_t _i4;
  138.             for (_i4 = 0; _i4 < _size0; ++_i4)
  139.             {
  140.               std::string _elem5;
  141.               xfer += iprot->readString(_elem5);
  142.               this->dependents.insert(_elem5);
  143.             }
  144.             iprot->readSetEnd();
  145.           }
  146.           this->__isset.dependents = true;
  147.         } else {
  148.           xfer += iprot->skip(ftype);
  149.         }
  150.         break;
  151.       case 6:
  152.         if (ftype == ::apache::thrift::protocol::T_SET) {
  153.           {
  154.             this->savings.clear();
  155.             uint32_t _size6;
  156.             ::apache::thrift::protocol::TType _etype9;
  157.             iprot->readSetBegin(_etype9, _size6);
  158.             uint32_t _i10;
  159.             for (_i10 = 0; _i10 < _size6; ++_i10)
  160.             {
  161.               SavingsInfo _elem11;
  162.               xfer += _elem11.read(iprot);
  163.               this->savings.insert(_elem11);
  164.             }
  165.             iprot->readSetEnd();
  166.           }
  167.           this->__isset.savings = true;
  168.         } else {
  169.           xfer += iprot->skip(ftype);
  170.         }
  171.         break;
  172.       default:
  173.         xfer += iprot->skip(ftype);
  174.         break;
  175.     }
  176.     xfer += iprot->readFieldEnd();
  177.   }
  178.  
  179.   xfer += iprot->readStructEnd();
  180.  
  181.   return xfer;
  182. }
  183.  
  184. uint32_t EmployeeInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
  185.   uint32_t xfer = 0;
  186.   xfer += oprot->writeStructBegin("EmployeeInfo");
  187.   xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I32, 1);
  188.   xfer += oprot->writeI32(this->id);
  189.   xfer += oprot->writeFieldEnd();
  190.   xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 2);
  191.   xfer += oprot->writeString(this->name);
  192.   xfer += oprot->writeFieldEnd();
  193.   xfer += oprot->writeFieldBegin("salary", ::apache::thrift::protocol::T_DOUBLE, 3);
  194.   xfer += oprot->writeDouble(this->salary);
  195.   xfer += oprot->writeFieldEnd();
  196.   xfer += oprot->writeFieldBegin("contract", ::apache::thrift::protocol::T_BOOL, 4);
  197.   xfer += oprot->writeBool(this->contract);
  198.   xfer += oprot->writeFieldEnd();
  199.   xfer += oprot->writeFieldBegin("dependents", ::apache::thrift::protocol::T_SET, 5);
  200.   {
  201.     xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRING, this->dependents.size());
  202.     std::set<std::string> ::const_iterator _iter12;
  203.     for (_iter12 = this->dependents.begin(); _iter12 != this->dependents.end(); ++_iter12)
  204.     {
  205.       xfer += oprot->writeString((*_iter12));
  206.     }
  207.     xfer += oprot->writeSetEnd();
  208.   }
  209.   xfer += oprot->writeFieldEnd();
  210.   xfer += oprot->writeFieldBegin("savings", ::apache::thrift::protocol::T_SET, 6);
  211.   {
  212.     xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_STRUCT, this->savings.size());
  213.     std::set<SavingsInfo> ::const_iterator _iter13;
  214.     for (_iter13 = this->savings.begin(); _iter13 != this->savings.end(); ++_iter13)
  215.     {
  216.       xfer += (*_iter13).write(oprot);
  217.     }
  218.     xfer += oprot->writeSetEnd();
  219.   }
  220.   xfer += oprot->writeFieldEnd();
  221.   xfer += oprot->writeFieldStop();
  222.   xfer += oprot->writeStructEnd();
  223.   return xfer;
  224. }
  225.  
  226. }}}} // namespace
clone this paste RAW Paste Data