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