1<?php
2// automatically generated by the FlatBuffers compiler, do not modify
3
4namespace NamespaceA;
5
6use \Google\FlatBuffers\Struct;
7use \Google\FlatBuffers\Table;
8use \Google\FlatBuffers\ByteBuffer;
9use \Google\FlatBuffers\FlatBufferBuilder;
10
11class TableInFirstNS extends Table
12{
13    /**
14     * @param ByteBuffer $bb
15     * @return TableInFirstNS
16     */
17    public static function getRootAsTableInFirstNS(ByteBuffer $bb)
18    {
19        $obj = new TableInFirstNS();
20        return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
21    }
22
23    /**
24     * @param int $_i offset
25     * @param ByteBuffer $_bb
26     * @return TableInFirstNS
27     **/
28    public function init($_i, ByteBuffer $_bb)
29    {
30        $this->bb_pos = $_i;
31        $this->bb = $_bb;
32        return $this;
33    }
34
35    public function getFooTable()
36    {
37        $obj = new TableInNestedNS();
38        $o = $this->__offset(4);
39        return $o != 0 ? $obj->init($this->__indirect($o + $this->bb_pos), $this->bb) : 0;
40    }
41
42    /**
43     * @return sbyte
44     */
45    public function getFooEnum()
46    {
47        $o = $this->__offset(6);
48        return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : \NamespaceA\NamespaceB\EnumInNestedNS::A;
49    }
50
51    /**
52     * @return byte
53     */
54    public function getFooUnionType()
55    {
56        $o = $this->__offset(8);
57        return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \NamespaceA\NamespaceB\UnionInNestedNS::NONE;
58    }
59
60    /**
61     * @returnint
62     */
63    public function getFooUnion($obj)
64    {
65        $o = $this->__offset(10);
66        return $o != 0 ? $this->__union($obj, $o) : null;
67    }
68
69    public function getFooStruct()
70    {
71        $obj = new StructInNestedNS();
72        $o = $this->__offset(12);
73        return $o != 0 ? $obj->init($o + $this->bb_pos, $this->bb) : 0;
74    }
75
76    /**
77     * @param FlatBufferBuilder $builder
78     * @return void
79     */
80    public static function startTableInFirstNS(FlatBufferBuilder $builder)
81    {
82        $builder->StartObject(5);
83    }
84
85    /**
86     * @param FlatBufferBuilder $builder
87     * @return TableInFirstNS
88     */
89    public static function createTableInFirstNS(FlatBufferBuilder $builder, $foo_table, $foo_enum, $foo_union_type, $foo_union, $foo_struct)
90    {
91        $builder->startObject(5);
92        self::addFooTable($builder, $foo_table);
93        self::addFooEnum($builder, $foo_enum);
94        self::addFooUnionType($builder, $foo_union_type);
95        self::addFooUnion($builder, $foo_union);
96        self::addFooStruct($builder, $foo_struct);
97        $o = $builder->endObject();
98        return $o;
99    }
100
101    /**
102     * @param FlatBufferBuilder $builder
103     * @param int
104     * @return void
105     */
106    public static function addFooTable(FlatBufferBuilder $builder, $fooTable)
107    {
108        $builder->addOffsetX(0, $fooTable, 0);
109    }
110
111    /**
112     * @param FlatBufferBuilder $builder
113     * @param sbyte
114     * @return void
115     */
116    public static function addFooEnum(FlatBufferBuilder $builder, $fooEnum)
117    {
118        $builder->addSbyteX(1, $fooEnum, 0);
119    }
120
121    /**
122     * @param FlatBufferBuilder $builder
123     * @param byte
124     * @return void
125     */
126    public static function addFooUnionType(FlatBufferBuilder $builder, $fooUnionType)
127    {
128        $builder->addByteX(2, $fooUnionType, 0);
129    }
130
131    public static function addFooUnion(FlatBufferBuilder $builder, $offset)
132    {
133        $builder->addOffsetX(3, $offset, 0);
134    }
135
136    /**
137     * @param FlatBufferBuilder $builder
138     * @param int
139     * @return void
140     */
141    public static function addFooStruct(FlatBufferBuilder $builder, $fooStruct)
142    {
143        $builder->addStructX(4, $fooStruct, 0);
144    }
145
146    /**
147     * @param FlatBufferBuilder $builder
148     * @return int table offset
149     */
150    public static function endTableInFirstNS(FlatBufferBuilder $builder)
151    {
152        $o = $builder->endObject();
153        return $o;
154    }
155}
156