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 } testrequirednestedflatbuffernull776 fun testrequirednestedflatbuffer(j: Int) : UByte { 777 val o = __offset(102) 778 return if (o != 0) { 779 bb.get(__vector(o) + j * 1).toUByte() 780 } else { 781 0u 782 } 783 } 784 val testrequirednestedflatbufferLength : Int 785 get() { 786 val o = __offset(102); return if (o != 0) __vector_len(o) else 0 787 } 788 val testrequirednestedflatbufferAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(102, 1) testrequirednestedflatbufferInByteBuffernull789 fun testrequirednestedflatbufferInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 102, 1) 790 val testrequirednestedflatbufferAsMonster : MyGame.Example.Monster? get() = testrequirednestedflatbufferAsMonster(MyGame.Example.Monster()) 791 fun testrequirednestedflatbufferAsMonster(obj: MyGame.Example.Monster) : MyGame.Example.Monster? { 792 val o = __offset(102) 793 return if (o != 0) { 794 obj.__assign(__indirect(__vector(o)), bb) 795 } else { 796 null 797 } 798 } mutateTestrequirednestedflatbuffernull799 fun mutateTestrequirednestedflatbuffer(j: Int, testrequirednestedflatbuffer: UByte) : Boolean { 800 val o = __offset(102) 801 return if (o != 0) { 802 bb.put(__vector(o) + j * 1, testrequirednestedflatbuffer.toByte()) 803 true 804 } else { 805 false 806 } 807 } scalarKeySortedTablesnull808 fun scalarKeySortedTables(j: Int) : MyGame.Example.Stat? = scalarKeySortedTables(MyGame.Example.Stat(), j) 809 fun scalarKeySortedTables(obj: MyGame.Example.Stat, j: Int) : MyGame.Example.Stat? { 810 val o = __offset(104) 811 return if (o != 0) { 812 obj.__assign(__indirect(__vector(o) + j * 4), bb) 813 } else { 814 null 815 } 816 } 817 val scalarKeySortedTablesLength : Int 818 get() { 819 val o = __offset(104); return if (o != 0) __vector_len(o) else 0 820 } scalarKeySortedTablesByKeynull821 fun scalarKeySortedTablesByKey(key: UShort) : MyGame.Example.Stat? { 822 val o = __offset(104) 823 return if (o != 0) { 824 MyGame.Example.Stat.__lookup_by_key(null, __vector(o), key, bb) 825 } else { 826 null 827 } 828 } scalarKeySortedTablesByKeynull829 fun scalarKeySortedTablesByKey(obj: MyGame.Example.Stat, key: UShort) : MyGame.Example.Stat? { 830 val o = __offset(104) 831 return if (o != 0) { 832 MyGame.Example.Stat.__lookup_by_key(obj, __vector(o), key, bb) 833 } else { 834 null 835 } 836 } keysComparenull837 override fun keysCompare(o1: Int, o2: Int, _bb: ByteBuffer) : Int { 838 return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb) 839 } 840 companion object { validateVersionnull841 fun validateVersion() = Constants.FLATBUFFERS_2_0_0() 842 fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster()) 843 fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster { 844 _bb.order(ByteOrder.LITTLE_ENDIAN) 845 return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)) 846 } MonsterBufferHasIdentifiernull847 fun MonsterBufferHasIdentifier(_bb: ByteBuffer) : Boolean = __has_identifier(_bb, "MONS") 848 fun startMonster(builder: FlatBufferBuilder) = builder.startTable(51) 849 fun addPos(builder: FlatBufferBuilder, pos: Int) = builder.addStruct(0, pos, 0) 850 fun addMana(builder: FlatBufferBuilder, mana: Short) = builder.addShort(1, mana, 150) 851 fun addHp(builder: FlatBufferBuilder, hp: Short) = builder.addShort(2, hp, 100) 852 fun addName(builder: FlatBufferBuilder, name: Int) = builder.addOffset(3, name, 0) 853 fun addInventory(builder: FlatBufferBuilder, inventory: Int) = builder.addOffset(5, inventory, 0) 854 fun createInventoryVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 855 builder.startVector(1, data.size, 1) 856 for (i in data.size - 1 downTo 0) { 857 builder.addByte(data[i].toByte()) 858 } 859 return builder.endVector() 860 } startInventoryVectornull861 fun startInventoryVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 862 fun addColor(builder: FlatBufferBuilder, color: UByte) = builder.addByte(6, color.toByte(), 8) 863 fun addTestType(builder: FlatBufferBuilder, testType: UByte) = builder.addByte(7, testType.toByte(), 0) 864 fun addTest(builder: FlatBufferBuilder, test: Int) = builder.addOffset(8, test, 0) 865 fun addTest4(builder: FlatBufferBuilder, test4: Int) = builder.addOffset(9, test4, 0) 866 fun startTest4Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 2) 867 fun addTestarrayofstring(builder: FlatBufferBuilder, testarrayofstring: Int) = builder.addOffset(10, testarrayofstring, 0) 868 fun createTestarrayofstringVector(builder: FlatBufferBuilder, data: IntArray) : Int { 869 builder.startVector(4, data.size, 4) 870 for (i in data.size - 1 downTo 0) { 871 builder.addOffset(data[i]) 872 } 873 return builder.endVector() 874 } startTestarrayofstringVectornull875 fun startTestarrayofstringVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 876 fun addTestarrayoftables(builder: FlatBufferBuilder, testarrayoftables: Int) = builder.addOffset(11, testarrayoftables, 0) 877 fun createTestarrayoftablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 878 builder.startVector(4, data.size, 4) 879 for (i in data.size - 1 downTo 0) { 880 builder.addOffset(data[i]) 881 } 882 return builder.endVector() 883 } startTestarrayoftablesVectornull884 fun startTestarrayoftablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 885 fun addEnemy(builder: FlatBufferBuilder, enemy: Int) = builder.addOffset(12, enemy, 0) 886 fun addTestnestedflatbuffer(builder: FlatBufferBuilder, testnestedflatbuffer: Int) = builder.addOffset(13, testnestedflatbuffer, 0) 887 fun createTestnestedflatbufferVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 888 builder.startVector(1, data.size, 1) 889 for (i in data.size - 1 downTo 0) { 890 builder.addByte(data[i].toByte()) 891 } 892 return builder.endVector() 893 } startTestnestedflatbufferVectornull894 fun startTestnestedflatbufferVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 895 fun addTestempty(builder: FlatBufferBuilder, testempty: Int) = builder.addOffset(14, testempty, 0) 896 fun addTestbool(builder: FlatBufferBuilder, testbool: Boolean) = builder.addBoolean(15, testbool, false) 897 fun addTesthashs32Fnv1(builder: FlatBufferBuilder, testhashs32Fnv1: Int) = builder.addInt(16, testhashs32Fnv1, 0) 898 fun addTesthashu32Fnv1(builder: FlatBufferBuilder, testhashu32Fnv1: UInt) = builder.addInt(17, testhashu32Fnv1.toInt(), 0) 899 fun addTesthashs64Fnv1(builder: FlatBufferBuilder, testhashs64Fnv1: Long) = builder.addLong(18, testhashs64Fnv1, 0L) 900 fun addTesthashu64Fnv1(builder: FlatBufferBuilder, testhashu64Fnv1: ULong) = builder.addLong(19, testhashu64Fnv1.toLong(), 0) 901 fun addTesthashs32Fnv1a(builder: FlatBufferBuilder, testhashs32Fnv1a: Int) = builder.addInt(20, testhashs32Fnv1a, 0) 902 fun addTesthashu32Fnv1a(builder: FlatBufferBuilder, testhashu32Fnv1a: UInt) = builder.addInt(21, testhashu32Fnv1a.toInt(), 0) 903 fun addTesthashs64Fnv1a(builder: FlatBufferBuilder, testhashs64Fnv1a: Long) = builder.addLong(22, testhashs64Fnv1a, 0L) 904 fun addTesthashu64Fnv1a(builder: FlatBufferBuilder, testhashu64Fnv1a: ULong) = builder.addLong(23, testhashu64Fnv1a.toLong(), 0) 905 fun addTestarrayofbools(builder: FlatBufferBuilder, testarrayofbools: Int) = builder.addOffset(24, testarrayofbools, 0) 906 fun createTestarrayofboolsVector(builder: FlatBufferBuilder, data: BooleanArray) : Int { 907 builder.startVector(1, data.size, 1) 908 for (i in data.size - 1 downTo 0) { 909 builder.addBoolean(data[i]) 910 } 911 return builder.endVector() 912 } startTestarrayofboolsVectornull913 fun startTestarrayofboolsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 914 fun addTestf(builder: FlatBufferBuilder, testf: Float) = builder.addFloat(25, testf, 3.14159) 915 fun addTestf2(builder: FlatBufferBuilder, testf2: Float) = builder.addFloat(26, testf2, 3.0) 916 fun addTestf3(builder: FlatBufferBuilder, testf3: Float) = builder.addFloat(27, testf3, 0.0) 917 fun addTestarrayofstring2(builder: FlatBufferBuilder, testarrayofstring2: Int) = builder.addOffset(28, testarrayofstring2, 0) 918 fun createTestarrayofstring2Vector(builder: FlatBufferBuilder, data: IntArray) : Int { 919 builder.startVector(4, data.size, 4) 920 for (i in data.size - 1 downTo 0) { 921 builder.addOffset(data[i]) 922 } 923 return builder.endVector() 924 } startTestarrayofstring2Vectornull925 fun startTestarrayofstring2Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 926 fun addTestarrayofsortedstruct(builder: FlatBufferBuilder, testarrayofsortedstruct: Int) = builder.addOffset(29, testarrayofsortedstruct, 0) 927 fun startTestarrayofsortedstructVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 4) 928 fun addFlex(builder: FlatBufferBuilder, flex: Int) = builder.addOffset(30, flex, 0) 929 fun createFlexVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 930 builder.startVector(1, data.size, 1) 931 for (i in data.size - 1 downTo 0) { 932 builder.addByte(data[i].toByte()) 933 } 934 return builder.endVector() 935 } startFlexVectornull936 fun startFlexVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 937 fun addTest5(builder: FlatBufferBuilder, test5: Int) = builder.addOffset(31, test5, 0) 938 fun startTest5Vector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 2) 939 fun addVectorOfLongs(builder: FlatBufferBuilder, vectorOfLongs: Int) = builder.addOffset(32, vectorOfLongs, 0) 940 fun createVectorOfLongsVector(builder: FlatBufferBuilder, data: LongArray) : Int { 941 builder.startVector(8, data.size, 8) 942 for (i in data.size - 1 downTo 0) { 943 builder.addLong(data[i]) 944 } 945 return builder.endVector() 946 } startVectorOfLongsVectornull947 fun startVectorOfLongsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 948 fun addVectorOfDoubles(builder: FlatBufferBuilder, vectorOfDoubles: Int) = builder.addOffset(33, vectorOfDoubles, 0) 949 fun createVectorOfDoublesVector(builder: FlatBufferBuilder, data: DoubleArray) : Int { 950 builder.startVector(8, data.size, 8) 951 for (i in data.size - 1 downTo 0) { 952 builder.addDouble(data[i]) 953 } 954 return builder.endVector() 955 } startVectorOfDoublesVectornull956 fun startVectorOfDoublesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 957 fun addParentNamespaceTest(builder: FlatBufferBuilder, parentNamespaceTest: Int) = builder.addOffset(34, parentNamespaceTest, 0) 958 fun addVectorOfReferrables(builder: FlatBufferBuilder, vectorOfReferrables: Int) = builder.addOffset(35, vectorOfReferrables, 0) 959 fun createVectorOfReferrablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 960 builder.startVector(4, data.size, 4) 961 for (i in data.size - 1 downTo 0) { 962 builder.addOffset(data[i]) 963 } 964 return builder.endVector() 965 } startVectorOfReferrablesVectornull966 fun startVectorOfReferrablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 967 fun addSingleWeakReference(builder: FlatBufferBuilder, singleWeakReference: ULong) = builder.addLong(36, singleWeakReference.toLong(), 0) 968 fun addVectorOfWeakReferences(builder: FlatBufferBuilder, vectorOfWeakReferences: Int) = builder.addOffset(37, vectorOfWeakReferences, 0) 969 fun createVectorOfWeakReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 970 builder.startVector(8, data.size, 8) 971 for (i in data.size - 1 downTo 0) { 972 builder.addLong(data[i].toLong()) 973 } 974 return builder.endVector() 975 } startVectorOfWeakReferencesVectornull976 fun startVectorOfWeakReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 977 fun addVectorOfStrongReferrables(builder: FlatBufferBuilder, vectorOfStrongReferrables: Int) = builder.addOffset(38, vectorOfStrongReferrables, 0) 978 fun createVectorOfStrongReferrablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 979 builder.startVector(4, data.size, 4) 980 for (i in data.size - 1 downTo 0) { 981 builder.addOffset(data[i]) 982 } 983 return builder.endVector() 984 } startVectorOfStrongReferrablesVectornull985 fun startVectorOfStrongReferrablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 986 fun addCoOwningReference(builder: FlatBufferBuilder, coOwningReference: ULong) = builder.addLong(39, coOwningReference.toLong(), 0) 987 fun addVectorOfCoOwningReferences(builder: FlatBufferBuilder, vectorOfCoOwningReferences: Int) = builder.addOffset(40, vectorOfCoOwningReferences, 0) 988 fun createVectorOfCoOwningReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 989 builder.startVector(8, data.size, 8) 990 for (i in data.size - 1 downTo 0) { 991 builder.addLong(data[i].toLong()) 992 } 993 return builder.endVector() 994 } startVectorOfCoOwningReferencesVectornull995 fun startVectorOfCoOwningReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 996 fun addNonOwningReference(builder: FlatBufferBuilder, nonOwningReference: ULong) = builder.addLong(41, nonOwningReference.toLong(), 0) 997 fun addVectorOfNonOwningReferences(builder: FlatBufferBuilder, vectorOfNonOwningReferences: Int) = builder.addOffset(42, vectorOfNonOwningReferences, 0) 998 fun createVectorOfNonOwningReferencesVector(builder: FlatBufferBuilder, data: ULongArray) : Int { 999 builder.startVector(8, data.size, 8) 1000 for (i in data.size - 1 downTo 0) { 1001 builder.addLong(data[i].toLong()) 1002 } 1003 return builder.endVector() 1004 } startVectorOfNonOwningReferencesVectornull1005 fun startVectorOfNonOwningReferencesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8) 1006 fun addAnyUniqueType(builder: FlatBufferBuilder, anyUniqueType: UByte) = builder.addByte(43, anyUniqueType.toByte(), 0) 1007 fun addAnyUnique(builder: FlatBufferBuilder, anyUnique: Int) = builder.addOffset(44, anyUnique, 0) 1008 fun addAnyAmbiguousType(builder: FlatBufferBuilder, anyAmbiguousType: UByte) = builder.addByte(45, anyAmbiguousType.toByte(), 0) 1009 fun addAnyAmbiguous(builder: FlatBufferBuilder, anyAmbiguous: Int) = builder.addOffset(46, anyAmbiguous, 0) 1010 fun addVectorOfEnums(builder: FlatBufferBuilder, vectorOfEnums: Int) = builder.addOffset(47, vectorOfEnums, 0) 1011 fun createVectorOfEnumsVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 1012 builder.startVector(1, data.size, 1) 1013 for (i in data.size - 1 downTo 0) { 1014 builder.addByte(data[i].toByte()) 1015 } 1016 return builder.endVector() 1017 } startVectorOfEnumsVectornull1018 fun startVectorOfEnumsVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 1019 fun addSignedEnum(builder: FlatBufferBuilder, signedEnum: Byte) = builder.addByte(48, signedEnum, -1) 1020 fun addTestrequirednestedflatbuffer(builder: FlatBufferBuilder, testrequirednestedflatbuffer: Int) = builder.addOffset(49, testrequirednestedflatbuffer, 0) 1021 fun createTestrequirednestedflatbufferVector(builder: FlatBufferBuilder, data: UByteArray) : Int { 1022 builder.startVector(1, data.size, 1) 1023 for (i in data.size - 1 downTo 0) { 1024 builder.addByte(data[i].toByte()) 1025 } 1026 return builder.endVector() 1027 } startTestrequirednestedflatbufferVectornull1028 fun startTestrequirednestedflatbufferVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(1, numElems, 1) 1029 fun addScalarKeySortedTables(builder: FlatBufferBuilder, scalarKeySortedTables: Int) = builder.addOffset(50, scalarKeySortedTables, 0) 1030 fun createScalarKeySortedTablesVector(builder: FlatBufferBuilder, data: IntArray) : Int { 1031 builder.startVector(4, data.size, 4) 1032 for (i in data.size - 1 downTo 0) { 1033 builder.addOffset(data[i]) 1034 } 1035 return builder.endVector() 1036 } startScalarKeySortedTablesVectornull1037 fun startScalarKeySortedTablesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4) 1038 fun endMonster(builder: FlatBufferBuilder) : Int { 1039 val o = builder.endTable() 1040 builder.required(o, 10) 1041 return o 1042 } finishMonsterBuffernull1043 fun finishMonsterBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset, "MONS") 1044 fun finishSizePrefixedMonsterBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset, "MONS") 1045 fun __lookup_by_key(obj: Monster?, vectorLocation: Int, key: String, bb: ByteBuffer) : Monster? { 1046 val byteKey = key.toByteArray(java.nio.charset.StandardCharsets.UTF_8) 1047 var span = bb.getInt(vectorLocation - 4) 1048 var start = 0 1049 while (span != 0) { 1050 var middle = span / 2 1051 val tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb) 1052 val comp = compareStrings(__offset(10, bb.capacity() - tableOffset, bb), byteKey, bb) 1053 when { 1054 comp > 0 -> span = middle 1055 comp < 0 -> { 1056 middle++ 1057 start += middle 1058 span -= middle 1059 } 1060 else -> { 1061 return (obj ?: Monster()).__assign(tableOffset, bb) 1062 } 1063 } 1064 } 1065 return null 1066 } 1067 } 1068 } 1069