mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 20:40:02 +00:00
add rest of golden language directories
This commit is contained in:
141
goldens/php/Universe.php
Normal file
141
goldens/php/Universe.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class Universe extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return Universe
|
||||
*/
|
||||
public static function getRootAsUniverse(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new Universe();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return Universe
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return double
|
||||
*/
|
||||
public function getAge()
|
||||
{
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $this->bb->getDouble($o + $this->bb_pos) : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returnVectorOffset
|
||||
*/
|
||||
public function getGalaxies($j)
|
||||
{
|
||||
$o = $this->__offset(6);
|
||||
$obj = new Galaxy();
|
||||
return $o != 0 ? $obj->init($this->__indirect($this->__vector($o) + $j * 4), $this->bb) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getGalaxiesLength()
|
||||
{
|
||||
$o = $this->__offset(6);
|
||||
return $o != 0 ? $this->__vector_len($o) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startUniverse(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return Universe
|
||||
*/
|
||||
public static function createUniverse(FlatBufferBuilder $builder, $age, $galaxies)
|
||||
{
|
||||
$builder->startObject(2);
|
||||
self::addAge($builder, $age);
|
||||
self::addGalaxies($builder, $galaxies);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param double
|
||||
* @return void
|
||||
*/
|
||||
public static function addAge(FlatBufferBuilder $builder, $age)
|
||||
{
|
||||
$builder->addDoubleX(0, $age, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param VectorOffset
|
||||
* @return void
|
||||
*/
|
||||
public static function addGalaxies(FlatBufferBuilder $builder, $galaxies)
|
||||
{
|
||||
$builder->addOffsetX(1, $galaxies, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param array offset array
|
||||
* @return int vector offset
|
||||
*/
|
||||
public static function createGalaxiesVector(FlatBufferBuilder $builder, array $data)
|
||||
{
|
||||
$builder->startVector(4, count($data), 4);
|
||||
for ($i = count($data) - 1; $i >= 0; $i--) {
|
||||
$builder->putOffset($data[$i]);
|
||||
}
|
||||
return $builder->endVector();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int $numElems
|
||||
* @return void
|
||||
*/
|
||||
public static function startGalaxiesVector(FlatBufferBuilder $builder, $numElems)
|
||||
{
|
||||
$builder->startVector(4, $numElems, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endUniverse(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
public static function finishUniverseBuffer(FlatBufferBuilder $builder, $offset)
|
||||
{
|
||||
$builder->finish($offset);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user