blob: 95cf6e1dd35ef65c5f986ebcb29ef4690c753723 [file]
<?php
/**
* Autogenerated by Thrift Compiler (0.16.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;
class PropValueUnion
{
static public $isValidate = false;
static public $_TSPEC = array(
1 => array(
'var' => 'intValue',
'isRequired' => false,
'type' => TType::I32,
),
2 => array(
'var' => 'longValue',
'isRequired' => false,
'type' => TType::I64,
),
3 => array(
'var' => 'stringValue',
'isRequired' => false,
'type' => TType::STRING,
),
4 => array(
'var' => 'doubleValue',
'isRequired' => false,
'type' => TType::DOUBLE,
),
5 => array(
'var' => 'flag',
'isRequired' => false,
'type' => TType::BOOL,
),
6 => array(
'var' => 'lString',
'isRequired' => false,
'type' => TType::LST,
'etype' => TType::STRING,
'elem' => array(
'type' => TType::STRING,
),
),
7 => array(
'var' => 'unionMStringString',
'isRequired' => false,
'type' => TType::MAP,
'ktype' => TType::STRING,
'vtype' => TType::STRING,
'key' => array(
'type' => TType::STRING,
),
'val' => array(
'type' => TType::STRING,
),
),
);
/**
* @var int
*/
public $intValue = null;
/**
* @var int
*/
public $longValue = null;
/**
* @var string
*/
public $stringValue = null;
/**
* @var double
*/
public $doubleValue = null;
/**
* @var bool
*/
public $flag = null;
/**
* @var string[]
*/
public $lString = null;
/**
* @var array
*/
public $unionMStringString = null;
public function __construct($vals = null)
{
if (is_array($vals)) {
if (isset($vals['intValue'])) {
$this->intValue = $vals['intValue'];
}
if (isset($vals['longValue'])) {
$this->longValue = $vals['longValue'];
}
if (isset($vals['stringValue'])) {
$this->stringValue = $vals['stringValue'];
}
if (isset($vals['doubleValue'])) {
$this->doubleValue = $vals['doubleValue'];
}
if (isset($vals['flag'])) {
$this->flag = $vals['flag'];
}
if (isset($vals['lString'])) {
$this->lString = $vals['lString'];
}
if (isset($vals['unionMStringString'])) {
$this->unionMStringString = $vals['unionMStringString'];
}
}
}
public function getName()
{
return 'PropValueUnion';
}
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::I32) {
$xfer += $input->readI32($this->intValue);
} else {
$xfer += $input->skip($ftype);
}
break;
case 2:
if ($ftype == TType::I64) {
$xfer += $input->readI64($this->longValue);
} else {
$xfer += $input->skip($ftype);
}
break;
case 3:
if ($ftype == TType::STRING) {
$xfer += $input->readString($this->stringValue);
} else {
$xfer += $input->skip($ftype);
}
break;
case 4:
if ($ftype == TType::DOUBLE) {
$xfer += $input->readDouble($this->doubleValue);
} else {
$xfer += $input->skip($ftype);
}
break;
case 5:
if ($ftype == TType::BOOL) {
$xfer += $input->readBool($this->flag);
} else {
$xfer += $input->skip($ftype);
}
break;
case 6:
if ($ftype == TType::LST) {
$this->lString = array();
$_size0 = 0;
$_etype3 = 0;
$xfer += $input->readListBegin($_etype3, $_size0);
for ($_i4 = 0; $_i4 < $_size0; ++$_i4) {
$elem5 = null;
$xfer += $input->readString($elem5);
$this->lString []= $elem5;
}
$xfer += $input->readListEnd();
} else {
$xfer += $input->skip($ftype);
}
break;
case 7:
if ($ftype == TType::MAP) {
$this->unionMStringString = array();
$_size6 = 0;
$_ktype7 = 0;
$_vtype8 = 0;
$xfer += $input->readMapBegin($_ktype7, $_vtype8, $_size6);
for ($_i10 = 0; $_i10 < $_size6; ++$_i10) {
$key11 = '';
$val12 = '';
$xfer += $input->readString($key11);
$xfer += $input->readString($val12);
$this->unionMStringString[$key11] = $val12;
}
$xfer += $input->readMapEnd();
} else {
$xfer += $input->skip($ftype);
}
break;
default:
$xfer += $input->skip($ftype);
break;
}
$xfer += $input->readFieldEnd();
}
$xfer += $input->readStructEnd();
return $xfer;
}
public function write($output)
{
$xfer = 0;
$xfer += $output->writeStructBegin('PropValueUnion');
if ($this->intValue !== null) {
$xfer += $output->writeFieldBegin('intValue', TType::I32, 1);
$xfer += $output->writeI32($this->intValue);
$xfer += $output->writeFieldEnd();
}
if ($this->longValue !== null) {
$xfer += $output->writeFieldBegin('longValue', TType::I64, 2);
$xfer += $output->writeI64($this->longValue);
$xfer += $output->writeFieldEnd();
}
if ($this->stringValue !== null) {
$xfer += $output->writeFieldBegin('stringValue', TType::STRING, 3);
$xfer += $output->writeString($this->stringValue);
$xfer += $output->writeFieldEnd();
}
if ($this->doubleValue !== null) {
$xfer += $output->writeFieldBegin('doubleValue', TType::DOUBLE, 4);
$xfer += $output->writeDouble($this->doubleValue);
$xfer += $output->writeFieldEnd();
}
if ($this->flag !== null) {
$xfer += $output->writeFieldBegin('flag', TType::BOOL, 5);
$xfer += $output->writeBool($this->flag);
$xfer += $output->writeFieldEnd();
}
if ($this->lString !== null) {
if (!is_array($this->lString)) {
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
}
$xfer += $output->writeFieldBegin('lString', TType::LST, 6);
$output->writeListBegin(TType::STRING, count($this->lString));
foreach ($this->lString as $iter13) {
$xfer += $output->writeString($iter13);
}
$output->writeListEnd();
$xfer += $output->writeFieldEnd();
}
if ($this->unionMStringString !== null) {
if (!is_array($this->unionMStringString)) {
throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
}
$xfer += $output->writeFieldBegin('unionMStringString', TType::MAP, 7);
$output->writeMapBegin(TType::STRING, TType::STRING, count($this->unionMStringString));
foreach ($this->unionMStringString as $kiter14 => $viter15) {
$xfer += $output->writeString($kiter14);
$xfer += $output->writeString($viter15);
}
$output->writeMapEnd();
$xfer += $output->writeFieldEnd();
}
$xfer += $output->writeFieldStop();
$xfer += $output->writeStructEnd();
return $xfer;
}
}