• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
3export class OuterStruct {
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    a() {
14        return !!this.bb.readInt8(this.bb_pos);
15    }
16    b() {
17        return this.bb.readFloat64(this.bb_pos + 8);
18    }
19    cUnderscore(obj) {
20        return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
21    }
22    d(index, obj) {
23        return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
24    }
25    e(obj) {
26        return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
27    }
28    f(index) {
29        return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
30    }
31    static getFullyQualifiedName() {
32        return 'MyGame.Example.OuterStruct';
33    }
34    static sizeOf() {
35        return 208;
36    }
37    static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
38        builder.prep(8, 208);
39        for (let i = 3; i >= 0; --i) {
40            builder.writeFloat64((f?.[i] ?? 0));
41        }
42        builder.prep(8, 32);
43        builder.writeInt64(BigInt(e_d_underscore ?? 0));
44        builder.pad(2);
45        builder.writeInt8(e_c);
46        for (let i = 12; i >= 0; --i) {
47            builder.writeInt8((e_b?.[i] ?? 0));
48        }
49        builder.writeFloat64(e_a);
50        for (let i = 2; i >= 0; --i) {
51            const item = d?.[i];
52            if (item instanceof InnerStructT) {
53                item.pack(builder);
54                continue;
55            }
56            InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
57        }
58        builder.prep(8, 32);
59        builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
60        builder.pad(2);
61        builder.writeInt8(c_underscore_c);
62        for (let i = 12; i >= 0; --i) {
63            builder.writeInt8((c_underscore_b?.[i] ?? 0));
64        }
65        builder.writeFloat64(c_underscore_a);
66        builder.writeFloat64(b);
67        builder.pad(7);
68        builder.writeInt8(Number(Boolean(a)));
69        return builder.offset();
70    }
71    unpack() {
72        return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
73    }
74    unpackTo(_o) {
75        _o.a = this.a();
76        _o.b = this.b();
77        _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
78        _o.d = this.bb.createObjList(this.d.bind(this), 3);
79        _o.e = (this.e() !== null ? this.e().unpack() : null);
80        _o.f = this.bb.createScalarList(this.f.bind(this), 4);
81    }
82}
83export class OuterStructT {
84    constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
85        this.a = a;
86        this.b = b;
87        this.cUnderscore = cUnderscore;
88        this.d = d;
89        this.e = e;
90        this.f = f;
91    }
92    pack(builder) {
93        return OuterStruct.createOuterStruct(builder, this.a, this.b, (this.cUnderscore?.a ?? 0), (this.cUnderscore?.b ?? []), (this.cUnderscore?.c ?? 0), (this.cUnderscore?.dUnderscore ?? BigInt(0)), this.d, (this.e?.a ?? 0), (this.e?.b ?? []), (this.e?.c ?? 0), (this.e?.dUnderscore ?? BigInt(0)), this.f);
94    }
95}
96