1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package MyGame.Example 4 5 import java.nio.* 6 import kotlin.math.sign 7 import com.google.flatbuffers.* 8 9 /** 10 * an example documentation comment: "monster object" 11 */ 12 @Suppress("unused") 13 @ExperimentalUnsignedTypes 14 class Monster : Table() { 15 __initnull16 fun __init(_i: Int, _bb: ByteBuffer) { 17 __reset(_i, _bb) 18 } __assignnull19 fun __assign(_i: Int, _bb: ByteBuffer) : Monster { 20 __init(_i, _bb) 21 return this 22 } 23 val pos : MyGame.Example.Vec3? get() = pos(MyGame.Example.Vec3()) posnull24 fun pos(obj: MyGame.Example.Vec3) : MyGame.Example.Vec3? { 25 val o = __offset(4) 26 return if (o != 0) { 27 obj.__assign(o + bb_pos, bb) 28 } else { 29 null 30 } 31 } 32 val mana : Short 33 get() { 34 val o = __offset(6) 35 return if(o != 0) bb.getShort(o + bb_pos) else 150 36 } mutateMananull37 fun mutateMana(mana: Short) : Boolean { 38 val o = __offset(6) 39 return if (o != 0) { 40 bb.putShort(o + bb_pos, mana) 41 true 42 } else { 43 false 44 } 45 } 46 val hp : Short 47 get() { 48 val o = __offset(8) 49 return if(o != 0) bb.getShort(o + bb_pos) else 100 50 } mutateHpnull51 fun mutateHp(hp: Short) : Boolean { 52 val o = __offset(8) 53 return if (o != 0) { 54 bb.putShort(o + bb_pos, hp) 55 true 56 } else { 57 false 58 } 59 } 60 val name : String? 61 get() { 62 val o = __offset(10) 63 return if (o != 0) __string(o + bb_pos) else null 64 } 65 val nameAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(10, 1) nameInByteBuffernull66 fun nameInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 10, 1) 67 fun inventory(j: Int) : UByte { 68 val o = __offset(14) 69 return if (o != 0) { 70 bb.get(__vector(o) + j * 1).toUByte() 71 } else { 72 0u 73 } 74 } 75 val inventoryLength : Int 76 get() { 77 val o = __offset(14); return if (o != 0) __vector_len(o) else 0 78 } 79 val inventoryAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(14, 1) inventoryInByteBuffernull80 fun inventoryInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 14, 1) 81 fun mutateInventory(j: Int, inventory: UByte) : Boolean { 82 val o = __offset(14) 83 return if (o != 0) { 84 bb.put(__vector(o) + j * 1, inventory.toByte()) 85 true 86 } else { 87 false 88 } 89 } 90 val color : UByte 91 get() { 92 val o = __offset(16) 93 return if(o != 0) bb.get(o + bb_pos).toUByte() else 8u 94 } mutateColornull95 fun mutateColor(color: UByte) : Boolean { 96 val o = __offset(16) 97 return if (o != 0) { 98 bb.put(o + bb_pos, color.toByte()) 99 true 100 } else { 101 false 102 } 103 } 104 val testType : UByte 105 get() { 106 val o = __offset(18) 107 return if(o != 0) bb.get(o + bb_pos).toUByte() else 0u 108 } mutateTestTypenull109 fun mutateTestType(testType: UByte) : Boolean { 110 val o = __offset(18) 111 return if (o != 0) { 112 bb.put(o + bb_pos, testType.toByte()) 113 true 114 } else { 115 false 116 } 117 } testnull118 fun test(obj: Table) : Table? { 119 val o = __offset(20); return if (o != 0) __union(obj, o + bb_pos) else null 120 } test4null121 fun test4(j: Int) : MyGame.Example.Test? = test4(MyGame.Example.Test(), j) 122 fun test4(obj: MyGame.Example.Test, j: Int) : MyGame.Example.Test? { 123 val o = __offset(22) 124 return if (o != 0) { 125 obj.__assign(__vector(o) + j * 4, bb) 126 } else { 127 null 128 } 129 } 130 val test4Length : Int 131 get() { 132 val o = __offset(22); return if (o != 0) __vector_len(o) else 0 133 } testarrayofstringnull134 fun testarrayofstring(j: Int) : String? { 135 val o = __offset(24) 136 return if (o != 0) { 137 __string(__vector(o) + j * 4) 138 } else { 139 null 140 } 141 } 142 val testarrayofstringLength : Int 143 get() { 144 val o = __offset(24); return if (o != 0) __vector_len(o) else 0 145 } 146 /** 147 * an example documentation comment: this will end up in the generated code 148 * multiline too 149 */ testarrayoftablesnull150 fun testarrayoftables(j: Int) : MyGame.Example.Monster? = testarrayoftables(MyGame.Example.Monster(), j) 151 fun testarrayoftables(obj: MyGame.Example.Monster, j: Int) : MyGame.Example.Monster? { 152 val o = __offset(26) 153 return if (o != 0) { 154 obj.__assign(__indirect(__vector(o) + j * 4), bb) 155 } else { 156 null 157 } 158 } 159 val testarrayoftablesLength : Int 160 get() { 161 val o = __offset(26); return if (o != 0) __vector_len(o) else 0 162 } testarrayoftablesByKeynull163 fun testarrayoftablesByKey(key: String) : MyGame.Example.Monster? { 164 val o = __offset(26) 165 return if (o != 0) { 166 MyGame.Example.Monster.__lookup_by_key(null, __vector(o), key, bb) 167 } else { 168 null 169 } 170 } testarrayoftablesByKeynull171 fun testarrayoftablesByKey(obj: MyGame.Example.Monster, key: String) : MyGame.Example.Monster? { 172 val o = __offset(26) 173 return if (o != 0) { 174 MyGame.Example.Monster.__lookup_by_key(obj, __vector(o), key, bb) 175 } else { 176 null 177 } 178 } 179 val enemy : MyGame.Example.Monster? get() = enemy(MyGame.Example.Monster()) enemynull180 fun enemy(obj: MyGame.Example.Monster) : MyGame.Example.Monster? { 181 val o = __offset(28) 182 return if (o != 0) { 183 obj.__assign(__indirect(o + bb_pos), bb) 184 } else { 185 null 186 } 187 } testnestedflatbuffernull188 fun testnestedflatbuffer(j: Int) : UByte { 189 val o = __offset(30) 190 return if (o != 0) { 191 bb.get(__vector(o) + j * 1).toUByte() 192 } else { 193 0u 194 } 195 } 196 val testnestedflatbufferLength : Int 197 get() { 198 val o = __offset(30); return if (o != 0) __vector_len(o) else 0 199 } 200 val testnestedflatbufferAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(30, 1) testnestedflatbufferInByteBuffernull201 fun testnestedflatbufferInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 30, 1) 202 val testnestedflatbufferAsMonster : MyGame.Example.Monster? get() = testnestedflatbufferAsMonster(MyGame.Example.Monster()) 203 fun testnestedflatbufferAsMonster(obj: MyGame.Example.Monster) : MyGame.Example.Monster? { 204 val o = __offset(30) 205 return if (o != 0) { 206 obj.__assign(__indirect(__vector(o)), bb) 207 } else { 208 null 209 } 210 } mutateTestnestedflatbuffernull211 fun mutateTestnestedflatbuffer(j: Int, testnestedflatbuffer: UByte) : Boolean { 212 val o = __offset(30) 213 return if (o != 0) { 214 bb.put(__vector(o) + j * 1, testnestedflatbuffer.toByte()) 215 true 216 } else { 217 false 218 } 219 } 220 val testempty : MyGame.Example.Stat? get() = testempty(MyGame.Example.Stat()) testemptynull221 fun testempty(obj: MyGame.Example.Stat) : MyGame.Example.Stat? { 222 val o = __offset(32) 223 return if (o != 0) { 224 obj.__assign(__indirect(o + bb_pos), bb) 225 } else { 226 null 227 } 228 } 229 val testbool : Boolean 230 get() { 231 val o = __offset(34) 232 return if(o != 0) 0.toByte() != bb.get(o + bb_pos) else false 233 } mutateTestboolnull234 fun mutateTestbool(testbool: Boolean) : Boolean { 235 val o = __offset(34) 236 return if (o != 0) { 237 bb.put(o + bb_pos, (if(testbool) 1 else 0).toByte()) 238 true 239 } else { 240 false 241 } 242 } 243 val testhashs32Fnv1 : Int 244 get() { 245 val o = __offset(36) 246 return if(o != 0) bb.getInt(o + bb_pos) else 0 247 } mutateTesthashs32Fnv1null248 fun mutateTesthashs32Fnv1(testhashs32Fnv1: Int) : Boolean { 249 val o = __offset(36) 250 return if (o != 0) { 251 bb.putInt(o + bb_pos, testhashs32Fnv1) 252 true 253 } else { 254 false 255 } 256 } 257 val testhashu32Fnv1 : UInt 258 get() { 259 val o = __offset(38) 260 return if(o != 0) bb.getInt(o + bb_pos).toUInt() else 0u 261 } mutateTesthashu32Fnv1null262 fun mutateTesthashu32Fnv1(testhashu32Fnv1: UInt) : Boolean { 263 val o = __offset(38) 264 return if (o != 0) { 265 bb.putInt(o + bb_pos, testhashu32Fnv1.toInt()) 266 true 267 } else { 268 false 269 } 270 } 271 val testhashs64Fnv1 : Long 272 get() { 273 val o = __offset(40) 274 return if(o != 0) bb.getLong(o + bb_pos) else 0L 275 } mutateTesthashs64Fnv1null276 fun mutateTesthashs64Fnv1(testhashs64Fnv1: Long) : Boolean { 277 val o = __offset(40) 278 return if (o != 0) { 279 bb.putLong(o + bb_pos, testhashs64Fnv1) 280 true 281 } else { 282 false 283 } 284 } 285 val testhashu64Fnv1 : ULong 286 get() { 287 val o = __offset(42) 288 return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL 289 } mutateTesthashu64Fnv1null290 fun mutateTesthashu64Fnv1(testhashu64Fnv1: ULong) : Boolean { 291 val o = __offset(42) 292 return if (o != 0) { 293 bb.putLong(o + bb_pos, testhashu64Fnv1.toLong()) 294 true 295 } else { 296 false 297 } 298 } 299 val testhashs32Fnv1a : Int 300 get() { 301 val o = __offset(44) 302 return if(o != 0) bb.getInt(o + bb_pos) else 0 303 } mutateTesthashs32Fnv1anull304 fun mutateTesthashs32Fnv1a(testhashs32Fnv1a: Int) : Boolean { 305 val o = __offset(44) 306 return if (o != 0) { 307 bb.putInt(o + bb_pos, testhashs32Fnv1a) 308 true 309 } else { 310 false 311 } 312 } 313 val testhashu32Fnv1a : UInt 314 get() { 315 val o = __offset(46) 316 return if(o != 0) bb.getInt(o + bb_pos).toUInt() else 0u 317 } mutateTesthashu32Fnv1anull318 fun mutateTesthashu32Fnv1a(testhashu32Fnv1a: UInt) : Boolean { 319 val o = __offset(46) 320 return if (o != 0) { 321 bb.putInt(o + bb_pos, testhashu32Fnv1a.toInt()) 322 true 323 } else { 324 false 325 } 326 } 327 val testhashs64Fnv1a : Long 328 get() { 329 val o = __offset(48) 330 return if(o != 0) bb.getLong(o + bb_pos) else 0L 331 } mutateTesthashs64Fnv1anull332 fun mutateTesthashs64Fnv1a(testhashs64Fnv1a: Long) : Boolean { 333 val o = __offset(48) 334 return if (o != 0) { 335 bb.putLong(o + bb_pos, testhashs64Fnv1a) 336 true 337 } else { 338 false 339 } 340 } 341 val testhashu64Fnv1a : ULong 342 get() { 343 val o = __offset(50) 344 return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL 345 } mutateTesthashu64Fnv1anull346 fun mutateTesthashu64Fnv1a(testhashu64Fnv1a: ULong) : Boolean { 347 val o = __offset(50) 348 return if (o != 0) { 349 bb.putLong(o + bb_pos, testhashu64Fnv1a.toLong()) 350 true 351 } else { 352 false 353 } 354 } testarrayofboolsnull355 fun testarrayofbools(j: Int) : Boolean { 356 val o = __offset(52) 357 return if (o != 0) { 358 0.toByte() != bb.get(__vector(o) + j * 1) 359 } else { 360 false 361 } 362 } 363 val testarrayofboolsLength : Int 364 get() { 365 val o = __offset(52); return if (o != 0) __vector_len(o) else 0 366 } 367 val testarrayofboolsAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(52, 1) testarrayofboolsInByteBuffernull368 fun testarrayofboolsInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 52, 1) 369 fun mutateTestarrayofbools(j: Int, testarrayofbools: Boolean) : Boolean { 370 val o = __offset(52) 371 return if (o != 0) { 372 bb.put(__vector(o) + j * 1, (if(testarrayofbools) 1 else 0).toByte()) 373 true 374 } else { 375 false 376 } 377 } 378 val testf : Float 379 get() { 380 val o = __offset(54) 381 return if(o != 0) bb.getFloat(o + bb_pos) else 3.14159f 382 } mutateTestfnull383 fun mutateTestf(testf: Float) : Boolean { 384 val o = __offset(54) 385 return if (o != 0) { 386 bb.putFloat(o + bb_pos, testf) 387 true 388 } else { 389 false 390 } 391 } 392 val testf2 : Float 393 get() { 394 val o = __offset(56) 395 return if(o != 0) bb.getFloat(o + bb_pos) else 3.0f 396 } mutateTestf2null397 fun mutateTestf2(testf2: Float) : Boolean { 398 val o = __offset(56) 399 return if (o != 0) { 400 bb.putFloat(o + bb_pos, testf2) 401 true 402 } else { 403 false 404 } 405 } 406 val testf3 : Float 407 get() { 408 val o = __offset(58) 409 return if(o != 0) bb.getFloat(o + bb_pos) else 0.0f 410 } mutateTestf3null411 fun mutateTestf3(testf3: Float) : Boolean { 412 val o = __offset(58) 413 return if (o != 0) { 414 bb.putFloat(o + bb_pos, testf3) 415 true 416 } else { 417 false 418 } 419 } testarrayofstring2null420 fun testarrayofstring2(j: Int) : String? { 421 val o = __offset(60) 422 return if (o != 0) { 423 __string(__vector(o) + j * 4) 424 } else { 425 null 426 } 427 } 428 val testarrayofstring2Length : Int 429 get() { 430 val o = __offset(60); return if (o != 0) __vector_len(o) else 0 431 } testarrayofsortedstructnull432 fun testarrayofsortedstruct(j: Int) : MyGame.Example.Ability? = testarrayofsortedstruct(MyGame.Example.Ability(), j) 433 fun testarrayofsortedstruct(obj: MyGame.Example.Ability, j: Int) : MyGame.Example.Ability? { 434 val o = __offset(62) 435 return if (o != 0) { 436 obj.__assign(__vector(o) + j * 8, bb) 437 } else { 438 null 439 } 440 } 441 val testarrayofsortedstructLength : Int 442 get() { 443 val o = __offset(62); return if (o != 0) __vector_len(o) else 0 444 } flexnull445 fun flex(j: Int) : UByte { 446 val o = __offset(64) 447 return if (o != 0) { 448 bb.get(__vector(o) + j * 1).toUByte() 449 } else { 450 0u 451 } 452 } 453 val flexLength : Int 454 get() { 455 val o = __offset(64); return if (o != 0) __vector_len(o) else 0 456 } 457 val flexAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(64, 1) flexInByteBuffernull458 fun flexInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 64, 1) 459 fun mutateFlex(j: Int, flex: UByte) : Boolean { 460 val o = __offset(64) 461 return if (o != 0) { 462 bb.put(__vector(o) + j * 1, flex.toByte()) 463 true 464 } else { 465 false 466 } 467 } test5null468 fun test5(j: Int) : MyGame.Example.Test? = test5(MyGame.Example.Test(), j) 469 fun test5(obj: MyGame.Example.Test, j: Int) : MyGame.Example.Test? { 470 val o = __offset(66) 471 return if (o != 0) { 472 obj.__assign(__vector(o) + j * 4, bb) 473 } else { 474 null 475 } 476 } 477 val test5Length : Int 478 get() { 479 val o = __offset(66); return if (o != 0) __vector_len(o) else 0 480 } vectorOfLongsnull481 fun vectorOfLongs(j: Int) : Long { 482 val o = __offset(68) 483 return if (o != 0) { 484 bb.getLong(__vector(o) + j * 8) 485 } else { 486 0 487 } 488 } 489 val vectorOfLongsLength : Int 490 get() { 491 val o = __offset(68); return if (o != 0) __vector_len(o) else 0 492 } 493 val vectorOfLongsAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(68, 8) vectorOfLongsInByteBuffernull494 fun vectorOfLongsInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 68, 8) 495 fun mutateVectorOfLongs(j: Int, vectorOfLongs: Long) : Boolean { 496 val o = __offset(68) 497 return if (o != 0) { 498 bb.putLong(__vector(o) + j * 8, vectorOfLongs) 499 true 500 } else { 501 false 502 } 503 } vectorOfDoublesnull504 fun vectorOfDoubles(j: Int) : Double { 505 val o = __offset(70) 506 return if (o != 0) { 507 bb.getDouble(__vector(o) + j * 8) 508 } else { 509 0.0 510 } 511 } 512 val vectorOfDoublesLength : Int 513 get() { 514 val o = __offset(70); return if (o != 0) __vector_len(o) else 0 515 } 516 val vectorOfDoublesAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(70, 8) vectorOfDoublesInByteBuffernull517 fun vectorOfDoublesInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 70, 8) 518 fun mutateVectorOfDoubles(j: Int, vectorOfDoubles: Double) : Boolean { 519 val o = __offset(70) 520 return if (o != 0) { 521 bb.putDouble(__vector(o) + j * 8, vectorOfDoubles) 522 true 523 } else { 524 false 525 } 526 } 527 val parentNamespaceTest : MyGame.InParentNamespace? get() = parentNamespaceTest(MyGame.InParentNamespace()) parentNamespaceTestnull528 fun parentNamespaceTest(obj: MyGame.InParentNamespace) : MyGame.InParentNamespace? { 529 val o = __offset(72) 530 return if (o != 0) { 531 obj.__assign(__indirect(o + bb_pos), bb) 532 } else { 533 null 534 } 535 } vectorOfReferrablesnull536 fun vectorOfReferrables(j: Int) : MyGame.Example.Referrable? = vectorOfReferrables(MyGame.Example.Referrable(), j) 537 fun vectorOfReferrables(obj: MyGame.Example.Referrable, j: Int) : MyGame.Example.Referrable? { 538 val o = __offset(74) 539 return if (o != 0) { 540 obj.__assign(__indirect(__vector(o) + j * 4), bb) 541 } else { 542 null 543 } 544 } 545 val vectorOfReferrablesLength : Int 546 get() { 547 val o = __offset(74); return if (o != 0) __vector_len(o) else 0 548 } vectorOfReferrablesByKeynull549 fun vectorOfReferrablesByKey(key: ULong) : MyGame.Example.Referrable? { 550 val o = __offset(74) 551 return if (o != 0) { 552 MyGame.Example.Referrable.__lookup_by_key(null, __vector(o), key, bb) 553 } else { 554 null 555 } 556 } vectorOfReferrablesByKeynull557 fun vectorOfReferrablesByKey(obj: MyGame.Example.Referrable, key: ULong) : MyGame.Example.Referrable? { 558 val o = __offset(74) 559 return if (o != 0) { 560 MyGame.Example.Referrable.__lookup_by_key(obj, __vector(o), key, bb) 561 } else { 562 null 563 } 564 } 565 val singleWeakReference : ULong 566 get() { 567 val o = __offset(76) 568 return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL 569 } mutateSingleWeakReferencenull570 fun mutateSingleWeakReference(singleWeakReference: ULong) : Boolean { 571 val o = __offset(76) 572 return if (o != 0) { 573 bb.putLong(o + bb_pos, singleWeakReference.toLong()) 574 true 575 } else { 576 false 577 } 578 } vectorOfWeakReferencesnull579 fun vectorOfWeakReferences(j: Int) : ULong { 580 val o = __offset(78) 581 return if (o != 0) { 582 bb.getLong(__vector(o) + j * 8).toULong() 583 } else { 584 0uL 585 } 586 } 587 val vectorOfWeakReferencesLength : Int 588 get() { 589 val o = __offset(78); return if (o != 0) __vector_len(o) else 0 590 } 591 val vectorOfWeakReferencesAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(78, 8) vectorOfWeakReferencesInByteBuffernull592 fun vectorOfWeakReferencesInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 78, 8) 593 fun mutateVectorOfWeakReferences(j: Int, vectorOfWeakReferences: ULong) : Boolean { 594 val o = __offset(78) 595 return if (o != 0) { 596 bb.putLong(__vector(o) + j * 8, vectorOfWeakReferences.toLong()) 597 true 598 } else { 599 false 600 } 601 } vectorOfStrongReferrablesnull602 fun vectorOfStrongReferrables(j: Int) : MyGame.Example.Referrable? = vectorOfStrongReferrables(MyGame.Example.Referrable(), j) 603 fun vectorOfStrongReferrables(obj: MyGame.Example.Referrable, j: Int) : MyGame.Example.Referrable? { 604 val o = __offset(80) 605 return if (o != 0) { 606 obj.__assign(__indirect(__vector(o) + j * 4), bb) 607 } else { 608 null 609 } 610 } 611 val vectorOfStrongReferrablesLength : Int 612 get() { 613 val o = __offset(80); return if (o != 0) __vector_len(o) else 0 614 } vectorOfStrongReferrablesByKeynull615 fun vectorOfStrongReferrablesByKey(key: ULong) : MyGame.Example.Referrable? { 616 val o = __offset(80) 617 return if (o != 0) { 618 MyGame.Example.Referrable.__lookup_by_key(null, __vector(o), key, bb) 619 } else { 620 null 621 } 622 } vectorOfStrongReferrablesByKeynull623 fun vectorOfStrongReferrablesByKey(obj: MyGame.Example.Referrable, key: ULong) : MyGame.Example.Referrable? { 624 val o = __offset(80) 625 return if (o != 0) { 626 MyGame.Example.Referrable.__lookup_by_key(obj, __vector(o), key, bb) 627 } else { 628 null 629 } 630 } 631 val coOwningReference : ULong 632 get() { 633 val o = __offset(82) 634 return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL 635 } mutateCoOwningReferencenull636 fun mutateCoOwningReference(coOwningReference: ULong) : Boolean { 637 val o = __offset(82) 638 return if (o != 0) { 639 bb.putLong(o + bb_pos, coOwningReference.toLong()) 640 true 641 } else { 642 false 643 } 644 } vectorOfCoOwningReferencesnull645 fun vectorOfCoOwningReferences(j: Int) : ULong { 646 val o = __offset(84) 647 return if (o != 0) { 648 bb.getLong(__vector(o) + j * 8).toULong() 649 } else { 650 0uL 651 } 652 } 653 val vectorOfCoOwningReferencesLength : Int 654 get() { 655 val o = __offset(84); return if (o != 0) __vector_len(o) else 0 656 } 657 val vectorOfCoOwningReferencesAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(84, 8) vectorOfCoOwningReferencesInByteBuffernull658 fun vectorOfCoOwningReferencesInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 84, 8) 659 fun mutateVectorOfCoOwningReferences(j: Int, vectorOfCoOwningReferences: ULong) : Boolean { 660 val o = __offset(84) 661 return if (o != 0) { 662 bb.putLong(__vector(o) + j * 8, vectorOfCoOwningReferences.toLong()) 663 true 664 } else { 665 false 666 } 667 } 668 val nonOwningReference : ULong 669 get() { 670 val o = __offset(86) 671 return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL 672 } mutateNonOwningReferencenull673 fun mutateNonOwningReference(nonOwningReference: ULong) : Boolean { 674 val o = __offset(86) 675 return if (o != 0) { 676 bb.putLong(o + bb_pos, nonOwningReference.toLong()) 677 true 678 } else { 679 false 680 } 681 } vectorOfNonOwningReferencesnull682 fun vectorOfNonOwningReferences(j: Int) : ULong { 683 val o = __offset(88) 684 return if (o != 0) { 685 bb.getLong(__vector(o) + j * 8).toULong() 686 } else { 687 0uL 688 } 689 } 690 val vectorOfNonOwningReferencesLength : Int 691 get() { 692 val o = __offset(88); return if (o != 0) __vector_len(o) else 0 693 } 694 val vectorOfNonOwningReferencesAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(88, 8) vectorOfNonOwningReferencesInByteBuffernull695 fun vectorOfNonOwningReferencesInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 88, 8) 696 fun mutateVectorOfNonOwningReferences(j: Int, vectorOfNonOwningReferences: ULong) : Boolean { 697 val o = __offset(88) 698 return if (o != 0) { 699 bb.putLong(__vector(o) + j * 8, vectorOfNonOwningReferences.toLong()) 700 true 701 } else { 702 false 703 } 704 } 705 val anyUniqueType : UByte 706 get() { 707 val o = __offset(90) 708 return if(o != 0) bb.get(o + bb_pos).toUByte() else 0u 709 } mutateAnyUniqueTypenull710 fun mutateAnyUniqueType(anyUniqueType: UByte) : Boolean { 711 val o = __offset(90) 712 return if (o != 0) { 713 bb.put(o + bb_pos, anyUniqueType.toByte()) 714 true 715 } else { 716 false 717 } 718 } anyUniquenull719 fun anyUnique(obj: Table) : Table? { 720 val o = __offset(92); return if (o != 0) __union(obj, o + bb_pos) else null 721 } 722 val anyAmbiguousType : UByte 723 get() { 724 val o = __offset(94) 725 return if(o != 0) bb.get(o + bb_pos).toUByte() else 0u 726 } mutateAnyAmbiguousTypenull727 fun mutateAnyAmbiguousType(anyAmbiguousType: UByte) : Boolean { 728 val o = __offset(94) 729 return if (o != 0) { 730 bb.put(o + bb_pos, anyAmbiguousType.toByte()) 731 true 732 } else { 733 false 734 } 735 } anyAmbiguousnull736 fun anyAmbiguous(obj: Table) : Table? { 737 val o = __offset(96); return if (o != 0) __union(obj, o + bb_pos) else null 738 } vectorOfEnumsnull739 fun vectorOfEnums(j: Int) : UByte { 740 val o = __offset(98) 741 return if (o != 0) { 742 bb.get(__vector(o) + j * 1).toUByte() 743 } else { 744 0u 745 } 746 } 747 val vectorOfEnumsLength : Int 748 get() { 749 val o = __offset(98); return if (o != 0) __vector_len(o) else 0 750 } 751 val vectorOfEnumsAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(98, 1) vectorOfEnumsInByteBuffernull752 fun vectorOfEnumsInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 98, 1) 753 fun mutateVectorOfEnums(j: Int, vectorOfEnums: UByte) : Boolean { 754 val o = __offset(98) 755 return if (o != 0) { 756 bb.put(__vector(o) + j * 1, vectorOfEnums.toByte()) 757 true 758 } else { 759 false 760 } 761 } 762 val signedEnum : Byte 763 get() { 764 val o = __offset(100) 765 return if(o != 0) bb.get(o + bb_pos) else -1 766 } mutateSignedEnumnull767 fun mutateSignedEnum(signedEnum: Byte) : Boolean { 768 val o = __offset(100) 769 return if (o != 0) { 770 bb.put(o + bb_pos, signedEnum) 771 true 772 } else { 773 false 774 } 775 } keysComparenull776 override fun keysCompare(o1: Int, o2: Int, _bb: ByteBuffer) : Int { 777 return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb) 778 } 779 companion object { validateVersionnull780 fun validateVersion() = Constants.FLATBUFFERS_1_12_0() 781 fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster()) 782 fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster { 783 _bb.order(ByteOrder.LITTLE_ENDIAN) 784 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 785 } MonsterBufferHasIdentifiernull786 fun MonsterBufferHasIdentifier(_bb: ByteBuffer) : Boolean = __has_identifier(_bb, "MONS") 787 fun startMonster(builder: FlatBufferBuilder) = builder.startTable(49) 788 fun addPos(builder: FlatBufferBuilder, pos: Int) = builder.addStruct(0, pos, 0) 789 fun addMana(builder: FlatBufferBuilder, mana: Short) = builder.addShort(1, mana, 150) 790 fun addHp(builder: FlatBufferBuilder, hp: Short) = builder.addShort(2, hp, 100) 791 fun addName(builder: FlatBufferBuilder, name: Int) = builder.addOffset(3, name, 0) 792 fun addInventory(builder: FlatBufferBuilder, inventory: Int) = builder.addOffset(5, inventory, 0) 793 fun createInventoryVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 794 builder.startVector(1, data.size, 1) 795 for (i in data.size - 1 downTo 0) { 796 builder.addByte(data[i].toByte()) 797 } 798 return builder.endVector() 799 } startInventoryVectornull800 fun startInventoryVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 801 fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(6, color.toByte(), 8) 802 fun addTestType(builder: FlatBufferBuilder, testType: UByte) = builder.addByte(7, testType.toByte(), 0) 803 fun addTest(builder: FlatBufferBuilder, test: Int) = builder.addOffset(8, test, 0) 804 fun addTest4(builder: FlatBufferBuilder, test4: Int) = builder.addOffset(9, test4, 0) 805 fun startTest4Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 2) 806 fun addTestarrayofstring(builder: FlatBufferBuilder, testarrayofstring: Int) = builder.addOffset(10, testarrayofstring, 0) 807 fun createTestarrayofstringVector(builder: FlatBufferBuilder, data: IntArray) : Int { 808 builder.startVector(4, data.size, 4) 809 for (i in data.size - 1 downTo 0) { 810 builder.addOffset(data[i]) 811 } 812 return builder.endVector() 813 } startTestarrayofstringVectornull814 fun startTestarrayofstringVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 815 fun addTestarrayoftables(builder: FlatBufferBuilder, testarrayoftables: Int) = builder.addOffset(11, testarrayoftables, 0) 816 fun createTestarrayoftablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 817 builder.startVector(4, data.size, 4) 818 for (i in data.size - 1 downTo 0) { 819 builder.addOffset(data[i]) 820 } 821 return builder.endVector() 822 } startTestarrayoftablesVectornull823 fun startTestarrayoftablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 824 fun addEnemy(builder: FlatBufferBuilder, enemy: Int) = builder.addOffset(12, enemy, 0) 825 fun addTestnestedflatbuffer(builder: FlatBufferBuilder, testnestedflatbuffer: Int) = builder.addOffset(13, testnestedflatbuffer, 0) 826 fun createTestnestedflatbufferVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 827 builder.startVector(1, data.size, 1) 828 for (i in data.size - 1 downTo 0) { 829 builder.addByte(data[i].toByte()) 830 } 831 return builder.endVector() 832 } startTestnestedflatbufferVectornull833 fun startTestnestedflatbufferVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 834 fun addTestempty(builder: FlatBufferBuilder, testempty: Int) = builder.addOffset(14, testempty, 0) 835 fun addTestbool(builder: FlatBufferBuilder, testbool: Boolean) = builder.addBoolean(15, testbool, false) 836 fun addTesthashs32Fnv1(builder: FlatBufferBuilder, testhashs32Fnv1: Int) = builder.addInt(16, testhashs32Fnv1, 0) 837 fun addTesthashu32Fnv1(builder: FlatBufferBuilder, testhashu32Fnv1: UInt) = builder.addInt(17, testhashu32Fnv1.toInt(), 0) 838 fun addTesthashs64Fnv1(builder: FlatBufferBuilder, testhashs64Fnv1: Long) = builder.addLong(18, testhashs64Fnv1, 0L) 839 fun addTesthashu64Fnv1(builder: FlatBufferBuilder, testhashu64Fnv1: ULong) = builder.addLong(19, testhashu64Fnv1.toLong(), 0) 840 fun addTesthashs32Fnv1a(builder: FlatBufferBuilder, testhashs32Fnv1a: Int) = builder.addInt(20, testhashs32Fnv1a, 0) 841 fun addTesthashu32Fnv1a(builder: FlatBufferBuilder, testhashu32Fnv1a: UInt) = builder.addInt(21, testhashu32Fnv1a.toInt(), 0) 842 fun addTesthashs64Fnv1a(builder: FlatBufferBuilder, testhashs64Fnv1a: Long) = builder.addLong(22, testhashs64Fnv1a, 0L) 843 fun addTesthashu64Fnv1a(builder: FlatBufferBuilder, testhashu64Fnv1a: ULong) = builder.addLong(23, testhashu64Fnv1a.toLong(), 0) 844 fun addTestarrayofbools(builder: FlatBufferBuilder, testarrayofbools: Int) = builder.addOffset(24, testarrayofbools, 0) 845 fun createTestarrayofboolsVector(builder: FlatBufferBuilder, data: BooleanArray) : Int { 846 builder.startVector(1, data.size, 1) 847 for (i in data.size - 1 downTo 0) { 848 builder.addBoolean(data[i]) 849 } 850 return builder.endVector() 851 } startTestarrayofboolsVectornull852 fun startTestarrayofboolsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 853 fun addTestf(builder: FlatBufferBuilder, testf: Float) = builder.addFloat(25, testf, 3.14159) 854 fun addTestf2(builder: FlatBufferBuilder, testf2: Float) = builder.addFloat(26, testf2, 3.0) 855 fun addTestf3(builder: FlatBufferBuilder, testf3: Float) = builder.addFloat(27, testf3, 0.0) 856 fun addTestarrayofstring2(builder: FlatBufferBuilder, testarrayofstring2: Int) = builder.addOffset(28, testarrayofstring2, 0) 857 fun createTestarrayofstring2Vector(builder: FlatBufferBuilder, data: IntArray) : Int { 858 builder.startVector(4, data.size, 4) 859 for (i in data.size - 1 downTo 0) { 860 builder.addOffset(data[i]) 861 } 862 return builder.endVector() 863 } startTestarrayofstring2Vectornull864 fun startTestarrayofstring2Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 865 fun addTestarrayofsortedstruct(builder: FlatBufferBuilder, testarrayofsortedstruct: Int) = builder.addOffset(29, testarrayofsortedstruct, 0) 866 fun startTestarrayofsortedstructVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 4) 867 fun addFlex(builder: FlatBufferBuilder, flex: Int) = builder.addOffset(30, flex, 0) 868 fun createFlexVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 869 builder.startVector(1, data.size, 1) 870 for (i in data.size - 1 downTo 0) { 871 builder.addByte(data[i].toByte()) 872 } 873 return builder.endVector() 874 } startFlexVectornull875 fun startFlexVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 876 fun addTest5(builder: FlatBufferBuilder, test5: Int) = builder.addOffset(31, test5, 0) 877 fun startTest5Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 2) 878 fun addVectorOfLongs(builder: FlatBufferBuilder, vectorOfLongs: Int) = builder.addOffset(32, vectorOfLongs, 0) 879 fun createVectorOfLongsVector(builder: FlatBufferBuilder, data: LongArray) : Int { 880 builder.startVector(8, data.size, 8) 881 for (i in data.size - 1 downTo 0) { 882 builder.addLong(data[i]) 883 } 884 return builder.endVector() 885 } startVectorOfLongsVectornull886 fun startVectorOfLongsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 887 fun addVectorOfDoubles(builder: FlatBufferBuilder, vectorOfDoubles: Int) = builder.addOffset(33, vectorOfDoubles, 0) 888 fun createVectorOfDoublesVector(builder: FlatBufferBuilder, data: DoubleArray) : Int { 889 builder.startVector(8, data.size, 8) 890 for (i in data.size - 1 downTo 0) { 891 builder.addDouble(data[i]) 892 } 893 return builder.endVector() 894 } startVectorOfDoublesVectornull895 fun startVectorOfDoublesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 896 fun addParentNamespaceTest(builder: FlatBufferBuilder, parentNamespaceTest: Int) = builder.addOffset(34, parentNamespaceTest, 0) 897 fun addVectorOfReferrables(builder: FlatBufferBuilder, vectorOfReferrables: Int) = builder.addOffset(35, vectorOfReferrables, 0) 898 fun createVectorOfReferrablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 899 builder.startVector(4, data.size, 4) 900 for (i in data.size - 1 downTo 0) { 901 builder.addOffset(data[i]) 902 } 903 return builder.endVector() 904 } startVectorOfReferrablesVectornull905 fun startVectorOfReferrablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 906 fun addSingleWeakReference(builder: FlatBufferBuilder, singleWeakReference: ULong) = builder.addLong(36, singleWeakReference.toLong(), 0) 907 fun addVectorOfWeakReferences(builder: FlatBufferBuilder, vectorOfWeakReferences: Int) = builder.addOffset(37, vectorOfWeakReferences, 0) 908 fun createVectorOfWeakReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 909 builder.startVector(8, data.size, 8) 910 for (i in data.size - 1 downTo 0) { 911 builder.addLong(data[i].toLong()) 912 } 913 return builder.endVector() 914 } startVectorOfWeakReferencesVectornull915 fun startVectorOfWeakReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 916 fun addVectorOfStrongReferrables(builder: FlatBufferBuilder, vectorOfStrongReferrables: Int) = builder.addOffset(38, vectorOfStrongReferrables, 0) 917 fun createVectorOfStrongReferrablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 918 builder.startVector(4, data.size, 4) 919 for (i in data.size - 1 downTo 0) { 920 builder.addOffset(data[i]) 921 } 922 return builder.endVector() 923 } startVectorOfStrongReferrablesVectornull924 fun startVectorOfStrongReferrablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 925 fun addCoOwningReference(builder: FlatBufferBuilder, coOwningReference: ULong) = builder.addLong(39, coOwningReference.toLong(), 0) 926 fun addVectorOfCoOwningReferences(builder: FlatBufferBuilder, vectorOfCoOwningReferences: Int) = builder.addOffset(40, vectorOfCoOwningReferences, 0) 927 fun createVectorOfCoOwningReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 928 builder.startVector(8, data.size, 8) 929 for (i in data.size - 1 downTo 0) { 930 builder.addLong(data[i].toLong()) 931 } 932 return builder.endVector() 933 } startVectorOfCoOwningReferencesVectornull934 fun startVectorOfCoOwningReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 935 fun addNonOwningReference(builder: FlatBufferBuilder, nonOwningReference: ULong) = builder.addLong(41, nonOwningReference.toLong(), 0) 936 fun addVectorOfNonOwningReferences(builder: FlatBufferBuilder, vectorOfNonOwningReferences: Int) = builder.addOffset(42, vectorOfNonOwningReferences, 0) 937 fun createVectorOfNonOwningReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 938 builder.startVector(8, data.size, 8) 939 for (i in data.size - 1 downTo 0) { 940 builder.addLong(data[i].toLong()) 941 } 942 return builder.endVector() 943 } startVectorOfNonOwningReferencesVectornull944 fun startVectorOfNonOwningReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 945 fun addAnyUniqueType(builder: FlatBufferBuilder, anyUniqueType: UByte) = builder.addByte(43, anyUniqueType.toByte(), 0) 946 fun addAnyUnique(builder: FlatBufferBuilder, anyUnique: Int) = builder.addOffset(44, anyUnique, 0) 947 fun addAnyAmbiguousType(builder: FlatBufferBuilder, anyAmbiguousType: UByte) = builder.addByte(45, anyAmbiguousType.toByte(), 0) 948 fun addAnyAmbiguous(builder: FlatBufferBuilder, anyAmbiguous: Int) = builder.addOffset(46, anyAmbiguous, 0) 949 fun addVectorOfEnums(builder: FlatBufferBuilder, vectorOfEnums: Int) = builder.addOffset(47, vectorOfEnums, 0) 950 fun createVectorOfEnumsVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 951 builder.startVector(1, data.size, 1) 952 for (i in data.size - 1 downTo 0) { 953 builder.addByte(data[i].toByte()) 954 } 955 return builder.endVector() 956 } startVectorOfEnumsVectornull957 fun startVectorOfEnumsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 958 fun addSignedEnum(builder: FlatBufferBuilder, signedEnum: Byte) = builder.addByte(48, signedEnum, -1) 959 fun endMonster(builder: FlatBufferBuilder) : Int { 960 val o = builder.endTable() 961 builder.required(o, 10) 962 return o 963 } finishMonsterBuffernull964 fun finishMonsterBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset, "MONS") 965 fun finishSizePrefixedMonsterBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset, "MONS") 966 fun __lookup_by_key(obj: Monster?, vectorLocation: Int, key: String, bb: ByteBuffer) : Monster? { 967 val byteKey = key.toByteArray(java.nio.charset.StandardCharsets.UTF_8) 968 var span = bb.getInt(vectorLocation - 4) 969 var start = 0 970 while (span != 0) { 971 var middle = span / 2 972 val tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb) 973 val comp = compareStrings(__offset(10, bb.capacity() - tableOffset, bb), byteKey, bb) 974 when { 975 comp > 0 -> span = middle 976 comp < 0 -> { 977 middle++ 978 start += middle 979 span -= middle 980 } 981 else -> { 982 return (obj ?: Monster()).__assign(tableOffset, bb) 983 } 984 } 985 } 986 return null 987 } 988 } 989 } 990