aboutsummaryrefslogtreecommitdiff
path: root/tests/MyGame/Example/Stat.php
blob: c959ac7bb1b9020cfc8720e7c0fdec3d51d085d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
// automatically generated, do not modify

namespace MyGame\Example;

use \Google\FlatBuffers\Struct;
use \Google\FlatBuffers\Table;
use \Google\FlatBuffers\ByteBuffer;
use \Google\FlatBuffers\FlatBufferBuilder;

class Stat extends Table
{
    /**
     * @param ByteBuffer $bb
     * @return Stat
     */
    public static function getRootAsStat(ByteBuffer $bb)
    {
        $obj = new Stat();
        return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
    }

    public static function StatIdentifier()
    {
        return "MONS";
    }

    public static function StatBufferHasIdentifier(ByteBuffer $buf)
    {
        return self::__has_identifier($buf, self::StatIdentifier());
    }

    public static function StatExtension()
    {
        return "mon";
    }

    /**
     * @param int $_i offset
     * @param ByteBuffer $_bb
     * @return Stat
     **/
    public function init($_i, ByteBuffer $_bb)
    {
        $this->bb_pos = $_i;
        $this->bb = $_bb;
        return $this;
    }

    public function getId()
    {
        $o = $this->__offset(4);
        return $o != 0 ? $this->__string($o + $this->bb_pos) : null;
    }

    /**
     * @return long
     */
    public function getVal()
    {
        $o = $this->__offset(6);
        return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0;
    }

    /**
     * @return ushort
     */
    public function getCount()
    {
        $o = $this->__offset(8);
        return $o != 0 ? $this->bb->getUshort($o + $this->bb_pos) : 0;
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return void
     */
    public static function startStat(FlatBufferBuilder $builder)
    {
        $builder->StartObject(3);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return Stat
     */
    public static function createStat(FlatBufferBuilder $builder, $id, $val, $count)
    {
        $builder->startObject(3);
        self::addId($builder, $id);
        self::addVal($builder, $val);
        self::addCount($builder, $count);
        $o = $builder->endObject();
        return $o;
    }

    /**
     * @param FlatBufferBuilder $builder
     * @param StringOffset
     * @return void
     */
    public static function addId(FlatBufferBuilder $builder, $id)
    {
        $builder->addOffsetX(0, $id, 0);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @param long
     * @return void
     */
    public static function addVal(FlatBufferBuilder $builder, $val)
    {
        $builder->addLongX(1, $val, 0);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @param ushort
     * @return void
     */
    public static function addCount(FlatBufferBuilder $builder, $count)
    {
        $builder->addUshortX(2, $count, 0);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return int table offset
     */
    public static function endStat(FlatBufferBuilder $builder)
    {
        $o = $builder->endObject();
        return $o;
    }
}