Home | History | Annotate | Download | only in Example
      1 <?php
      2 // automatically generated by the FlatBuffers compiler, do not modify
      3 
      4 namespace MyGame\Example;
      5 
      6 use \Google\FlatBuffers\Struct;
      7 use \Google\FlatBuffers\Table;
      8 use \Google\FlatBuffers\ByteBuffer;
      9 use \Google\FlatBuffers\FlatBufferBuilder;
     10 
     11 class TypeAliases extends Table
     12 {
     13     /**
     14      * @param ByteBuffer $bb
     15      * @return TypeAliases
     16      */
     17     public static function getRootAsTypeAliases(ByteBuffer $bb)
     18     {
     19         $obj = new TypeAliases();
     20         return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
     21     }
     22 
     23     public static function TypeAliasesIdentifier()
     24     {
     25         return "MONS";
     26     }
     27 
     28     public static function TypeAliasesBufferHasIdentifier(ByteBuffer $buf)
     29     {
     30         return self::__has_identifier($buf, self::TypeAliasesIdentifier());
     31     }
     32 
     33     public static function TypeAliasesExtension()
     34     {
     35         return "mon";
     36     }
     37 
     38     /**
     39      * @param int $_i offset
     40      * @param ByteBuffer $_bb
     41      * @return TypeAliases
     42      **/
     43     public function init($_i, ByteBuffer $_bb)
     44     {
     45         $this->bb_pos = $_i;
     46         $this->bb = $_bb;
     47         return $this;
     48     }
     49 
     50     /**
     51      * @return sbyte
     52      */
     53     public function getI8()
     54     {
     55         $o = $this->__offset(4);
     56         return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : 0;
     57     }
     58 
     59     /**
     60      * @return byte
     61      */
     62     public function getU8()
     63     {
     64         $o = $this->__offset(6);
     65         return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : 0;
     66     }
     67 
     68     /**
     69      * @return short
     70      */
     71     public function getI16()
     72     {
     73         $o = $this->__offset(8);
     74         return $o != 0 ? $this->bb->getShort($o + $this->bb_pos) : 0;
     75     }
     76 
     77     /**
     78      * @return ushort
     79      */
     80     public function getU16()
     81     {
     82         $o = $this->__offset(10);
     83         return $o != 0 ? $this->bb->getUshort($o + $this->bb_pos) : 0;
     84     }
     85 
     86     /**
     87      * @return int
     88      */
     89     public function getI32()
     90     {
     91         $o = $this->__offset(12);
     92         return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
     93     }
     94 
     95     /**
     96      * @return uint
     97      */
     98     public function getU32()
     99     {
    100         $o = $this->__offset(14);
    101         return $o != 0 ? $this->bb->getUint($o + $this->bb_pos) : 0;
    102     }
    103 
    104     /**
    105      * @return long
    106      */
    107     public function getI64()
    108     {
    109         $o = $this->__offset(16);
    110         return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0;
    111     }
    112 
    113     /**
    114      * @return ulong
    115      */
    116     public function getU64()
    117     {
    118         $o = $this->__offset(18);
    119         return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0;
    120     }
    121 
    122     /**
    123      * @return float
    124      */
    125     public function getF32()
    126     {
    127         $o = $this->__offset(20);
    128         return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 0.0;
    129     }
    130 
    131     /**
    132      * @return double
    133      */
    134     public function getF64()
    135     {
    136         $o = $this->__offset(22);
    137         return $o != 0 ? $this->bb->getDouble($o + $this->bb_pos) : 0.0;
    138     }
    139 
    140     /**
    141      * @param int offset
    142      * @return sbyte
    143      */
    144     public function getV8($j)
    145     {
    146         $o = $this->__offset(24);
    147         return $o != 0 ? $this->bb->getSbyte($this->__vector($o) + $j * 1) : 0;
    148     }
    149 
    150     /**
    151      * @return int
    152      */
    153     public function getV8Length()
    154     {
    155         $o = $this->__offset(24);
    156         return $o != 0 ? $this->__vector_len($o) : 0;
    157     }
    158 
    159     /**
    160      * @param int offset
    161      * @return double
    162      */
    163     public function getVf64($j)
    164     {
    165         $o = $this->__offset(26);
    166         return $o != 0 ? $this->bb->getDouble($this->__vector($o) + $j * 8) : 0;
    167     }
    168 
    169     /**
    170      * @return int
    171      */
    172     public function getVf64Length()
    173     {
    174         $o = $this->__offset(26);
    175         return $o != 0 ? $this->__vector_len($o) : 0;
    176     }
    177 
    178     /**
    179      * @param FlatBufferBuilder $builder
    180      * @return void
    181      */
    182     public static function startTypeAliases(FlatBufferBuilder $builder)
    183     {
    184         $builder->StartObject(12);
    185     }
    186 
    187     /**
    188      * @param FlatBufferBuilder $builder
    189      * @return TypeAliases
    190      */
    191     public static function createTypeAliases(FlatBufferBuilder $builder, $i8, $u8, $i16, $u16, $i32, $u32, $i64, $u64, $f32, $f64, $v8, $vf64)
    192     {
    193         $builder->startObject(12);
    194         self::addI8($builder, $i8);
    195         self::addU8($builder, $u8);
    196         self::addI16($builder, $i16);
    197         self::addU16($builder, $u16);
    198         self::addI32($builder, $i32);
    199         self::addU32($builder, $u32);
    200         self::addI64($builder, $i64);
    201         self::addU64($builder, $u64);
    202         self::addF32($builder, $f32);
    203         self::addF64($builder, $f64);
    204         self::addV8($builder, $v8);
    205         self::addVf64($builder, $vf64);
    206         $o = $builder->endObject();
    207         return $o;
    208     }
    209 
    210     /**
    211      * @param FlatBufferBuilder $builder
    212      * @param sbyte
    213      * @return void
    214      */
    215     public static function addI8(FlatBufferBuilder $builder, $i8)
    216     {
    217         $builder->addSbyteX(0, $i8, 0);
    218     }
    219 
    220     /**
    221      * @param FlatBufferBuilder $builder
    222      * @param byte
    223      * @return void
    224      */
    225     public static function addU8(FlatBufferBuilder $builder, $u8)
    226     {
    227         $builder->addByteX(1, $u8, 0);
    228     }
    229 
    230     /**
    231      * @param FlatBufferBuilder $builder
    232      * @param short
    233      * @return void
    234      */
    235     public static function addI16(FlatBufferBuilder $builder, $i16)
    236     {
    237         $builder->addShortX(2, $i16, 0);
    238     }
    239 
    240     /**
    241      * @param FlatBufferBuilder $builder
    242      * @param ushort
    243      * @return void
    244      */
    245     public static function addU16(FlatBufferBuilder $builder, $u16)
    246     {
    247         $builder->addUshortX(3, $u16, 0);
    248     }
    249 
    250     /**
    251      * @param FlatBufferBuilder $builder
    252      * @param int
    253      * @return void
    254      */
    255     public static function addI32(FlatBufferBuilder $builder, $i32)
    256     {
    257         $builder->addIntX(4, $i32, 0);
    258     }
    259 
    260     /**
    261      * @param FlatBufferBuilder $builder
    262      * @param uint
    263      * @return void
    264      */
    265     public static function addU32(FlatBufferBuilder $builder, $u32)
    266     {
    267         $builder->addUintX(5, $u32, 0);
    268     }
    269 
    270     /**
    271      * @param FlatBufferBuilder $builder
    272      * @param long
    273      * @return void
    274      */
    275     public static function addI64(FlatBufferBuilder $builder, $i64)
    276     {
    277         $builder->addLongX(6, $i64, 0);
    278     }
    279 
    280     /**
    281      * @param FlatBufferBuilder $builder
    282      * @param ulong
    283      * @return void
    284      */
    285     public static function addU64(FlatBufferBuilder $builder, $u64)
    286     {
    287         $builder->addUlongX(7, $u64, 0);
    288     }
    289 
    290     /**
    291      * @param FlatBufferBuilder $builder
    292      * @param float
    293      * @return void
    294      */
    295     public static function addF32(FlatBufferBuilder $builder, $f32)
    296     {
    297         $builder->addFloatX(8, $f32, 0.0);
    298     }
    299 
    300     /**
    301      * @param FlatBufferBuilder $builder
    302      * @param double
    303      * @return void
    304      */
    305     public static function addF64(FlatBufferBuilder $builder, $f64)
    306     {
    307         $builder->addDoubleX(9, $f64, 0.0);
    308     }
    309 
    310     /**
    311      * @param FlatBufferBuilder $builder
    312      * @param VectorOffset
    313      * @return void
    314      */
    315     public static function addV8(FlatBufferBuilder $builder, $v8)
    316     {
    317         $builder->addOffsetX(10, $v8, 0);
    318     }
    319 
    320     /**
    321      * @param FlatBufferBuilder $builder
    322      * @param array offset array
    323      * @return int vector offset
    324      */
    325     public static function createV8Vector(FlatBufferBuilder $builder, array $data)
    326     {
    327         $builder->startVector(1, count($data), 1);
    328         for ($i = count($data) - 1; $i >= 0; $i--) {
    329             $builder->addSbyte($data[$i]);
    330         }
    331         return $builder->endVector();
    332     }
    333 
    334     /**
    335      * @param FlatBufferBuilder $builder
    336      * @param int $numElems
    337      * @return void
    338      */
    339     public static function startV8Vector(FlatBufferBuilder $builder, $numElems)
    340     {
    341         $builder->startVector(1, $numElems, 1);
    342     }
    343 
    344     /**
    345      * @param FlatBufferBuilder $builder
    346      * @param VectorOffset
    347      * @return void
    348      */
    349     public static function addVf64(FlatBufferBuilder $builder, $vf64)
    350     {
    351         $builder->addOffsetX(11, $vf64, 0);
    352     }
    353 
    354     /**
    355      * @param FlatBufferBuilder $builder
    356      * @param array offset array
    357      * @return int vector offset
    358      */
    359     public static function createVf64Vector(FlatBufferBuilder $builder, array $data)
    360     {
    361         $builder->startVector(8, count($data), 8);
    362         for ($i = count($data) - 1; $i >= 0; $i--) {
    363             $builder->addDouble($data[$i]);
    364         }
    365         return $builder->endVector();
    366     }
    367 
    368     /**
    369      * @param FlatBufferBuilder $builder
    370      * @param int $numElems
    371      * @return void
    372      */
    373     public static function startVf64Vector(FlatBufferBuilder $builder, $numElems)
    374     {
    375         $builder->startVector(8, $numElems, 8);
    376     }
    377 
    378     /**
    379      * @param FlatBufferBuilder $builder
    380      * @return int table offset
    381      */
    382     public static function endTypeAliases(FlatBufferBuilder $builder)
    383     {
    384         $o = $builder->endObject();
    385         return $o;
    386     }
    387 }
    388