• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2
3/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
5import * as flatbuffers from 'flatbuffers';
6
7import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
8import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
9
10
11export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
12  bb: flatbuffers.ByteBuffer|null = null;
13  bb_pos = 0;
14  __init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
15  this.bb_pos = i;
16  this.bb = bb;
17  return this;
18}
19
20aUnderscore():number {
21  return this.bb!.readFloat32(this.bb_pos);
22}
23
24bUnderscore(index: number):number|null {
25    return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
26}
27
28c():number {
29  return this.bb!.readInt8(this.bb_pos + 64);
30}
31
32d(index: number, obj?:NestedStruct):NestedStruct|null {
33    return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
34}
35
36e():number {
37  return this.bb!.readInt32(this.bb_pos + 2216);
38}
39
40f(index: number, obj?:OuterStruct):OuterStruct|null {
41    return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
42}
43
44g(index: number):bigint|null {
45    return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
46}
47
48static getFullyQualifiedName():string {
49  return 'MyGame.Example.ArrayStruct';
50}
51
52static sizeOf():number {
53  return 2656;
54}
55
56static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
57  builder.prep(8, 2656);
58
59  for (let i = 1; i >= 0; --i) {
60    builder.writeInt64(BigInt(g?.[i] ?? 0));
61  }
62
63
64  for (let i = 1; i >= 0; --i) {
65    const item = f?.[i];
66
67    if (item instanceof OuterStructT) {
68      item.pack(builder);
69      continue;
70    }
71
72    OuterStruct.createOuterStruct(builder,
73    item?.a,
74    item?.b,
75    (item?.cUnderscore?.a ?? 0),
76    (item?.cUnderscore?.b ?? []),
77    (item?.cUnderscore?.c ?? 0),
78    (item?.cUnderscore?.dUnderscore ?? BigInt(0)),
79    item?.d,
80    (item?.e?.a ?? 0),
81    (item?.e?.b ?? []),
82    (item?.e?.c ?? 0),
83    (item?.e?.dUnderscore ?? BigInt(0)),
84    item?.f
85    );
86  }
87
88  builder.pad(4);
89  builder.writeInt32(e);
90
91  for (let i = 1; i >= 0; --i) {
92    const item = d?.[i];
93
94    if (item instanceof NestedStructT) {
95      item.pack(builder);
96      continue;
97    }
98
99    NestedStruct.createNestedStruct(builder,
100    item?.a,
101    item?.b,
102    item?.cUnderscore,
103    item?.dOuter,
104    item?.e
105    );
106  }
107
108  builder.pad(7);
109  builder.writeInt8(c);
110
111  for (let i = 14; i >= 0; --i) {
112    builder.writeInt32((b_underscore?.[i] ?? 0));
113
114  }
115
116  builder.writeFloat32(a_underscore);
117  return builder.offset();
118}
119
120
121unpack(): ArrayStructT {
122  return new ArrayStructT(
123    this.aUnderscore(),
124    this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
125    this.c(),
126    this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
127    this.e(),
128    this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
129    this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
130  );
131}
132
133
134unpackTo(_o: ArrayStructT): void {
135  _o.aUnderscore = this.aUnderscore();
136  _o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
137  _o.c = this.c();
138  _o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
139  _o.e = this.e();
140  _o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
141  _o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
142}
143}
144
145export class ArrayStructT implements flatbuffers.IGeneratedObject {
146constructor(
147  public aUnderscore: number = 0.0,
148  public bUnderscore: (number)[] = [],
149  public c: number = 0,
150  public d: (NestedStructT)[] = [],
151  public e: number = 0,
152  public f: (OuterStructT)[] = [],
153  public g: (bigint)[] = []
154){}
155
156
157pack(builder:flatbuffers.Builder): flatbuffers.Offset {
158  return ArrayStruct.createArrayStruct(builder,
159    this.aUnderscore,
160    this.bUnderscore,
161    this.c,
162    this.d,
163    this.e,
164    this.f,
165    this.g
166  );
167}
168}
169