Debian Codegraph @

tests/ts/my-game/example/struct-of-structs-of-structs.ts

raw
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
5 import * as flatbuffers from 'flatbuffers';
6
7 import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
8
9
10 export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
11 bb: flatbuffers.ByteBuffer|null = null;
12 bb_pos = 0;
13 __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
14 this.bb_pos = i;
15 this.bb = bb;
16 return this;
17 }
18
19 a(obj?:StructOfStructs):StructOfStructs|null {
20 return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
21 }
22
23 static getFullyQualifiedName():string {
24 return 'MyGame.Example.StructOfStructsOfStructs';
25 }
26
27 static sizeOf():number {
28 return 20;
29 }
30
31 static createStructOfStructsOfStructs(builder:flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number):flatbuffers.Offset {
32 builder.prep(4, 20);
33 builder.prep(4, 20);
34 builder.prep(4, 8);
35 builder.writeInt32(a_c_distance);
36 builder.writeInt32(a_c_id);
37 builder.prep(2, 4);
38 builder.pad(1);
39 builder.writeInt8(a_b_b);
40 builder.writeInt16(a_b_a);
41 builder.prep(4, 8);
42 builder.writeInt32(a_a_distance);
43 builder.writeInt32(a_a_id);
44 return builder.offset();
45 }
46
47
48 unpack(): StructOfStructsOfStructsT {
49 return new StructOfStructsOfStructsT(
50 (this.a() !== null ? this.a()!.unpack() : null)
51 );
52 }
53
54
55 unpackTo(_o: StructOfStructsOfStructsT): void {
56 _o.a = (this.a() !== null ? this.a()!.unpack() : null);
57 }
58 }
59
60 export class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject {
61 constructor(
62 public a: StructOfStructsT|null = null
63 ){}
64
65
66 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
67 return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder,
68 (this.a?.a?.id ?? 0),
69 (this.a?.a?.distance ?? 0),
70 (this.a?.b?.a ?? 0),
71 (this.a?.b?.b ?? 0),
72 (this.a?.c?.id ?? 0),
73 (this.a?.c?.distance ?? 0)
74 );
75 }
76 }