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 Stat extends Table
     12 {
     13     /**
     14      * @param ByteBuffer $bb
     15      * @return Stat
     16      */
     17     public static function getRootAsStat(ByteBuffer $bb)
     18     {
     19         $obj = new Stat();
     20         return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
     21     }
     22 
     23     public static function StatIdentifier()
     24     {
     25         return "MONS";
     26     }
     27 
     28     public static function StatBufferHasIdentifier(ByteBuffer $buf)
     29     {
     30         return self::__has_identifier($buf, self::StatIdentifier());
     31     }
     32 
     33     public static function StatExtension()
     34     {
     35         return "mon";
     36     }
     37 
     38     /**
     39      * @param int $_i offset
     40      * @param ByteBuffer $_bb
     41      * @return Stat
     42      **/
     43     public function init($_i, ByteBuffer $_bb)
     44     {
     45         $this->bb_pos = $_i;
     46         $this->bb = $_bb;
     47         return $this;
     48     }
     49 
     50     public function getId()
     51     {
     52         $o = $this->__offset(4);
     53         return $o != 0 ? $this->__string($o + $this->bb_pos) : null;
     54     }
     55 
     56     /**
     57      * @return long
     58      */
     59     public function getVal()
     60     {
     61         $o = $this->__offset(6);
     62         return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0;
     63     }
     64 
     65     /**
     66      * @return ushort
     67      */
     68     public function getCount()
     69     {
     70         $o = $this->__offset(8);
     71         return $o != 0 ? $this->bb->getUshort($o + $this->bb_pos) : 0;
     72     }
     73 
     74     /**
     75      * @param FlatBufferBuilder $builder
     76      * @return void
     77      */
     78     public static function startStat(FlatBufferBuilder $builder)
     79     {
     80         $builder->StartObject(3);
     81     }
     82 
     83     /**
     84      * @param FlatBufferBuilder $builder
     85      * @return Stat
     86      */
     87     public static function createStat(FlatBufferBuilder $builder, $id, $val, $count)
     88     {
     89         $builder->startObject(3);
     90         self::addId($builder, $id);
     91         self::addVal($builder, $val);
     92         self::addCount($builder, $count);
     93         $o = $builder->endObject();
     94         return $o;
     95     }
     96 
     97     /**
     98      * @param FlatBufferBuilder $builder
     99      * @param StringOffset
    100      * @return void
    101      */
    102     public static function addId(FlatBufferBuilder $builder, $id)
    103     {
    104         $builder->addOffsetX(0, $id, 0);
    105     }
    106 
    107     /**
    108      * @param FlatBufferBuilder $builder
    109      * @param long
    110      * @return void
    111      */
    112     public static function addVal(FlatBufferBuilder $builder, $val)
    113     {
    114         $builder->addLongX(1, $val, 0);
    115     }
    116 
    117     /**
    118      * @param FlatBufferBuilder $builder
    119      * @param ushort
    120      * @return void
    121      */
    122     public static function addCount(FlatBufferBuilder $builder, $count)
    123     {
    124         $builder->addUshortX(2, $count, 0);
    125     }
    126 
    127     /**
    128      * @param FlatBufferBuilder $builder
    129      * @return int table offset
    130      */
    131     public static function endStat(FlatBufferBuilder $builder)
    132     {
    133         $o = $builder->endObject();
    134         return $o;
    135     }
    136 }
    137