Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | import * as flatbuffers from 'flatbuffers'; |
| 4 | |
| 5 | |
| 6 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 7 | export class Test implements flatbuffers.IUnpackableObject<TestT> { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 8 | bb: flatbuffers.ByteBuffer|null = null; |
| 9 | bb_pos = 0; |
| 10 | __init(i:number, bb:flatbuffers.ByteBuffer):Test { |
| 11 | this.bb_pos = i; |
| 12 | this.bb = bb; |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | a():number { |
| 17 | return this.bb!.readInt16(this.bb_pos); |
| 18 | } |
| 19 | |
| 20 | mutate_a(value:number):boolean { |
| 21 | this.bb!.writeInt16(this.bb_pos + 0, value); |
| 22 | return true; |
| 23 | } |
| 24 | |
| 25 | b():number { |
| 26 | return this.bb!.readInt8(this.bb_pos + 2); |
| 27 | } |
| 28 | |
| 29 | mutate_b(value:number):boolean { |
| 30 | this.bb!.writeInt8(this.bb_pos + 2, value); |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | static getFullyQualifiedName():string { |
| 35 | return 'MyGame_Example_Test'; |
| 36 | } |
| 37 | |
| 38 | static sizeOf():number { |
| 39 | return 4; |
| 40 | } |
| 41 | |
| 42 | static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset { |
| 43 | builder.prep(2, 4); |
| 44 | builder.pad(1); |
| 45 | builder.writeInt8(b); |
| 46 | builder.writeInt16(a); |
| 47 | return builder.offset(); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | unpack(): TestT { |
| 52 | return new TestT( |
| 53 | this.a(), |
| 54 | this.b() |
| 55 | ); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | unpackTo(_o: TestT): void { |
| 60 | _o.a = this.a(); |
| 61 | _o.b = this.b(); |
| 62 | } |
| 63 | } |
| 64 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 65 | export class TestT implements flatbuffers.IGeneratedObject { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 66 | constructor( |
| 67 | public a: number = 0, |
| 68 | public b: number = 0 |
| 69 | ){} |
| 70 | |
| 71 | |
| 72 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 73 | return Test.createTest(builder, |
| 74 | this.a, |
| 75 | this.b |
| 76 | ); |
| 77 | } |
| 78 | } |