James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | import * as flatbuffers from 'flatbuffers'; |
| 3 | export class Referrable { |
| 4 | constructor() { |
| 5 | this.bb = null; |
| 6 | this.bb_pos = 0; |
| 7 | } |
| 8 | __init(i, bb) { |
| 9 | this.bb_pos = i; |
| 10 | this.bb = bb; |
| 11 | return this; |
| 12 | } |
| 13 | static getRootAsReferrable(bb, obj) { |
| 14 | return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 15 | } |
| 16 | static getSizePrefixedRootAsReferrable(bb, obj) { |
| 17 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 18 | return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 19 | } |
| 20 | id() { |
| 21 | const offset = this.bb.__offset(this.bb_pos, 4); |
| 22 | return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0'); |
| 23 | } |
| 24 | mutate_id(value) { |
| 25 | const offset = this.bb.__offset(this.bb_pos, 4); |
| 26 | if (offset === 0) { |
| 27 | return false; |
| 28 | } |
| 29 | this.bb.writeUint64(this.bb_pos + offset, value); |
| 30 | return true; |
| 31 | } |
| 32 | static getFullyQualifiedName() { |
| 33 | return 'MyGame.Example.Referrable'; |
| 34 | } |
| 35 | static startReferrable(builder) { |
| 36 | builder.startObject(1); |
| 37 | } |
| 38 | static addId(builder, id) { |
| 39 | builder.addFieldInt64(0, id, BigInt('0')); |
| 40 | } |
| 41 | static endReferrable(builder) { |
| 42 | const offset = builder.endObject(); |
| 43 | return offset; |
| 44 | } |
| 45 | static createReferrable(builder, id) { |
| 46 | Referrable.startReferrable(builder); |
| 47 | Referrable.addId(builder, id); |
| 48 | return Referrable.endReferrable(builder); |
| 49 | } |
| 50 | serialize() { |
| 51 | return this.bb.bytes(); |
| 52 | } |
| 53 | static deserialize(buffer) { |
| 54 | return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer)); |
| 55 | } |
| 56 | unpack() { |
| 57 | return new ReferrableT(this.id()); |
| 58 | } |
| 59 | unpackTo(_o) { |
| 60 | _o.id = this.id(); |
| 61 | } |
| 62 | } |
| 63 | export class ReferrableT { |
| 64 | constructor(id = BigInt('0')) { |
| 65 | this.id = id; |
| 66 | } |
| 67 | pack(builder) { |
| 68 | return Referrable.createReferrable(builder, this.id); |
| 69 | } |
| 70 | } |