Exemple #1
0
 public function write($output)
 {
     $xfer = 0;
     $xfer += $output->writeStructBegin('TColumnValue');
     if ($this->boolVal !== null) {
         if (!is_object($this->boolVal)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('boolVal', TType::STRUCT, 1);
         $xfer += $this->boolVal->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->byteVal !== null) {
         if (!is_object($this->byteVal)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('byteVal', TType::STRUCT, 2);
         $xfer += $this->byteVal->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->i16Val !== null) {
         if (!is_object($this->i16Val)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('i16Val', TType::STRUCT, 3);
         $xfer += $this->i16Val->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->i32Val !== null) {
         if (!is_object($this->i32Val)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('i32Val', TType::STRUCT, 4);
         $xfer += $this->i32Val->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->i64Val !== null) {
         if (!is_object($this->i64Val)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('i64Val', TType::STRUCT, 5);
         $xfer += $this->i64Val->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->doubleVal !== null) {
         if (!is_object($this->doubleVal)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('doubleVal', TType::STRUCT, 6);
         $xfer += $this->doubleVal->write($output);
         $xfer += $output->writeFieldEnd();
     }
     if ($this->stringVal !== null) {
         if (!is_object($this->stringVal)) {
             throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
         }
         $xfer += $output->writeFieldBegin('stringVal', TType::STRUCT, 7);
         $xfer += $this->stringVal->write($output);
         $xfer += $output->writeFieldEnd();
     }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
 }
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::LST) {
                     $this->boolColumn = array();
                     $_size32 = 0;
                     $_etype35 = 0;
                     $xfer += $input->readListBegin($_etype35, $_size32);
                     for ($_i36 = 0; $_i36 < $_size32; ++$_i36) {
                         $elem37 = null;
                         $elem37 = new TBoolValue();
                         $xfer += $elem37->read($input);
                         $this->boolColumn[] = $elem37;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::LST) {
                     $this->byteColumn = array();
                     $_size38 = 0;
                     $_etype41 = 0;
                     $xfer += $input->readListBegin($_etype41, $_size38);
                     for ($_i42 = 0; $_i42 < $_size38; ++$_i42) {
                         $elem43 = null;
                         $elem43 = new TByteValue();
                         $xfer += $elem43->read($input);
                         $this->byteColumn[] = $elem43;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->i16Column = array();
                     $_size44 = 0;
                     $_etype47 = 0;
                     $xfer += $input->readListBegin($_etype47, $_size44);
                     for ($_i48 = 0; $_i48 < $_size44; ++$_i48) {
                         $elem49 = null;
                         $elem49 = new TI16Value();
                         $xfer += $elem49->read($input);
                         $this->i16Column[] = $elem49;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::LST) {
                     $this->i32Column = array();
                     $_size50 = 0;
                     $_etype53 = 0;
                     $xfer += $input->readListBegin($_etype53, $_size50);
                     for ($_i54 = 0; $_i54 < $_size50; ++$_i54) {
                         $elem55 = null;
                         $elem55 = new TI32Value();
                         $xfer += $elem55->read($input);
                         $this->i32Column[] = $elem55;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 5:
                 if ($ftype == TType::LST) {
                     $this->i64Column = array();
                     $_size56 = 0;
                     $_etype59 = 0;
                     $xfer += $input->readListBegin($_etype59, $_size56);
                     for ($_i60 = 0; $_i60 < $_size56; ++$_i60) {
                         $elem61 = null;
                         $elem61 = new TI64Value();
                         $xfer += $elem61->read($input);
                         $this->i64Column[] = $elem61;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 6:
                 if ($ftype == TType::LST) {
                     $this->doubleColumn = array();
                     $_size62 = 0;
                     $_etype65 = 0;
                     $xfer += $input->readListBegin($_etype65, $_size62);
                     for ($_i66 = 0; $_i66 < $_size62; ++$_i66) {
                         $elem67 = null;
                         $elem67 = new TDoubleValue();
                         $xfer += $elem67->read($input);
                         $this->doubleColumn[] = $elem67;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 7:
                 if ($ftype == TType::LST) {
                     $this->stringColumn = array();
                     $_size68 = 0;
                     $_etype71 = 0;
                     $xfer += $input->readListBegin($_etype71, $_size68);
                     for ($_i72 = 0; $_i72 < $_size68; ++$_i72) {
                         $elem73 = null;
                         $elem73 = new TStringValue();
                         $xfer += $elem73->read($input);
                         $this->stringColumn[] = $elem73;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }