Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | import * as flatbuffers from 'flatbuffers'; |
| 3 | import { Ability } from '../../my-game/example/ability.js'; |
| 4 | import { Any, unionToAny } from '../../my-game/example/any.js'; |
| 5 | import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js'; |
| 6 | import { AnyUniqueAliases, unionToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases.js'; |
| 7 | import { Color } from '../../my-game/example/color.js'; |
| 8 | import { Race } from '../../my-game/example/race.js'; |
| 9 | import { Referrable } from '../../my-game/example/referrable.js'; |
| 10 | import { Stat } from '../../my-game/example/stat.js'; |
| 11 | import { Test } from '../../my-game/example/test.js'; |
| 12 | import { Vec3 } from '../../my-game/example/vec3.js'; |
| 13 | import { InParentNamespace } from '../../my-game/in-parent-namespace.js'; |
| 14 | /** |
| 15 | * an example documentation comment: "monster object" |
| 16 | */ |
| 17 | export 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 | } |
| 529 | static getFullyQualifiedName() { |
| 530 | return 'MyGame_Example_Monster'; |
| 531 | } |
| 532 | static startMonster(builder) { |
| 533 | builder.startObject(54); |
| 534 | } |
| 535 | static addPos(builder, posOffset) { |
| 536 | builder.addFieldStruct(0, posOffset, 0); |
| 537 | } |
| 538 | static addMana(builder, mana) { |
| 539 | builder.addFieldInt16(1, mana, 150); |
| 540 | } |
| 541 | static addHp(builder, hp) { |
| 542 | builder.addFieldInt16(2, hp, 100); |
| 543 | } |
| 544 | static addName(builder, nameOffset) { |
| 545 | builder.addFieldOffset(3, nameOffset, 0); |
| 546 | } |
| 547 | static addInventory(builder, inventoryOffset) { |
| 548 | builder.addFieldOffset(5, inventoryOffset, 0); |
| 549 | } |
| 550 | static createInventoryVector(builder, data) { |
| 551 | builder.startVector(1, data.length, 1); |
| 552 | for (let i = data.length - 1; i >= 0; i--) { |
| 553 | builder.addInt8(data[i]); |
| 554 | } |
| 555 | return builder.endVector(); |
| 556 | } |
| 557 | static startInventoryVector(builder, numElems) { |
| 558 | builder.startVector(1, numElems, 1); |
| 559 | } |
| 560 | static addColor(builder, color) { |
| 561 | builder.addFieldInt8(6, color, Color.Blue); |
| 562 | } |
| 563 | static addTestType(builder, testType) { |
| 564 | builder.addFieldInt8(7, testType, Any.NONE); |
| 565 | } |
| 566 | static addTest(builder, testOffset) { |
| 567 | builder.addFieldOffset(8, testOffset, 0); |
| 568 | } |
| 569 | static addTest4(builder, test4Offset) { |
| 570 | builder.addFieldOffset(9, test4Offset, 0); |
| 571 | } |
| 572 | static startTest4Vector(builder, numElems) { |
| 573 | builder.startVector(4, numElems, 2); |
| 574 | } |
| 575 | static addTestarrayofstring(builder, testarrayofstringOffset) { |
| 576 | builder.addFieldOffset(10, testarrayofstringOffset, 0); |
| 577 | } |
| 578 | static createTestarrayofstringVector(builder, data) { |
| 579 | builder.startVector(4, data.length, 4); |
| 580 | for (let i = data.length - 1; i >= 0; i--) { |
| 581 | builder.addOffset(data[i]); |
| 582 | } |
| 583 | return builder.endVector(); |
| 584 | } |
| 585 | static startTestarrayofstringVector(builder, numElems) { |
| 586 | builder.startVector(4, numElems, 4); |
| 587 | } |
| 588 | static addTestarrayoftables(builder, testarrayoftablesOffset) { |
| 589 | builder.addFieldOffset(11, testarrayoftablesOffset, 0); |
| 590 | } |
| 591 | static createTestarrayoftablesVector(builder, data) { |
| 592 | builder.startVector(4, data.length, 4); |
| 593 | for (let i = data.length - 1; i >= 0; i--) { |
| 594 | builder.addOffset(data[i]); |
| 595 | } |
| 596 | return builder.endVector(); |
| 597 | } |
| 598 | static startTestarrayoftablesVector(builder, numElems) { |
| 599 | builder.startVector(4, numElems, 4); |
| 600 | } |
| 601 | static addEnemy(builder, enemyOffset) { |
| 602 | builder.addFieldOffset(12, enemyOffset, 0); |
| 603 | } |
| 604 | static addTestnestedflatbuffer(builder, testnestedflatbufferOffset) { |
| 605 | builder.addFieldOffset(13, testnestedflatbufferOffset, 0); |
| 606 | } |
| 607 | static createTestnestedflatbufferVector(builder, data) { |
| 608 | builder.startVector(1, data.length, 1); |
| 609 | for (let i = data.length - 1; i >= 0; i--) { |
| 610 | builder.addInt8(data[i]); |
| 611 | } |
| 612 | return builder.endVector(); |
| 613 | } |
| 614 | static startTestnestedflatbufferVector(builder, numElems) { |
| 615 | builder.startVector(1, numElems, 1); |
| 616 | } |
| 617 | static addTestempty(builder, testemptyOffset) { |
| 618 | builder.addFieldOffset(14, testemptyOffset, 0); |
| 619 | } |
| 620 | static addTestbool(builder, testbool) { |
| 621 | builder.addFieldInt8(15, +testbool, +false); |
| 622 | } |
| 623 | static addTesthashs32Fnv1(builder, testhashs32Fnv1) { |
| 624 | builder.addFieldInt32(16, testhashs32Fnv1, 0); |
| 625 | } |
| 626 | static addTesthashu32Fnv1(builder, testhashu32Fnv1) { |
| 627 | builder.addFieldInt32(17, testhashu32Fnv1, 0); |
| 628 | } |
| 629 | static addTesthashs64Fnv1(builder, testhashs64Fnv1) { |
| 630 | builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0')); |
| 631 | } |
| 632 | static addTesthashu64Fnv1(builder, testhashu64Fnv1) { |
| 633 | builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0')); |
| 634 | } |
| 635 | static addTesthashs32Fnv1a(builder, testhashs32Fnv1a) { |
| 636 | builder.addFieldInt32(20, testhashs32Fnv1a, 0); |
| 637 | } |
| 638 | static addTesthashu32Fnv1a(builder, testhashu32Fnv1a) { |
| 639 | builder.addFieldInt32(21, testhashu32Fnv1a, 0); |
| 640 | } |
| 641 | static addTesthashs64Fnv1a(builder, testhashs64Fnv1a) { |
| 642 | builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0')); |
| 643 | } |
| 644 | static addTesthashu64Fnv1a(builder, testhashu64Fnv1a) { |
| 645 | builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0')); |
| 646 | } |
| 647 | static addTestarrayofbools(builder, testarrayofboolsOffset) { |
| 648 | builder.addFieldOffset(24, testarrayofboolsOffset, 0); |
| 649 | } |
| 650 | static createTestarrayofboolsVector(builder, data) { |
| 651 | builder.startVector(1, data.length, 1); |
| 652 | for (let i = data.length - 1; i >= 0; i--) { |
| 653 | builder.addInt8(+data[i]); |
| 654 | } |
| 655 | return builder.endVector(); |
| 656 | } |
| 657 | static startTestarrayofboolsVector(builder, numElems) { |
| 658 | builder.startVector(1, numElems, 1); |
| 659 | } |
| 660 | static addTestf(builder, testf) { |
| 661 | builder.addFieldFloat32(25, testf, 3.14159); |
| 662 | } |
| 663 | static addTestf2(builder, testf2) { |
| 664 | builder.addFieldFloat32(26, testf2, 3.0); |
| 665 | } |
| 666 | static addTestf3(builder, testf3) { |
| 667 | builder.addFieldFloat32(27, testf3, 0.0); |
| 668 | } |
| 669 | static addTestarrayofstring2(builder, testarrayofstring2Offset) { |
| 670 | builder.addFieldOffset(28, testarrayofstring2Offset, 0); |
| 671 | } |
| 672 | static createTestarrayofstring2Vector(builder, data) { |
| 673 | builder.startVector(4, data.length, 4); |
| 674 | for (let i = data.length - 1; i >= 0; i--) { |
| 675 | builder.addOffset(data[i]); |
| 676 | } |
| 677 | return builder.endVector(); |
| 678 | } |
| 679 | static startTestarrayofstring2Vector(builder, numElems) { |
| 680 | builder.startVector(4, numElems, 4); |
| 681 | } |
| 682 | static addTestarrayofsortedstruct(builder, testarrayofsortedstructOffset) { |
| 683 | builder.addFieldOffset(29, testarrayofsortedstructOffset, 0); |
| 684 | } |
| 685 | static startTestarrayofsortedstructVector(builder, numElems) { |
| 686 | builder.startVector(8, numElems, 4); |
| 687 | } |
| 688 | static addFlex(builder, flexOffset) { |
| 689 | builder.addFieldOffset(30, flexOffset, 0); |
| 690 | } |
| 691 | static createFlexVector(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 startFlexVector(builder, numElems) { |
| 699 | builder.startVector(1, numElems, 1); |
| 700 | } |
| 701 | static addTest5(builder, test5Offset) { |
| 702 | builder.addFieldOffset(31, test5Offset, 0); |
| 703 | } |
| 704 | static startTest5Vector(builder, numElems) { |
| 705 | builder.startVector(4, numElems, 2); |
| 706 | } |
| 707 | static addVectorOfLongs(builder, vectorOfLongsOffset) { |
| 708 | builder.addFieldOffset(32, vectorOfLongsOffset, 0); |
| 709 | } |
| 710 | static createVectorOfLongsVector(builder, data) { |
| 711 | builder.startVector(8, data.length, 8); |
| 712 | for (let i = data.length - 1; i >= 0; i--) { |
| 713 | builder.addInt64(data[i]); |
| 714 | } |
| 715 | return builder.endVector(); |
| 716 | } |
| 717 | static startVectorOfLongsVector(builder, numElems) { |
| 718 | builder.startVector(8, numElems, 8); |
| 719 | } |
| 720 | static addVectorOfDoubles(builder, vectorOfDoublesOffset) { |
| 721 | builder.addFieldOffset(33, vectorOfDoublesOffset, 0); |
| 722 | } |
| 723 | static createVectorOfDoublesVector(builder, data) { |
| 724 | builder.startVector(8, data.length, 8); |
| 725 | for (let i = data.length - 1; i >= 0; i--) { |
| 726 | builder.addFloat64(data[i]); |
| 727 | } |
| 728 | return builder.endVector(); |
| 729 | } |
| 730 | static startVectorOfDoublesVector(builder, numElems) { |
| 731 | builder.startVector(8, numElems, 8); |
| 732 | } |
| 733 | static addParentNamespaceTest(builder, parentNamespaceTestOffset) { |
| 734 | builder.addFieldOffset(34, parentNamespaceTestOffset, 0); |
| 735 | } |
| 736 | static addVectorOfReferrables(builder, vectorOfReferrablesOffset) { |
| 737 | builder.addFieldOffset(35, vectorOfReferrablesOffset, 0); |
| 738 | } |
| 739 | static createVectorOfReferrablesVector(builder, data) { |
| 740 | builder.startVector(4, data.length, 4); |
| 741 | for (let i = data.length - 1; i >= 0; i--) { |
| 742 | builder.addOffset(data[i]); |
| 743 | } |
| 744 | return builder.endVector(); |
| 745 | } |
| 746 | static startVectorOfReferrablesVector(builder, numElems) { |
| 747 | builder.startVector(4, numElems, 4); |
| 748 | } |
| 749 | static addSingleWeakReference(builder, singleWeakReference) { |
| 750 | builder.addFieldInt64(36, singleWeakReference, BigInt('0')); |
| 751 | } |
| 752 | static addVectorOfWeakReferences(builder, vectorOfWeakReferencesOffset) { |
| 753 | builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0); |
| 754 | } |
| 755 | static createVectorOfWeakReferencesVector(builder, data) { |
| 756 | builder.startVector(8, data.length, 8); |
| 757 | for (let i = data.length - 1; i >= 0; i--) { |
| 758 | builder.addInt64(data[i]); |
| 759 | } |
| 760 | return builder.endVector(); |
| 761 | } |
| 762 | static startVectorOfWeakReferencesVector(builder, numElems) { |
| 763 | builder.startVector(8, numElems, 8); |
| 764 | } |
| 765 | static addVectorOfStrongReferrables(builder, vectorOfStrongReferrablesOffset) { |
| 766 | builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0); |
| 767 | } |
| 768 | static createVectorOfStrongReferrablesVector(builder, data) { |
| 769 | builder.startVector(4, data.length, 4); |
| 770 | for (let i = data.length - 1; i >= 0; i--) { |
| 771 | builder.addOffset(data[i]); |
| 772 | } |
| 773 | return builder.endVector(); |
| 774 | } |
| 775 | static startVectorOfStrongReferrablesVector(builder, numElems) { |
| 776 | builder.startVector(4, numElems, 4); |
| 777 | } |
| 778 | static addCoOwningReference(builder, coOwningReference) { |
| 779 | builder.addFieldInt64(39, coOwningReference, BigInt('0')); |
| 780 | } |
| 781 | static addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferencesOffset) { |
| 782 | builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0); |
| 783 | } |
| 784 | static createVectorOfCoOwningReferencesVector(builder, data) { |
| 785 | builder.startVector(8, data.length, 8); |
| 786 | for (let i = data.length - 1; i >= 0; i--) { |
| 787 | builder.addInt64(data[i]); |
| 788 | } |
| 789 | return builder.endVector(); |
| 790 | } |
| 791 | static startVectorOfCoOwningReferencesVector(builder, numElems) { |
| 792 | builder.startVector(8, numElems, 8); |
| 793 | } |
| 794 | static addNonOwningReference(builder, nonOwningReference) { |
| 795 | builder.addFieldInt64(41, nonOwningReference, BigInt('0')); |
| 796 | } |
| 797 | static addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferencesOffset) { |
| 798 | builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0); |
| 799 | } |
| 800 | static createVectorOfNonOwningReferencesVector(builder, data) { |
| 801 | builder.startVector(8, data.length, 8); |
| 802 | for (let i = data.length - 1; i >= 0; i--) { |
| 803 | builder.addInt64(data[i]); |
| 804 | } |
| 805 | return builder.endVector(); |
| 806 | } |
| 807 | static startVectorOfNonOwningReferencesVector(builder, numElems) { |
| 808 | builder.startVector(8, numElems, 8); |
| 809 | } |
| 810 | static addAnyUniqueType(builder, anyUniqueType) { |
| 811 | builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE); |
| 812 | } |
| 813 | static addAnyUnique(builder, anyUniqueOffset) { |
| 814 | builder.addFieldOffset(44, anyUniqueOffset, 0); |
| 815 | } |
| 816 | static addAnyAmbiguousType(builder, anyAmbiguousType) { |
| 817 | builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE); |
| 818 | } |
| 819 | static addAnyAmbiguous(builder, anyAmbiguousOffset) { |
| 820 | builder.addFieldOffset(46, anyAmbiguousOffset, 0); |
| 821 | } |
| 822 | static addVectorOfEnums(builder, vectorOfEnumsOffset) { |
| 823 | builder.addFieldOffset(47, vectorOfEnumsOffset, 0); |
| 824 | } |
| 825 | static createVectorOfEnumsVector(builder, data) { |
| 826 | builder.startVector(1, data.length, 1); |
| 827 | for (let i = data.length - 1; i >= 0; i--) { |
| 828 | builder.addInt8(data[i]); |
| 829 | } |
| 830 | return builder.endVector(); |
| 831 | } |
| 832 | static startVectorOfEnumsVector(builder, numElems) { |
| 833 | builder.startVector(1, numElems, 1); |
| 834 | } |
| 835 | static addSignedEnum(builder, signedEnum) { |
| 836 | builder.addFieldInt8(48, signedEnum, Race.None); |
| 837 | } |
| 838 | static addTestrequirednestedflatbuffer(builder, testrequirednestedflatbufferOffset) { |
| 839 | builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0); |
| 840 | } |
| 841 | static createTestrequirednestedflatbufferVector(builder, data) { |
| 842 | builder.startVector(1, data.length, 1); |
| 843 | for (let i = data.length - 1; i >= 0; i--) { |
| 844 | builder.addInt8(data[i]); |
| 845 | } |
| 846 | return builder.endVector(); |
| 847 | } |
| 848 | static startTestrequirednestedflatbufferVector(builder, numElems) { |
| 849 | builder.startVector(1, numElems, 1); |
| 850 | } |
| 851 | static addScalarKeySortedTables(builder, scalarKeySortedTablesOffset) { |
| 852 | builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0); |
| 853 | } |
| 854 | static createScalarKeySortedTablesVector(builder, data) { |
| 855 | builder.startVector(4, data.length, 4); |
| 856 | for (let i = data.length - 1; i >= 0; i--) { |
| 857 | builder.addOffset(data[i]); |
| 858 | } |
| 859 | return builder.endVector(); |
| 860 | } |
| 861 | static startScalarKeySortedTablesVector(builder, numElems) { |
| 862 | builder.startVector(4, numElems, 4); |
| 863 | } |
| 864 | static addNativeInline(builder, nativeInlineOffset) { |
| 865 | builder.addFieldStruct(51, nativeInlineOffset, 0); |
| 866 | } |
| 867 | static addLongEnumNonEnumDefault(builder, longEnumNonEnumDefault) { |
| 868 | builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0')); |
| 869 | } |
| 870 | static addLongEnumNormalDefault(builder, longEnumNormalDefault) { |
| 871 | builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2')); |
| 872 | } |
| 873 | static endMonster(builder) { |
| 874 | const offset = builder.endObject(); |
| 875 | builder.requiredField(offset, 10); // name |
| 876 | return offset; |
| 877 | } |
| 878 | static finishMonsterBuffer(builder, offset) { |
| 879 | builder.finish(offset, 'MONS'); |
| 880 | } |
| 881 | static finishSizePrefixedMonsterBuffer(builder, offset) { |
| 882 | builder.finish(offset, 'MONS', true); |
| 883 | } |
| 884 | serialize() { |
| 885 | return this.bb.bytes(); |
| 886 | } |
| 887 | static deserialize(buffer) { |
| 888 | return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer)); |
| 889 | } |
| 890 | unpack() { |
| 891 | 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(), (() => { |
| 892 | let temp = unionToAny(this.testType(), this.test.bind(this)); |
| 893 | if (temp === null) { |
| 894 | return null; |
| 895 | } |
| 896 | return temp.unpack(); |
| 897 | })(), 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(), (() => { |
| 898 | let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); |
| 899 | if (temp === null) { |
| 900 | return null; |
| 901 | } |
| 902 | return temp.unpack(); |
| 903 | })(), this.anyAmbiguousType(), (() => { |
| 904 | let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); |
| 905 | if (temp === null) { |
| 906 | return null; |
| 907 | } |
| 908 | return temp.unpack(); |
| 909 | })(), 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()); |
| 910 | } |
| 911 | unpackTo(_o) { |
| 912 | _o.pos = (this.pos() !== null ? this.pos().unpack() : null); |
| 913 | _o.mana = this.mana(); |
| 914 | _o.hp = this.hp(); |
| 915 | _o.name = this.name(); |
| 916 | _o.inventory = this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()); |
| 917 | _o.color = this.color(); |
| 918 | _o.testType = this.testType(); |
| 919 | _o.test = (() => { |
| 920 | let temp = unionToAny(this.testType(), this.test.bind(this)); |
| 921 | if (temp === null) { |
| 922 | return null; |
| 923 | } |
| 924 | return temp.unpack(); |
| 925 | })(); |
| 926 | _o.test4 = this.bb.createObjList(this.test4.bind(this), this.test4Length()); |
| 927 | _o.testarrayofstring = this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()); |
| 928 | _o.testarrayoftables = this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()); |
| 929 | _o.enemy = (this.enemy() !== null ? this.enemy().unpack() : null); |
| 930 | _o.testnestedflatbuffer = this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()); |
| 931 | _o.testempty = (this.testempty() !== null ? this.testempty().unpack() : null); |
| 932 | _o.testbool = this.testbool(); |
| 933 | _o.testhashs32Fnv1 = this.testhashs32Fnv1(); |
| 934 | _o.testhashu32Fnv1 = this.testhashu32Fnv1(); |
| 935 | _o.testhashs64Fnv1 = this.testhashs64Fnv1(); |
| 936 | _o.testhashu64Fnv1 = this.testhashu64Fnv1(); |
| 937 | _o.testhashs32Fnv1a = this.testhashs32Fnv1a(); |
| 938 | _o.testhashu32Fnv1a = this.testhashu32Fnv1a(); |
| 939 | _o.testhashs64Fnv1a = this.testhashs64Fnv1a(); |
| 940 | _o.testhashu64Fnv1a = this.testhashu64Fnv1a(); |
| 941 | _o.testarrayofbools = this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()); |
| 942 | _o.testf = this.testf(); |
| 943 | _o.testf2 = this.testf2(); |
| 944 | _o.testf3 = this.testf3(); |
| 945 | _o.testarrayofstring2 = this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()); |
| 946 | _o.testarrayofsortedstruct = this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()); |
| 947 | _o.flex = this.bb.createScalarList(this.flex.bind(this), this.flexLength()); |
| 948 | _o.test5 = this.bb.createObjList(this.test5.bind(this), this.test5Length()); |
| 949 | _o.vectorOfLongs = this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()); |
| 950 | _o.vectorOfDoubles = this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()); |
| 951 | _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null); |
| 952 | _o.vectorOfReferrables = this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()); |
| 953 | _o.singleWeakReference = this.singleWeakReference(); |
| 954 | _o.vectorOfWeakReferences = this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()); |
| 955 | _o.vectorOfStrongReferrables = this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()); |
| 956 | _o.coOwningReference = this.coOwningReference(); |
| 957 | _o.vectorOfCoOwningReferences = this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()); |
| 958 | _o.nonOwningReference = this.nonOwningReference(); |
| 959 | _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()); |
| 960 | _o.anyUniqueType = this.anyUniqueType(); |
| 961 | _o.anyUnique = (() => { |
| 962 | let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this)); |
| 963 | if (temp === null) { |
| 964 | return null; |
| 965 | } |
| 966 | return temp.unpack(); |
| 967 | })(); |
| 968 | _o.anyAmbiguousType = this.anyAmbiguousType(); |
| 969 | _o.anyAmbiguous = (() => { |
| 970 | let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this)); |
| 971 | if (temp === null) { |
| 972 | return null; |
| 973 | } |
| 974 | return temp.unpack(); |
| 975 | })(); |
| 976 | _o.vectorOfEnums = this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()); |
| 977 | _o.signedEnum = this.signedEnum(); |
| 978 | _o.testrequirednestedflatbuffer = this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()); |
| 979 | _o.scalarKeySortedTables = this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()); |
| 980 | _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline().unpack() : null); |
| 981 | _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault(); |
| 982 | _o.longEnumNormalDefault = this.longEnumNormalDefault(); |
| 983 | } |
| 984 | } |
| 985 | export class MonsterT { |
| 986 | 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')) { |
| 987 | this.pos = pos; |
| 988 | this.mana = mana; |
| 989 | this.hp = hp; |
| 990 | this.name = name; |
| 991 | this.inventory = inventory; |
| 992 | this.color = color; |
| 993 | this.testType = testType; |
| 994 | this.test = test; |
| 995 | this.test4 = test4; |
| 996 | this.testarrayofstring = testarrayofstring; |
| 997 | this.testarrayoftables = testarrayoftables; |
| 998 | this.enemy = enemy; |
| 999 | this.testnestedflatbuffer = testnestedflatbuffer; |
| 1000 | this.testempty = testempty; |
| 1001 | this.testbool = testbool; |
| 1002 | this.testhashs32Fnv1 = testhashs32Fnv1; |
| 1003 | this.testhashu32Fnv1 = testhashu32Fnv1; |
| 1004 | this.testhashs64Fnv1 = testhashs64Fnv1; |
| 1005 | this.testhashu64Fnv1 = testhashu64Fnv1; |
| 1006 | this.testhashs32Fnv1a = testhashs32Fnv1a; |
| 1007 | this.testhashu32Fnv1a = testhashu32Fnv1a; |
| 1008 | this.testhashs64Fnv1a = testhashs64Fnv1a; |
| 1009 | this.testhashu64Fnv1a = testhashu64Fnv1a; |
| 1010 | this.testarrayofbools = testarrayofbools; |
| 1011 | this.testf = testf; |
| 1012 | this.testf2 = testf2; |
| 1013 | this.testf3 = testf3; |
| 1014 | this.testarrayofstring2 = testarrayofstring2; |
| 1015 | this.testarrayofsortedstruct = testarrayofsortedstruct; |
| 1016 | this.flex = flex; |
| 1017 | this.test5 = test5; |
| 1018 | this.vectorOfLongs = vectorOfLongs; |
| 1019 | this.vectorOfDoubles = vectorOfDoubles; |
| 1020 | this.parentNamespaceTest = parentNamespaceTest; |
| 1021 | this.vectorOfReferrables = vectorOfReferrables; |
| 1022 | this.singleWeakReference = singleWeakReference; |
| 1023 | this.vectorOfWeakReferences = vectorOfWeakReferences; |
| 1024 | this.vectorOfStrongReferrables = vectorOfStrongReferrables; |
| 1025 | this.coOwningReference = coOwningReference; |
| 1026 | this.vectorOfCoOwningReferences = vectorOfCoOwningReferences; |
| 1027 | this.nonOwningReference = nonOwningReference; |
| 1028 | this.vectorOfNonOwningReferences = vectorOfNonOwningReferences; |
| 1029 | this.anyUniqueType = anyUniqueType; |
| 1030 | this.anyUnique = anyUnique; |
| 1031 | this.anyAmbiguousType = anyAmbiguousType; |
| 1032 | this.anyAmbiguous = anyAmbiguous; |
| 1033 | this.vectorOfEnums = vectorOfEnums; |
| 1034 | this.signedEnum = signedEnum; |
| 1035 | this.testrequirednestedflatbuffer = testrequirednestedflatbuffer; |
| 1036 | this.scalarKeySortedTables = scalarKeySortedTables; |
| 1037 | this.nativeInline = nativeInline; |
| 1038 | this.longEnumNonEnumDefault = longEnumNonEnumDefault; |
| 1039 | this.longEnumNormalDefault = longEnumNormalDefault; |
| 1040 | } |
| 1041 | pack(builder) { |
| 1042 | const name = (this.name !== null ? builder.createString(this.name) : 0); |
| 1043 | const inventory = Monster.createInventoryVector(builder, this.inventory); |
| 1044 | const test = builder.createObjectOffset(this.test); |
| 1045 | const test4 = builder.createStructOffsetList(this.test4, Monster.startTest4Vector); |
| 1046 | const testarrayofstring = Monster.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring)); |
| 1047 | const testarrayoftables = Monster.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables)); |
| 1048 | const enemy = (this.enemy !== null ? this.enemy.pack(builder) : 0); |
| 1049 | const testnestedflatbuffer = Monster.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer); |
| 1050 | const testempty = (this.testempty !== null ? this.testempty.pack(builder) : 0); |
| 1051 | const testarrayofbools = Monster.createTestarrayofboolsVector(builder, this.testarrayofbools); |
| 1052 | const testarrayofstring2 = Monster.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2)); |
| 1053 | const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster.startTestarrayofsortedstructVector); |
| 1054 | const flex = Monster.createFlexVector(builder, this.flex); |
| 1055 | const test5 = builder.createStructOffsetList(this.test5, Monster.startTest5Vector); |
| 1056 | const vectorOfLongs = Monster.createVectorOfLongsVector(builder, this.vectorOfLongs); |
| 1057 | const vectorOfDoubles = Monster.createVectorOfDoublesVector(builder, this.vectorOfDoubles); |
| 1058 | const parentNamespaceTest = (this.parentNamespaceTest !== null ? this.parentNamespaceTest.pack(builder) : 0); |
| 1059 | const vectorOfReferrables = Monster.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables)); |
| 1060 | const vectorOfWeakReferences = Monster.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences); |
| 1061 | const vectorOfStrongReferrables = Monster.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables)); |
| 1062 | const vectorOfCoOwningReferences = Monster.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences); |
| 1063 | const vectorOfNonOwningReferences = Monster.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences); |
| 1064 | const anyUnique = builder.createObjectOffset(this.anyUnique); |
| 1065 | const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous); |
| 1066 | const vectorOfEnums = Monster.createVectorOfEnumsVector(builder, this.vectorOfEnums); |
| 1067 | const testrequirednestedflatbuffer = Monster.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer); |
| 1068 | const scalarKeySortedTables = Monster.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables)); |
| 1069 | Monster.startMonster(builder); |
| 1070 | Monster.addPos(builder, (this.pos !== null ? this.pos.pack(builder) : 0)); |
| 1071 | Monster.addMana(builder, this.mana); |
| 1072 | Monster.addHp(builder, this.hp); |
| 1073 | Monster.addName(builder, name); |
| 1074 | Monster.addInventory(builder, inventory); |
| 1075 | Monster.addColor(builder, this.color); |
| 1076 | Monster.addTestType(builder, this.testType); |
| 1077 | Monster.addTest(builder, test); |
| 1078 | Monster.addTest4(builder, test4); |
| 1079 | Monster.addTestarrayofstring(builder, testarrayofstring); |
| 1080 | Monster.addTestarrayoftables(builder, testarrayoftables); |
| 1081 | Monster.addEnemy(builder, enemy); |
| 1082 | Monster.addTestnestedflatbuffer(builder, testnestedflatbuffer); |
| 1083 | Monster.addTestempty(builder, testempty); |
| 1084 | Monster.addTestbool(builder, this.testbool); |
| 1085 | Monster.addTesthashs32Fnv1(builder, this.testhashs32Fnv1); |
| 1086 | Monster.addTesthashu32Fnv1(builder, this.testhashu32Fnv1); |
| 1087 | Monster.addTesthashs64Fnv1(builder, this.testhashs64Fnv1); |
| 1088 | Monster.addTesthashu64Fnv1(builder, this.testhashu64Fnv1); |
| 1089 | Monster.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a); |
| 1090 | Monster.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a); |
| 1091 | Monster.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a); |
| 1092 | Monster.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a); |
| 1093 | Monster.addTestarrayofbools(builder, testarrayofbools); |
| 1094 | Monster.addTestf(builder, this.testf); |
| 1095 | Monster.addTestf2(builder, this.testf2); |
| 1096 | Monster.addTestf3(builder, this.testf3); |
| 1097 | Monster.addTestarrayofstring2(builder, testarrayofstring2); |
| 1098 | Monster.addTestarrayofsortedstruct(builder, testarrayofsortedstruct); |
| 1099 | Monster.addFlex(builder, flex); |
| 1100 | Monster.addTest5(builder, test5); |
| 1101 | Monster.addVectorOfLongs(builder, vectorOfLongs); |
| 1102 | Monster.addVectorOfDoubles(builder, vectorOfDoubles); |
| 1103 | Monster.addParentNamespaceTest(builder, parentNamespaceTest); |
| 1104 | Monster.addVectorOfReferrables(builder, vectorOfReferrables); |
| 1105 | Monster.addSingleWeakReference(builder, this.singleWeakReference); |
| 1106 | Monster.addVectorOfWeakReferences(builder, vectorOfWeakReferences); |
| 1107 | Monster.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables); |
| 1108 | Monster.addCoOwningReference(builder, this.coOwningReference); |
| 1109 | Monster.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences); |
| 1110 | Monster.addNonOwningReference(builder, this.nonOwningReference); |
| 1111 | Monster.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences); |
| 1112 | Monster.addAnyUniqueType(builder, this.anyUniqueType); |
| 1113 | Monster.addAnyUnique(builder, anyUnique); |
| 1114 | Monster.addAnyAmbiguousType(builder, this.anyAmbiguousType); |
| 1115 | Monster.addAnyAmbiguous(builder, anyAmbiguous); |
| 1116 | Monster.addVectorOfEnums(builder, vectorOfEnums); |
| 1117 | Monster.addSignedEnum(builder, this.signedEnum); |
| 1118 | Monster.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer); |
| 1119 | Monster.addScalarKeySortedTables(builder, scalarKeySortedTables); |
| 1120 | Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline.pack(builder) : 0)); |
| 1121 | Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault); |
| 1122 | Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault); |
| 1123 | return Monster.endMonster(builder); |
| 1124 | } |
| 1125 | } |