blob: 97c93991c83ff70e3c21b93b471f7f213e8a053a [file] [log] [blame]
Austin Schuh2dd86a92022-09-14 21:19:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2import * as flatbuffers from 'flatbuffers';
3import { Ability } from '../../my-game/example/ability.js';
4import { Any, unionToAny } from '../../my-game/example/any.js';
5import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js';
6import { AnyUniqueAliases, unionToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases.js';
7import { Color } from '../../my-game/example/color.js';
8import { Race } from '../../my-game/example/race.js';
9import { Referrable } from '../../my-game/example/referrable.js';
10import { Stat } from '../../my-game/example/stat.js';
11import { Test } from '../../my-game/example/test.js';
12import { Vec3 } from '../../my-game/example/vec3.js';
13import { InParentNamespace } from '../../my-game/in-parent-namespace.js';
14/**
15 * an example documentation comment: "monster object"
16 */
17export class Monster {
18 constructor() {
19 this.bb = null;
20 this.bb_pos = 0;
21 }
22 __init(i, bb) {
23 this.bb_pos = i;
24 this.bb = bb;
25 return this;
26 }
27 static getRootAsMonster(bb, obj) {
28 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
29 }
30 static getSizePrefixedRootAsMonster(bb, obj) {
31 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
32 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
33 }
34 static bufferHasIdentifier(bb) {
35 return bb.__has_identifier('MONS');
36 }
37 pos(obj) {
38 const offset = this.bb.__offset(this.bb_pos, 4);
39 return offset ? (obj || new Vec3()).__init(this.bb_pos + offset, this.bb) : null;
40 }
41 mana() {
42 const offset = this.bb.__offset(this.bb_pos, 6);
43 return offset ? this.bb.readInt16(this.bb_pos + offset) : 150;
44 }
45 mutate_mana(value) {
46 const offset = this.bb.__offset(this.bb_pos, 6);
47 if (offset === 0) {
48 return false;
49 }
50 this.bb.writeInt16(this.bb_pos + offset, value);
51 return true;
52 }
53 hp() {
54 const offset = this.bb.__offset(this.bb_pos, 8);
55 return offset ? this.bb.readInt16(this.bb_pos + offset) : 100;
56 }
57 mutate_hp(value) {
58 const offset = this.bb.__offset(this.bb_pos, 8);
59 if (offset === 0) {
60 return false;
61 }
62 this.bb.writeInt16(this.bb_pos + offset, value);
63 return true;
64 }
65 name(optionalEncoding) {
66 const offset = this.bb.__offset(this.bb_pos, 10);
67 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
68 }
69 inventory(index) {
70 const offset = this.bb.__offset(this.bb_pos, 14);
71 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
72 }
73 inventoryLength() {
74 const offset = this.bb.__offset(this.bb_pos, 14);
75 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
76 }
77 inventoryArray() {
78 const offset = this.bb.__offset(this.bb_pos, 14);
79 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
80 }
81 color() {
82 const offset = this.bb.__offset(this.bb_pos, 16);
83 return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Blue;
84 }
85 mutate_color(value) {
86 const offset = this.bb.__offset(this.bb_pos, 16);
87 if (offset === 0) {
88 return false;
89 }
90 this.bb.writeUint8(this.bb_pos + offset, value);
91 return true;
92 }
93 testType() {
94 const offset = this.bb.__offset(this.bb_pos, 18);
95 return offset ? this.bb.readUint8(this.bb_pos + offset) : Any.NONE;
96 }
97 test(obj) {
98 const offset = this.bb.__offset(this.bb_pos, 20);
99 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
100 }
101 test4(index, obj) {
102 const offset = this.bb.__offset(this.bb_pos, 22);
103 return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
104 }
105 test4Length() {
106 const offset = this.bb.__offset(this.bb_pos, 22);
107 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
108 }
109 testarrayofstring(index, optionalEncoding) {
110 const offset = this.bb.__offset(this.bb_pos, 24);
111 return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
112 }
113 testarrayofstringLength() {
114 const offset = this.bb.__offset(this.bb_pos, 24);
115 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
116 }
117 /**
118 * an example documentation comment: this will end up in the generated code
119 * multiline too
120 */
121 testarrayoftables(index, obj) {
122 const offset = this.bb.__offset(this.bb_pos, 26);
123 return offset ? (obj || new Monster()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
124 }
125 testarrayoftablesLength() {
126 const offset = this.bb.__offset(this.bb_pos, 26);
127 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
128 }
129 enemy(obj) {
130 const offset = this.bb.__offset(this.bb_pos, 28);
131 return offset ? (obj || new Monster()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
132 }
133 testnestedflatbuffer(index) {
134 const offset = this.bb.__offset(this.bb_pos, 30);
135 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
136 }
137 testnestedflatbufferLength() {
138 const offset = this.bb.__offset(this.bb_pos, 30);
139 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
140 }
141 testnestedflatbufferArray() {
142 const offset = this.bb.__offset(this.bb_pos, 30);
143 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
144 }
145 testempty(obj) {
146 const offset = this.bb.__offset(this.bb_pos, 32);
147 return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
148 }
149 testbool() {
150 const offset = this.bb.__offset(this.bb_pos, 34);
151 return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
152 }
153 mutate_testbool(value) {
154 const offset = this.bb.__offset(this.bb_pos, 34);
155 if (offset === 0) {
156 return false;
157 }
158 this.bb.writeInt8(this.bb_pos + offset, +value);
159 return true;
160 }
161 testhashs32Fnv1() {
162 const offset = this.bb.__offset(this.bb_pos, 36);
163 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
164 }
165 mutate_testhashs32_fnv1(value) {
166 const offset = this.bb.__offset(this.bb_pos, 36);
167 if (offset === 0) {
168 return false;
169 }
170 this.bb.writeInt32(this.bb_pos + offset, value);
171 return true;
172 }
173 testhashu32Fnv1() {
174 const offset = this.bb.__offset(this.bb_pos, 38);
175 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
176 }
177 mutate_testhashu32_fnv1(value) {
178 const offset = this.bb.__offset(this.bb_pos, 38);
179 if (offset === 0) {
180 return false;
181 }
182 this.bb.writeUint32(this.bb_pos + offset, value);
183 return true;
184 }
185 testhashs64Fnv1() {
186 const offset = this.bb.__offset(this.bb_pos, 40);
187 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
188 }
189 mutate_testhashs64_fnv1(value) {
190 const offset = this.bb.__offset(this.bb_pos, 40);
191 if (offset === 0) {
192 return false;
193 }
194 this.bb.writeInt64(this.bb_pos + offset, value);
195 return true;
196 }
197 testhashu64Fnv1() {
198 const offset = this.bb.__offset(this.bb_pos, 42);
199 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
200 }
201 mutate_testhashu64_fnv1(value) {
202 const offset = this.bb.__offset(this.bb_pos, 42);
203 if (offset === 0) {
204 return false;
205 }
206 this.bb.writeUint64(this.bb_pos + offset, value);
207 return true;
208 }
209 testhashs32Fnv1a() {
210 const offset = this.bb.__offset(this.bb_pos, 44);
211 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
212 }
213 mutate_testhashs32_fnv1a(value) {
214 const offset = this.bb.__offset(this.bb_pos, 44);
215 if (offset === 0) {
216 return false;
217 }
218 this.bb.writeInt32(this.bb_pos + offset, value);
219 return true;
220 }
221 testhashu32Fnv1a() {
222 const offset = this.bb.__offset(this.bb_pos, 46);
223 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
224 }
225 mutate_testhashu32_fnv1a(value) {
226 const offset = this.bb.__offset(this.bb_pos, 46);
227 if (offset === 0) {
228 return false;
229 }
230 this.bb.writeUint32(this.bb_pos + offset, value);
231 return true;
232 }
233 testhashs64Fnv1a() {
234 const offset = this.bb.__offset(this.bb_pos, 48);
235 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
236 }
237 mutate_testhashs64_fnv1a(value) {
238 const offset = this.bb.__offset(this.bb_pos, 48);
239 if (offset === 0) {
240 return false;
241 }
242 this.bb.writeInt64(this.bb_pos + offset, value);
243 return true;
244 }
245 testhashu64Fnv1a() {
246 const offset = this.bb.__offset(this.bb_pos, 50);
247 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
248 }
249 mutate_testhashu64_fnv1a(value) {
250 const offset = this.bb.__offset(this.bb_pos, 50);
251 if (offset === 0) {
252 return false;
253 }
254 this.bb.writeUint64(this.bb_pos + offset, value);
255 return true;
256 }
257 testarrayofbools(index) {
258 const offset = this.bb.__offset(this.bb_pos, 52);
259 return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false;
260 }
261 testarrayofboolsLength() {
262 const offset = this.bb.__offset(this.bb_pos, 52);
263 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
264 }
265 testarrayofboolsArray() {
266 const offset = this.bb.__offset(this.bb_pos, 52);
267 return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
268 }
269 testf() {
270 const offset = this.bb.__offset(this.bb_pos, 54);
271 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.14159;
272 }
273 mutate_testf(value) {
274 const offset = this.bb.__offset(this.bb_pos, 54);
275 if (offset === 0) {
276 return false;
277 }
278 this.bb.writeFloat32(this.bb_pos + offset, value);
279 return true;
280 }
281 testf2() {
282 const offset = this.bb.__offset(this.bb_pos, 56);
283 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.0;
284 }
285 mutate_testf2(value) {
286 const offset = this.bb.__offset(this.bb_pos, 56);
287 if (offset === 0) {
288 return false;
289 }
290 this.bb.writeFloat32(this.bb_pos + offset, value);
291 return true;
292 }
293 testf3() {
294 const offset = this.bb.__offset(this.bb_pos, 58);
295 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
296 }
297 mutate_testf3(value) {
298 const offset = this.bb.__offset(this.bb_pos, 58);
299 if (offset === 0) {
300 return false;
301 }
302 this.bb.writeFloat32(this.bb_pos + offset, value);
303 return true;
304 }
305 testarrayofstring2(index, optionalEncoding) {
306 const offset = this.bb.__offset(this.bb_pos, 60);
307 return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
308 }
309 testarrayofstring2Length() {
310 const offset = this.bb.__offset(this.bb_pos, 60);
311 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
312 }
313 testarrayofsortedstruct(index, obj) {
314 const offset = this.bb.__offset(this.bb_pos, 62);
315 return offset ? (obj || new Ability()).__init(this.bb.__vector(this.bb_pos + offset) + index * 8, this.bb) : null;
316 }
317 testarrayofsortedstructLength() {
318 const offset = this.bb.__offset(this.bb_pos, 62);
319 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
320 }
321 flex(index) {
322 const offset = this.bb.__offset(this.bb_pos, 64);
323 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
324 }
325 flexLength() {
326 const offset = this.bb.__offset(this.bb_pos, 64);
327 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
328 }
329 flexArray() {
330 const offset = this.bb.__offset(this.bb_pos, 64);
331 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
332 }
333 test5(index, obj) {
334 const offset = this.bb.__offset(this.bb_pos, 66);
335 return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
336 }
337 test5Length() {
338 const offset = this.bb.__offset(this.bb_pos, 66);
339 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
340 }
341 vectorOfLongs(index) {
342 const offset = this.bb.__offset(this.bb_pos, 68);
343 return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
344 }
345 vectorOfLongsLength() {
346 const offset = this.bb.__offset(this.bb_pos, 68);
347 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
348 }
349 vectorOfDoubles(index) {
350 const offset = this.bb.__offset(this.bb_pos, 70);
351 return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
352 }
353 vectorOfDoublesLength() {
354 const offset = this.bb.__offset(this.bb_pos, 70);
355 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
356 }
357 vectorOfDoublesArray() {
358 const offset = this.bb.__offset(this.bb_pos, 70);
359 return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
360 }
361 parentNamespaceTest(obj) {
362 const offset = this.bb.__offset(this.bb_pos, 72);
363 return offset ? (obj || new InParentNamespace()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
364 }
365 vectorOfReferrables(index, obj) {
366 const offset = this.bb.__offset(this.bb_pos, 74);
367 return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
368 }
369 vectorOfReferrablesLength() {
370 const offset = this.bb.__offset(this.bb_pos, 74);
371 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
372 }
373 singleWeakReference() {
374 const offset = this.bb.__offset(this.bb_pos, 76);
375 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
376 }
377 mutate_single_weak_reference(value) {
378 const offset = this.bb.__offset(this.bb_pos, 76);
379 if (offset === 0) {
380 return false;
381 }
382 this.bb.writeUint64(this.bb_pos + offset, value);
383 return true;
384 }
385 vectorOfWeakReferences(index) {
386 const offset = this.bb.__offset(this.bb_pos, 78);
387 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
388 }
389 vectorOfWeakReferencesLength() {
390 const offset = this.bb.__offset(this.bb_pos, 78);
391 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
392 }
393 vectorOfStrongReferrables(index, obj) {
394 const offset = this.bb.__offset(this.bb_pos, 80);
395 return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
396 }
397 vectorOfStrongReferrablesLength() {
398 const offset = this.bb.__offset(this.bb_pos, 80);
399 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
400 }
401 coOwningReference() {
402 const offset = this.bb.__offset(this.bb_pos, 82);
403 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
404 }
405 mutate_co_owning_reference(value) {
406 const offset = this.bb.__offset(this.bb_pos, 82);
407 if (offset === 0) {
408 return false;
409 }
410 this.bb.writeUint64(this.bb_pos + offset, value);
411 return true;
412 }
413 vectorOfCoOwningReferences(index) {
414 const offset = this.bb.__offset(this.bb_pos, 84);
415 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
416 }
417 vectorOfCoOwningReferencesLength() {
418 const offset = this.bb.__offset(this.bb_pos, 84);
419 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
420 }
421 nonOwningReference() {
422 const offset = this.bb.__offset(this.bb_pos, 86);
423 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
424 }
425 mutate_non_owning_reference(value) {
426 const offset = this.bb.__offset(this.bb_pos, 86);
427 if (offset === 0) {
428 return false;
429 }
430 this.bb.writeUint64(this.bb_pos + offset, value);
431 return true;
432 }
433 vectorOfNonOwningReferences(index) {
434 const offset = this.bb.__offset(this.bb_pos, 88);
435 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
436 }
437 vectorOfNonOwningReferencesLength() {
438 const offset = this.bb.__offset(this.bb_pos, 88);
439 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
440 }
441 anyUniqueType() {
442 const offset = this.bb.__offset(this.bb_pos, 90);
443 return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyUniqueAliases.NONE;
444 }
445 anyUnique(obj) {
446 const offset = this.bb.__offset(this.bb_pos, 92);
447 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
448 }
449 anyAmbiguousType() {
450 const offset = this.bb.__offset(this.bb_pos, 94);
451 return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyAmbiguousAliases.NONE;
452 }
453 anyAmbiguous(obj) {
454 const offset = this.bb.__offset(this.bb_pos, 96);
455 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
456 }
457 vectorOfEnums(index) {
458 const offset = this.bb.__offset(this.bb_pos, 98);
459 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
460 }
461 vectorOfEnumsLength() {
462 const offset = this.bb.__offset(this.bb_pos, 98);
463 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
464 }
465 vectorOfEnumsArray() {
466 const offset = this.bb.__offset(this.bb_pos, 98);
467 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
468 }
469 signedEnum() {
470 const offset = this.bb.__offset(this.bb_pos, 100);
471 return offset ? this.bb.readInt8(this.bb_pos + offset) : Race.None;
472 }
473 mutate_signed_enum(value) {
474 const offset = this.bb.__offset(this.bb_pos, 100);
475 if (offset === 0) {
476 return false;
477 }
478 this.bb.writeInt8(this.bb_pos + offset, value);
479 return true;
480 }
481 testrequirednestedflatbuffer(index) {
482 const offset = this.bb.__offset(this.bb_pos, 102);
483 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
484 }
485 testrequirednestedflatbufferLength() {
486 const offset = this.bb.__offset(this.bb_pos, 102);
487 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
488 }
489 testrequirednestedflatbufferArray() {
490 const offset = this.bb.__offset(this.bb_pos, 102);
491 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
492 }
493 scalarKeySortedTables(index, obj) {
494 const offset = this.bb.__offset(this.bb_pos, 104);
495 return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
496 }
497 scalarKeySortedTablesLength() {
498 const offset = this.bb.__offset(this.bb_pos, 104);
499 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
500 }
501 nativeInline(obj) {
502 const offset = this.bb.__offset(this.bb_pos, 106);
503 return offset ? (obj || new Test()).__init(this.bb_pos + offset, this.bb) : null;
504 }
505 longEnumNonEnumDefault() {
506 const offset = this.bb.__offset(this.bb_pos, 108);
507 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
508 }
509 mutate_long_enum_non_enum_default(value) {
510 const offset = this.bb.__offset(this.bb_pos, 108);
511 if (offset === 0) {
512 return false;
513 }
514 this.bb.writeUint64(this.bb_pos + offset, value);
515 return true;
516 }
517 longEnumNormalDefault() {
518 const offset = this.bb.__offset(this.bb_pos, 110);
519 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('2');
520 }
521 mutate_long_enum_normal_default(value) {
522 const offset = this.bb.__offset(this.bb_pos, 110);
523 if (offset === 0) {
524 return false;
525 }
526 this.bb.writeUint64(this.bb_pos + offset, value);
527 return true;
528 }
James Kuszmaul3b15b0c2022-11-08 14:03:16 -0800529 nanDefault() {
530 const offset = this.bb.__offset(this.bb_pos, 112);
531 return offset ? this.bb.readFloat32(this.bb_pos + offset) : NaN;
532 }
533 mutate_nan_default(value) {
534 const offset = this.bb.__offset(this.bb_pos, 112);
535 if (offset === 0) {
536 return false;
537 }
538 this.bb.writeFloat32(this.bb_pos + offset, value);
539 return true;
540 }
541 infDefault() {
542 const offset = this.bb.__offset(this.bb_pos, 114);
543 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
544 }
545 mutate_inf_default(value) {
546 const offset = this.bb.__offset(this.bb_pos, 114);
547 if (offset === 0) {
548 return false;
549 }
550 this.bb.writeFloat32(this.bb_pos + offset, value);
551 return true;
552 }
553 positiveInfDefault() {
554 const offset = this.bb.__offset(this.bb_pos, 116);
555 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
556 }
557 mutate_positive_inf_default(value) {
558 const offset = this.bb.__offset(this.bb_pos, 116);
559 if (offset === 0) {
560 return false;
561 }
562 this.bb.writeFloat32(this.bb_pos + offset, value);
563 return true;
564 }
565 infinityDefault() {
566 const offset = this.bb.__offset(this.bb_pos, 118);
567 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
568 }
569 mutate_infinity_default(value) {
570 const offset = this.bb.__offset(this.bb_pos, 118);
571 if (offset === 0) {
572 return false;
573 }
574 this.bb.writeFloat32(this.bb_pos + offset, value);
575 return true;
576 }
577 positiveInfinityDefault() {
578 const offset = this.bb.__offset(this.bb_pos, 120);
579 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
580 }
581 mutate_positive_infinity_default(value) {
582 const offset = this.bb.__offset(this.bb_pos, 120);
583 if (offset === 0) {
584 return false;
585 }
586 this.bb.writeFloat32(this.bb_pos + offset, value);
587 return true;
588 }
589 negativeInfDefault() {
590 const offset = this.bb.__offset(this.bb_pos, 122);
591 return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
592 }
593 mutate_negative_inf_default(value) {
594 const offset = this.bb.__offset(this.bb_pos, 122);
595 if (offset === 0) {
596 return false;
597 }
598 this.bb.writeFloat32(this.bb_pos + offset, value);
599 return true;
600 }
601 negativeInfinityDefault() {
602 const offset = this.bb.__offset(this.bb_pos, 124);
603 return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
604 }
605 mutate_negative_infinity_default(value) {
606 const offset = this.bb.__offset(this.bb_pos, 124);
607 if (offset === 0) {
608 return false;
609 }
610 this.bb.writeFloat32(this.bb_pos + offset, value);
611 return true;
612 }
Austin Schuh2dd86a92022-09-14 21:19:23 -0700613 static getFullyQualifiedName() {
614 return 'MyGame_Example_Monster';
615 }
616 static startMonster(builder) {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -0800617 builder.startObject(61);
Austin Schuh2dd86a92022-09-14 21:19:23 -0700618 }
619 static addPos(builder, posOffset) {
620 builder.addFieldStruct(0, posOffset, 0);
621 }
622 static addMana(builder, mana) {
623 builder.addFieldInt16(1, mana, 150);
624 }
625 static addHp(builder, hp) {
626 builder.addFieldInt16(2, hp, 100);
627 }
628 static addName(builder, nameOffset) {
629 builder.addFieldOffset(3, nameOffset, 0);
630 }
631 static addInventory(builder, inventoryOffset) {
632 builder.addFieldOffset(5, inventoryOffset, 0);
633 }
634 static createInventoryVector(builder, data) {
635 builder.startVector(1, data.length, 1);
636 for (let i = data.length - 1; i >= 0; i--) {
637 builder.addInt8(data[i]);
638 }
639 return builder.endVector();
640 }
641 static startInventoryVector(builder, numElems) {
642 builder.startVector(1, numElems, 1);
643 }
644 static addColor(builder, color) {
645 builder.addFieldInt8(6, color, Color.Blue);
646 }
647 static addTestType(builder, testType) {
648 builder.addFieldInt8(7, testType, Any.NONE);
649 }
650 static addTest(builder, testOffset) {
651 builder.addFieldOffset(8, testOffset, 0);
652 }
653 static addTest4(builder, test4Offset) {
654 builder.addFieldOffset(9, test4Offset, 0);
655 }
656 static startTest4Vector(builder, numElems) {
657 builder.startVector(4, numElems, 2);
658 }
659 static addTestarrayofstring(builder, testarrayofstringOffset) {
660 builder.addFieldOffset(10, testarrayofstringOffset, 0);
661 }
662 static createTestarrayofstringVector(builder, data) {
663 builder.startVector(4, data.length, 4);
664 for (let i = data.length - 1; i >= 0; i--) {
665 builder.addOffset(data[i]);
666 }
667 return builder.endVector();
668 }
669 static startTestarrayofstringVector(builder, numElems) {
670 builder.startVector(4, numElems, 4);
671 }
672 static addTestarrayoftables(builder, testarrayoftablesOffset) {
673 builder.addFieldOffset(11, testarrayoftablesOffset, 0);
674 }
675 static createTestarrayoftablesVector(builder, data) {
676 builder.startVector(4, data.length, 4);
677 for (let i = data.length - 1; i >= 0; i--) {
678 builder.addOffset(data[i]);
679 }
680 return builder.endVector();
681 }
682 static startTestarrayoftablesVector(builder, numElems) {
683 builder.startVector(4, numElems, 4);
684 }
685 static addEnemy(builder, enemyOffset) {
686 builder.addFieldOffset(12, enemyOffset, 0);
687 }
688 static addTestnestedflatbuffer(builder, testnestedflatbufferOffset) {
689 builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
690 }
691 static createTestnestedflatbufferVector(builder, data) {
692 builder.startVector(1, data.length, 1);
693 for (let i = data.length - 1; i >= 0; i--) {
694 builder.addInt8(data[i]);
695 }
696 return builder.endVector();
697 }
698 static startTestnestedflatbufferVector(builder, numElems) {
699 builder.startVector(1, numElems, 1);
700 }
701 static addTestempty(builder, testemptyOffset) {
702 builder.addFieldOffset(14, testemptyOffset, 0);
703 }
704 static addTestbool(builder, testbool) {
705 builder.addFieldInt8(15, +testbool, +false);
706 }
707 static addTesthashs32Fnv1(builder, testhashs32Fnv1) {
708 builder.addFieldInt32(16, testhashs32Fnv1, 0);
709 }
710 static addTesthashu32Fnv1(builder, testhashu32Fnv1) {
711 builder.addFieldInt32(17, testhashu32Fnv1, 0);
712 }
713 static addTesthashs64Fnv1(builder, testhashs64Fnv1) {
714 builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
715 }
716 static addTesthashu64Fnv1(builder, testhashu64Fnv1) {
717 builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
718 }
719 static addTesthashs32Fnv1a(builder, testhashs32Fnv1a) {
720 builder.addFieldInt32(20, testhashs32Fnv1a, 0);
721 }
722 static addTesthashu32Fnv1a(builder, testhashu32Fnv1a) {
723 builder.addFieldInt32(21, testhashu32Fnv1a, 0);
724 }
725 static addTesthashs64Fnv1a(builder, testhashs64Fnv1a) {
726 builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
727 }
728 static addTesthashu64Fnv1a(builder, testhashu64Fnv1a) {
729 builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
730 }
731 static addTestarrayofbools(builder, testarrayofboolsOffset) {
732 builder.addFieldOffset(24, testarrayofboolsOffset, 0);
733 }
734 static createTestarrayofboolsVector(builder, data) {
735 builder.startVector(1, data.length, 1);
736 for (let i = data.length - 1; i >= 0; i--) {
737 builder.addInt8(+data[i]);
738 }
739 return builder.endVector();
740 }
741 static startTestarrayofboolsVector(builder, numElems) {
742 builder.startVector(1, numElems, 1);
743 }
744 static addTestf(builder, testf) {
745 builder.addFieldFloat32(25, testf, 3.14159);
746 }
747 static addTestf2(builder, testf2) {
748 builder.addFieldFloat32(26, testf2, 3.0);
749 }
750 static addTestf3(builder, testf3) {
751 builder.addFieldFloat32(27, testf3, 0.0);
752 }
753 static addTestarrayofstring2(builder, testarrayofstring2Offset) {
754 builder.addFieldOffset(28, testarrayofstring2Offset, 0);
755 }
756 static createTestarrayofstring2Vector(builder, data) {
757 builder.startVector(4, data.length, 4);
758 for (let i = data.length - 1; i >= 0; i--) {
759 builder.addOffset(data[i]);
760 }
761 return builder.endVector();
762 }
763 static startTestarrayofstring2Vector(builder, numElems) {
764 builder.startVector(4, numElems, 4);
765 }
766 static addTestarrayofsortedstruct(builder, testarrayofsortedstructOffset) {
767 builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
768 }
769 static startTestarrayofsortedstructVector(builder, numElems) {
770 builder.startVector(8, numElems, 4);
771 }
772 static addFlex(builder, flexOffset) {
773 builder.addFieldOffset(30, flexOffset, 0);
774 }
775 static createFlexVector(builder, data) {
776 builder.startVector(1, data.length, 1);
777 for (let i = data.length - 1; i >= 0; i--) {
778 builder.addInt8(data[i]);
779 }
780 return builder.endVector();
781 }
782 static startFlexVector(builder, numElems) {
783 builder.startVector(1, numElems, 1);
784 }
785 static addTest5(builder, test5Offset) {
786 builder.addFieldOffset(31, test5Offset, 0);
787 }
788 static startTest5Vector(builder, numElems) {
789 builder.startVector(4, numElems, 2);
790 }
791 static addVectorOfLongs(builder, vectorOfLongsOffset) {
792 builder.addFieldOffset(32, vectorOfLongsOffset, 0);
793 }
794 static createVectorOfLongsVector(builder, data) {
795 builder.startVector(8, data.length, 8);
796 for (let i = data.length - 1; i >= 0; i--) {
797 builder.addInt64(data[i]);
798 }
799 return builder.endVector();
800 }
801 static startVectorOfLongsVector(builder, numElems) {
802 builder.startVector(8, numElems, 8);
803 }
804 static addVectorOfDoubles(builder, vectorOfDoublesOffset) {
805 builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
806 }
807 static createVectorOfDoublesVector(builder, data) {
808 builder.startVector(8, data.length, 8);
809 for (let i = data.length - 1; i >= 0; i--) {
810 builder.addFloat64(data[i]);
811 }
812 return builder.endVector();
813 }
814 static startVectorOfDoublesVector(builder, numElems) {
815 builder.startVector(8, numElems, 8);
816 }
817 static addParentNamespaceTest(builder, parentNamespaceTestOffset) {
818 builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
819 }
820 static addVectorOfReferrables(builder, vectorOfReferrablesOffset) {
821 builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
822 }
823 static createVectorOfReferrablesVector(builder, data) {
824 builder.startVector(4, data.length, 4);
825 for (let i = data.length - 1; i >= 0; i--) {
826 builder.addOffset(data[i]);
827 }
828 return builder.endVector();
829 }
830 static startVectorOfReferrablesVector(builder, numElems) {
831 builder.startVector(4, numElems, 4);
832 }
833 static addSingleWeakReference(builder, singleWeakReference) {
834 builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
835 }
836 static addVectorOfWeakReferences(builder, vectorOfWeakReferencesOffset) {
837 builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
838 }
839 static createVectorOfWeakReferencesVector(builder, data) {
840 builder.startVector(8, data.length, 8);
841 for (let i = data.length - 1; i >= 0; i--) {
842 builder.addInt64(data[i]);
843 }
844 return builder.endVector();
845 }
846 static startVectorOfWeakReferencesVector(builder, numElems) {
847 builder.startVector(8, numElems, 8);
848 }
849 static addVectorOfStrongReferrables(builder, vectorOfStrongReferrablesOffset) {
850 builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
851 }
852 static createVectorOfStrongReferrablesVector(builder, data) {
853 builder.startVector(4, data.length, 4);
854 for (let i = data.length - 1; i >= 0; i--) {
855 builder.addOffset(data[i]);
856 }
857 return builder.endVector();
858 }
859 static startVectorOfStrongReferrablesVector(builder, numElems) {
860 builder.startVector(4, numElems, 4);
861 }
862 static addCoOwningReference(builder, coOwningReference) {
863 builder.addFieldInt64(39, coOwningReference, BigInt('0'));
864 }
865 static addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferencesOffset) {
866 builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
867 }
868 static createVectorOfCoOwningReferencesVector(builder, data) {
869 builder.startVector(8, data.length, 8);
870 for (let i = data.length - 1; i >= 0; i--) {
871 builder.addInt64(data[i]);
872 }
873 return builder.endVector();
874 }
875 static startVectorOfCoOwningReferencesVector(builder, numElems) {
876 builder.startVector(8, numElems, 8);
877 }
878 static addNonOwningReference(builder, nonOwningReference) {
879 builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
880 }
881 static addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferencesOffset) {
882 builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
883 }
884 static createVectorOfNonOwningReferencesVector(builder, data) {
885 builder.startVector(8, data.length, 8);
886 for (let i = data.length - 1; i >= 0; i--) {
887 builder.addInt64(data[i]);
888 }
889 return builder.endVector();
890 }
891 static startVectorOfNonOwningReferencesVector(builder, numElems) {
892 builder.startVector(8, numElems, 8);
893 }
894 static addAnyUniqueType(builder, anyUniqueType) {
895 builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE);
896 }
897 static addAnyUnique(builder, anyUniqueOffset) {
898 builder.addFieldOffset(44, anyUniqueOffset, 0);
899 }
900 static addAnyAmbiguousType(builder, anyAmbiguousType) {
901 builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE);
902 }
903 static addAnyAmbiguous(builder, anyAmbiguousOffset) {
904 builder.addFieldOffset(46, anyAmbiguousOffset, 0);
905 }
906 static addVectorOfEnums(builder, vectorOfEnumsOffset) {
907 builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
908 }
909 static createVectorOfEnumsVector(builder, data) {
910 builder.startVector(1, data.length, 1);
911 for (let i = data.length - 1; i >= 0; i--) {
912 builder.addInt8(data[i]);
913 }
914 return builder.endVector();
915 }
916 static startVectorOfEnumsVector(builder, numElems) {
917 builder.startVector(1, numElems, 1);
918 }
919 static addSignedEnum(builder, signedEnum) {
920 builder.addFieldInt8(48, signedEnum, Race.None);
921 }
922 static addTestrequirednestedflatbuffer(builder, testrequirednestedflatbufferOffset) {
923 builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
924 }
925 static createTestrequirednestedflatbufferVector(builder, data) {
926 builder.startVector(1, data.length, 1);
927 for (let i = data.length - 1; i >= 0; i--) {
928 builder.addInt8(data[i]);
929 }
930 return builder.endVector();
931 }
932 static startTestrequirednestedflatbufferVector(builder, numElems) {
933 builder.startVector(1, numElems, 1);
934 }
935 static addScalarKeySortedTables(builder, scalarKeySortedTablesOffset) {
936 builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
937 }
938 static createScalarKeySortedTablesVector(builder, data) {
939 builder.startVector(4, data.length, 4);
940 for (let i = data.length - 1; i >= 0; i--) {
941 builder.addOffset(data[i]);
942 }
943 return builder.endVector();
944 }
945 static startScalarKeySortedTablesVector(builder, numElems) {
946 builder.startVector(4, numElems, 4);
947 }
948 static addNativeInline(builder, nativeInlineOffset) {
949 builder.addFieldStruct(51, nativeInlineOffset, 0);
950 }
951 static addLongEnumNonEnumDefault(builder, longEnumNonEnumDefault) {
952 builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0'));
953 }
954 static addLongEnumNormalDefault(builder, longEnumNormalDefault) {
955 builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
956 }
James Kuszmaul3b15b0c2022-11-08 14:03:16 -0800957 static addNanDefault(builder, nanDefault) {
958 builder.addFieldFloat32(54, nanDefault, NaN);
959 }
960 static addInfDefault(builder, infDefault) {
961 builder.addFieldFloat32(55, infDefault, Infinity);
962 }
963 static addPositiveInfDefault(builder, positiveInfDefault) {
964 builder.addFieldFloat32(56, positiveInfDefault, Infinity);
965 }
966 static addInfinityDefault(builder, infinityDefault) {
967 builder.addFieldFloat32(57, infinityDefault, Infinity);
968 }
969 static addPositiveInfinityDefault(builder, positiveInfinityDefault) {
970 builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
971 }
972 static addNegativeInfDefault(builder, negativeInfDefault) {
973 builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
974 }
975 static addNegativeInfinityDefault(builder, negativeInfinityDefault) {
976 builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
977 }
Austin Schuh2dd86a92022-09-14 21:19:23 -0700978 static endMonster(builder) {
979 const offset = builder.endObject();
980 builder.requiredField(offset, 10); // name
981 return offset;
982 }
983 static finishMonsterBuffer(builder, offset) {
984 builder.finish(offset, 'MONS');
985 }
986 static finishSizePrefixedMonsterBuffer(builder, offset) {
987 builder.finish(offset, 'MONS', true);
988 }
989 serialize() {
990 return this.bb.bytes();
991 }
992 static deserialize(buffer) {
993 return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer));
994 }
995 unpack() {
996 return new MonsterT((this.pos() !== null ? this.pos().unpack() : null), this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -0800997 const temp = unionToAny(this.testType(), this.test.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -0700998 if (temp === null) {
999 return null;
1000 }
1001 return temp.unpack();
1002 })(), this.bb.createObjList(this.test4.bind(this), this.test4Length()), this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), (this.enemy() !== null ? this.enemy().unpack() : null), this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), (this.testempty() !== null ? this.testempty().unpack() : null), this.testbool(), this.testhashs32Fnv1(), this.testhashu32Fnv1(), this.testhashs64Fnv1(), this.testhashu64Fnv1(), this.testhashs32Fnv1a(), this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), this.bb.createScalarList(this.flex.bind(this), this.flexLength()), this.bb.createObjList(this.test5.bind(this), this.test5Length()), this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null), this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001003 const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -07001004 if (temp === null) {
1005 return null;
1006 }
1007 return temp.unpack();
1008 })(), this.anyAmbiguousType(), (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001009 const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -07001010 if (temp === null) {
1011 return null;
1012 }
1013 return temp.unpack();
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001014 })(), this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), (this.nativeInline() !== null ? this.nativeInline().unpack() : null), this.longEnumNonEnumDefault(), this.longEnumNormalDefault(), this.nanDefault(), this.infDefault(), this.positiveInfDefault(), this.infinityDefault(), this.positiveInfinityDefault(), this.negativeInfDefault(), this.negativeInfinityDefault());
Austin Schuh2dd86a92022-09-14 21:19:23 -07001015 }
1016 unpackTo(_o) {
1017 _o.pos = (this.pos() !== null ? this.pos().unpack() : null);
1018 _o.mana = this.mana();
1019 _o.hp = this.hp();
1020 _o.name = this.name();
1021 _o.inventory = this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength());
1022 _o.color = this.color();
1023 _o.testType = this.testType();
1024 _o.test = (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001025 const temp = unionToAny(this.testType(), this.test.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -07001026 if (temp === null) {
1027 return null;
1028 }
1029 return temp.unpack();
1030 })();
1031 _o.test4 = this.bb.createObjList(this.test4.bind(this), this.test4Length());
1032 _o.testarrayofstring = this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength());
1033 _o.testarrayoftables = this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
1034 _o.enemy = (this.enemy() !== null ? this.enemy().unpack() : null);
1035 _o.testnestedflatbuffer = this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
1036 _o.testempty = (this.testempty() !== null ? this.testempty().unpack() : null);
1037 _o.testbool = this.testbool();
1038 _o.testhashs32Fnv1 = this.testhashs32Fnv1();
1039 _o.testhashu32Fnv1 = this.testhashu32Fnv1();
1040 _o.testhashs64Fnv1 = this.testhashs64Fnv1();
1041 _o.testhashu64Fnv1 = this.testhashu64Fnv1();
1042 _o.testhashs32Fnv1a = this.testhashs32Fnv1a();
1043 _o.testhashu32Fnv1a = this.testhashu32Fnv1a();
1044 _o.testhashs64Fnv1a = this.testhashs64Fnv1a();
1045 _o.testhashu64Fnv1a = this.testhashu64Fnv1a();
1046 _o.testarrayofbools = this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
1047 _o.testf = this.testf();
1048 _o.testf2 = this.testf2();
1049 _o.testf3 = this.testf3();
1050 _o.testarrayofstring2 = this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
1051 _o.testarrayofsortedstruct = this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
1052 _o.flex = this.bb.createScalarList(this.flex.bind(this), this.flexLength());
1053 _o.test5 = this.bb.createObjList(this.test5.bind(this), this.test5Length());
1054 _o.vectorOfLongs = this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
1055 _o.vectorOfDoubles = this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
1056 _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null);
1057 _o.vectorOfReferrables = this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
1058 _o.singleWeakReference = this.singleWeakReference();
1059 _o.vectorOfWeakReferences = this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
1060 _o.vectorOfStrongReferrables = this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
1061 _o.coOwningReference = this.coOwningReference();
1062 _o.vectorOfCoOwningReferences = this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
1063 _o.nonOwningReference = this.nonOwningReference();
1064 _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
1065 _o.anyUniqueType = this.anyUniqueType();
1066 _o.anyUnique = (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001067 const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -07001068 if (temp === null) {
1069 return null;
1070 }
1071 return temp.unpack();
1072 })();
1073 _o.anyAmbiguousType = this.anyAmbiguousType();
1074 _o.anyAmbiguous = (() => {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001075 const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
Austin Schuh2dd86a92022-09-14 21:19:23 -07001076 if (temp === null) {
1077 return null;
1078 }
1079 return temp.unpack();
1080 })();
1081 _o.vectorOfEnums = this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
1082 _o.signedEnum = this.signedEnum();
1083 _o.testrequirednestedflatbuffer = this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
1084 _o.scalarKeySortedTables = this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
1085 _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline().unpack() : null);
1086 _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
1087 _o.longEnumNormalDefault = this.longEnumNormalDefault();
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001088 _o.nanDefault = this.nanDefault();
1089 _o.infDefault = this.infDefault();
1090 _o.positiveInfDefault = this.positiveInfDefault();
1091 _o.infinityDefault = this.infinityDefault();
1092 _o.positiveInfinityDefault = this.positiveInfinityDefault();
1093 _o.negativeInfDefault = this.negativeInfDefault();
1094 _o.negativeInfinityDefault = this.negativeInfinityDefault();
Austin Schuh2dd86a92022-09-14 21:19:23 -07001095 }
1096}
1097export class MonsterT {
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001098 constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt('0'), testhashu64Fnv1 = BigInt('0'), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt('0'), testhashu64Fnv1a = BigInt('0'), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt('0'), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt('0'), vectorOfCoOwningReferences = [], nonOwningReference = BigInt('0'), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = [], nativeInline = null, longEnumNonEnumDefault = BigInt('0'), longEnumNormalDefault = BigInt('2'), nanDefault = NaN, infDefault = Infinity, positiveInfDefault = Infinity, infinityDefault = Infinity, positiveInfinityDefault = Infinity, negativeInfDefault = -Infinity, negativeInfinityDefault = -Infinity) {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001099 this.pos = pos;
1100 this.mana = mana;
1101 this.hp = hp;
1102 this.name = name;
1103 this.inventory = inventory;
1104 this.color = color;
1105 this.testType = testType;
1106 this.test = test;
1107 this.test4 = test4;
1108 this.testarrayofstring = testarrayofstring;
1109 this.testarrayoftables = testarrayoftables;
1110 this.enemy = enemy;
1111 this.testnestedflatbuffer = testnestedflatbuffer;
1112 this.testempty = testempty;
1113 this.testbool = testbool;
1114 this.testhashs32Fnv1 = testhashs32Fnv1;
1115 this.testhashu32Fnv1 = testhashu32Fnv1;
1116 this.testhashs64Fnv1 = testhashs64Fnv1;
1117 this.testhashu64Fnv1 = testhashu64Fnv1;
1118 this.testhashs32Fnv1a = testhashs32Fnv1a;
1119 this.testhashu32Fnv1a = testhashu32Fnv1a;
1120 this.testhashs64Fnv1a = testhashs64Fnv1a;
1121 this.testhashu64Fnv1a = testhashu64Fnv1a;
1122 this.testarrayofbools = testarrayofbools;
1123 this.testf = testf;
1124 this.testf2 = testf2;
1125 this.testf3 = testf3;
1126 this.testarrayofstring2 = testarrayofstring2;
1127 this.testarrayofsortedstruct = testarrayofsortedstruct;
1128 this.flex = flex;
1129 this.test5 = test5;
1130 this.vectorOfLongs = vectorOfLongs;
1131 this.vectorOfDoubles = vectorOfDoubles;
1132 this.parentNamespaceTest = parentNamespaceTest;
1133 this.vectorOfReferrables = vectorOfReferrables;
1134 this.singleWeakReference = singleWeakReference;
1135 this.vectorOfWeakReferences = vectorOfWeakReferences;
1136 this.vectorOfStrongReferrables = vectorOfStrongReferrables;
1137 this.coOwningReference = coOwningReference;
1138 this.vectorOfCoOwningReferences = vectorOfCoOwningReferences;
1139 this.nonOwningReference = nonOwningReference;
1140 this.vectorOfNonOwningReferences = vectorOfNonOwningReferences;
1141 this.anyUniqueType = anyUniqueType;
1142 this.anyUnique = anyUnique;
1143 this.anyAmbiguousType = anyAmbiguousType;
1144 this.anyAmbiguous = anyAmbiguous;
1145 this.vectorOfEnums = vectorOfEnums;
1146 this.signedEnum = signedEnum;
1147 this.testrequirednestedflatbuffer = testrequirednestedflatbuffer;
1148 this.scalarKeySortedTables = scalarKeySortedTables;
1149 this.nativeInline = nativeInline;
1150 this.longEnumNonEnumDefault = longEnumNonEnumDefault;
1151 this.longEnumNormalDefault = longEnumNormalDefault;
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001152 this.nanDefault = nanDefault;
1153 this.infDefault = infDefault;
1154 this.positiveInfDefault = positiveInfDefault;
1155 this.infinityDefault = infinityDefault;
1156 this.positiveInfinityDefault = positiveInfinityDefault;
1157 this.negativeInfDefault = negativeInfDefault;
1158 this.negativeInfinityDefault = negativeInfinityDefault;
Austin Schuh2dd86a92022-09-14 21:19:23 -07001159 }
1160 pack(builder) {
1161 const name = (this.name !== null ? builder.createString(this.name) : 0);
1162 const inventory = Monster.createInventoryVector(builder, this.inventory);
1163 const test = builder.createObjectOffset(this.test);
1164 const test4 = builder.createStructOffsetList(this.test4, Monster.startTest4Vector);
1165 const testarrayofstring = Monster.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring));
1166 const testarrayoftables = Monster.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables));
1167 const enemy = (this.enemy !== null ? this.enemy.pack(builder) : 0);
1168 const testnestedflatbuffer = Monster.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer);
1169 const testempty = (this.testempty !== null ? this.testempty.pack(builder) : 0);
1170 const testarrayofbools = Monster.createTestarrayofboolsVector(builder, this.testarrayofbools);
1171 const testarrayofstring2 = Monster.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2));
1172 const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster.startTestarrayofsortedstructVector);
1173 const flex = Monster.createFlexVector(builder, this.flex);
1174 const test5 = builder.createStructOffsetList(this.test5, Monster.startTest5Vector);
1175 const vectorOfLongs = Monster.createVectorOfLongsVector(builder, this.vectorOfLongs);
1176 const vectorOfDoubles = Monster.createVectorOfDoublesVector(builder, this.vectorOfDoubles);
1177 const parentNamespaceTest = (this.parentNamespaceTest !== null ? this.parentNamespaceTest.pack(builder) : 0);
1178 const vectorOfReferrables = Monster.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables));
1179 const vectorOfWeakReferences = Monster.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences);
1180 const vectorOfStrongReferrables = Monster.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables));
1181 const vectorOfCoOwningReferences = Monster.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences);
1182 const vectorOfNonOwningReferences = Monster.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences);
1183 const anyUnique = builder.createObjectOffset(this.anyUnique);
1184 const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous);
1185 const vectorOfEnums = Monster.createVectorOfEnumsVector(builder, this.vectorOfEnums);
1186 const testrequirednestedflatbuffer = Monster.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer);
1187 const scalarKeySortedTables = Monster.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables));
1188 Monster.startMonster(builder);
1189 Monster.addPos(builder, (this.pos !== null ? this.pos.pack(builder) : 0));
1190 Monster.addMana(builder, this.mana);
1191 Monster.addHp(builder, this.hp);
1192 Monster.addName(builder, name);
1193 Monster.addInventory(builder, inventory);
1194 Monster.addColor(builder, this.color);
1195 Monster.addTestType(builder, this.testType);
1196 Monster.addTest(builder, test);
1197 Monster.addTest4(builder, test4);
1198 Monster.addTestarrayofstring(builder, testarrayofstring);
1199 Monster.addTestarrayoftables(builder, testarrayoftables);
1200 Monster.addEnemy(builder, enemy);
1201 Monster.addTestnestedflatbuffer(builder, testnestedflatbuffer);
1202 Monster.addTestempty(builder, testempty);
1203 Monster.addTestbool(builder, this.testbool);
1204 Monster.addTesthashs32Fnv1(builder, this.testhashs32Fnv1);
1205 Monster.addTesthashu32Fnv1(builder, this.testhashu32Fnv1);
1206 Monster.addTesthashs64Fnv1(builder, this.testhashs64Fnv1);
1207 Monster.addTesthashu64Fnv1(builder, this.testhashu64Fnv1);
1208 Monster.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a);
1209 Monster.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a);
1210 Monster.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a);
1211 Monster.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a);
1212 Monster.addTestarrayofbools(builder, testarrayofbools);
1213 Monster.addTestf(builder, this.testf);
1214 Monster.addTestf2(builder, this.testf2);
1215 Monster.addTestf3(builder, this.testf3);
1216 Monster.addTestarrayofstring2(builder, testarrayofstring2);
1217 Monster.addTestarrayofsortedstruct(builder, testarrayofsortedstruct);
1218 Monster.addFlex(builder, flex);
1219 Monster.addTest5(builder, test5);
1220 Monster.addVectorOfLongs(builder, vectorOfLongs);
1221 Monster.addVectorOfDoubles(builder, vectorOfDoubles);
1222 Monster.addParentNamespaceTest(builder, parentNamespaceTest);
1223 Monster.addVectorOfReferrables(builder, vectorOfReferrables);
1224 Monster.addSingleWeakReference(builder, this.singleWeakReference);
1225 Monster.addVectorOfWeakReferences(builder, vectorOfWeakReferences);
1226 Monster.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables);
1227 Monster.addCoOwningReference(builder, this.coOwningReference);
1228 Monster.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences);
1229 Monster.addNonOwningReference(builder, this.nonOwningReference);
1230 Monster.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences);
1231 Monster.addAnyUniqueType(builder, this.anyUniqueType);
1232 Monster.addAnyUnique(builder, anyUnique);
1233 Monster.addAnyAmbiguousType(builder, this.anyAmbiguousType);
1234 Monster.addAnyAmbiguous(builder, anyAmbiguous);
1235 Monster.addVectorOfEnums(builder, vectorOfEnums);
1236 Monster.addSignedEnum(builder, this.signedEnum);
1237 Monster.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer);
1238 Monster.addScalarKeySortedTables(builder, scalarKeySortedTables);
1239 Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline.pack(builder) : 0));
1240 Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
1241 Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
James Kuszmaul3b15b0c2022-11-08 14:03:16 -08001242 Monster.addNanDefault(builder, this.nanDefault);
1243 Monster.addInfDefault(builder, this.infDefault);
1244 Monster.addPositiveInfDefault(builder, this.positiveInfDefault);
1245 Monster.addInfinityDefault(builder, this.infinityDefault);
1246 Monster.addPositiveInfinityDefault(builder, this.positiveInfinityDefault);
1247 Monster.addNegativeInfDefault(builder, this.negativeInfDefault);
1248 Monster.addNegativeInfinityDefault(builder, this.negativeInfinityDefault);
Austin Schuh2dd86a92022-09-14 21:19:23 -07001249 return Monster.endMonster(builder);
1250 }
1251}