1<?php
2// automatically generated by the FlatBuffers compiler, do not modify
3
4use \Google\FlatBuffers\Struct;
5use \Google\FlatBuffers\Table;
6use \Google\FlatBuffers\ByteBuffer;
7use \Google\FlatBuffers\FlatBufferBuilder;
8
9class Movie extends Table
10{
11    /**
12     * @param ByteBuffer $bb
13     * @return Movie
14     */
15    public static function getRootAsMovie(ByteBuffer $bb)
16    {
17        $obj = new Movie();
18        return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
19    }
20
21    public static function MovieIdentifier()
22    {
23        return "MOVI";
24    }
25
26    public static function MovieBufferHasIdentifier(ByteBuffer $buf)
27    {
28        return self::__has_identifier($buf, self::MovieIdentifier());
29    }
30
31    /**
32     * @param int $_i offset
33     * @param ByteBuffer $_bb
34     * @return Movie
35     **/
36    public function init($_i, ByteBuffer $_bb)
37    {
38        $this->bb_pos = $_i;
39        $this->bb = $_bb;
40        return $this;
41    }
42
43    /**
44     * @return byte
45     */
46    public function getMainCharacterType()
47    {
48        $o = $this->__offset(4);
49        return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \Character::NONE;
50    }
51
52    /**
53     * @returnint
54     */
55    public function getMainCharacter($obj)
56    {
57        $o = $this->__offset(6);
58        return $o != 0 ? $this->__union($obj, $o) : null;
59    }
60
61    /**
62     * @param int offset
63     * @return byte
64     */
65    public function getCharactersType($j)
66    {
67        $o = $this->__offset(8);
68        return $o != 0 ? $this->bb->getByte($this->__vector($o) + $j * 1) : \Character::NONE;
69    }
70
71    /**
72     * @return int
73     */
74    public function getCharactersTypeLength()
75    {
76        $o = $this->__offset(8);
77        return $o != 0 ? $this->__vector_len($o) : 0;
78    }
79
80    /**
81     * @param int offset
82     * @return Table
83     */
84    public function getCharacters($j, $obj)
85    {
86        $o = $this->__offset(10);
87        return $o != 0 ? $this->__union($obj, $this->__vector($o) + $j * 4 - $this->bb_pos) : null;
88    }
89
90    /**
91     * @return int
92     */
93    public function getCharactersLength()
94    {
95        $o = $this->__offset(10);
96        return $o != 0 ? $this->__vector_len($o) : 0;
97    }
98
99    /**
100     * @param FlatBufferBuilder $builder
101     * @return void
102     */
103    public static function startMovie(FlatBufferBuilder $builder)
104    {
105        $builder->StartObject(4);
106    }
107
108    /**
109     * @param FlatBufferBuilder $builder
110     * @return Movie
111     */
112    public static function createMovie(FlatBufferBuilder $builder, $main_character_type, $main_character, $characters_type, $characters)
113    {
114        $builder->startObject(4);
115        self::addMainCharacterType($builder, $main_character_type);
116        self::addMainCharacter($builder, $main_character);
117        self::addCharactersType($builder, $characters_type);
118        self::addCharacters($builder, $characters);
119        $o = $builder->endObject();
120        return $o;
121    }
122
123    /**
124     * @param FlatBufferBuilder $builder
125     * @param byte
126     * @return void
127     */
128    public static function addMainCharacterType(FlatBufferBuilder $builder, $mainCharacterType)
129    {
130        $builder->addByteX(0, $mainCharacterType, 0);
131    }
132
133    public static function addMainCharacter(FlatBufferBuilder $builder, $offset)
134    {
135        $builder->addOffsetX(1, $offset, 0);
136    }
137
138    /**
139     * @param FlatBufferBuilder $builder
140     * @param VectorOffset
141     * @return void
142     */
143    public static function addCharactersType(FlatBufferBuilder $builder, $charactersType)
144    {
145        $builder->addOffsetX(2, $charactersType, 0);
146    }
147
148    /**
149     * @param FlatBufferBuilder $builder
150     * @param array offset array
151     * @return int vector offset
152     */
153    public static function createCharactersTypeVector(FlatBufferBuilder $builder, array $data)
154    {
155        $builder->startVector(1, count($data), 1);
156        for ($i = count($data) - 1; $i >= 0; $i--) {
157            $builder->putByte($data[$i]);
158        }
159        return $builder->endVector();
160    }
161
162    /**
163     * @param FlatBufferBuilder $builder
164     * @param int $numElems
165     * @return void
166     */
167    public static function startCharactersTypeVector(FlatBufferBuilder $builder, $numElems)
168    {
169        $builder->startVector(1, $numElems, 1);
170    }
171
172    /**
173     * @param FlatBufferBuilder $builder
174     * @param VectorOffset
175     * @return void
176     */
177    public static function addCharacters(FlatBufferBuilder $builder, $characters)
178    {
179        $builder->addOffsetX(3, $characters, 0);
180    }
181
182    /**
183     * @param FlatBufferBuilder $builder
184     * @param array offset array
185     * @return int vector offset
186     */
187    public static function createCharactersVector(FlatBufferBuilder $builder, array $data)
188    {
189        $builder->startVector(4, count($data), 4);
190        for ($i = count($data) - 1; $i >= 0; $i--) {
191            $builder->putOffset($data[$i]);
192        }
193        return $builder->endVector();
194    }
195
196    /**
197     * @param FlatBufferBuilder $builder
198     * @param int $numElems
199     * @return void
200     */
201    public static function startCharactersVector(FlatBufferBuilder $builder, $numElems)
202    {
203        $builder->startVector(4, $numElems, 4);
204    }
205
206    /**
207     * @param FlatBufferBuilder $builder
208     * @return int table offset
209     */
210    public static function endMovie(FlatBufferBuilder $builder)
211    {
212        $o = $builder->endObject();
213        return $o;
214    }
215
216    public static function finishMovieBuffer(FlatBufferBuilder $builder, $offset)
217    {
218        $builder->finish($offset, "MOVI");
219    }
220}
221