Debian Codegraph @

tests/ts/arrays_test_complex/my-game/example/outer-struct.ts

raw symbols SCIP
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 { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
8
9
10 export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
11 bb: flatbuffers.ByteBuffer|null = null;
12 bb_pos = 0;
13 __init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
14 this.bb_pos = i;
15 this.bb = bb;
16 return this;
17 }
18
19 a():boolean {
20 return !!this.bb!.readInt8(this.bb_pos);
21 }
22
23 b():number {
24 return this.bb!.readFloat64(this.bb_pos + 8);
25 }
26
27 cUnderscore(obj?:InnerStruct):InnerStruct|null {
28 return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
29 }
30
31 d(index: number, obj?:InnerStruct):InnerStruct|null {
32 return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
33 }
34
35 e(obj?:InnerStruct):InnerStruct|null {
36 return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
37 }
38
39 f(index: number):number|null {
40 return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
41 }
42
43 static getFullyQualifiedName():string {
44 return 'MyGame.Example.OuterStruct';
45 }
46
47 static sizeOf():number {
48 return 208;
49 }
50
51 static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
52 builder.prep(8, 208);
53
54 for (let i = 3; i >= 0; --i) {
55 builder.writeFloat64((f?.[i] ?? 0));
56
57 }
58
59 builder.prep(8, 32);
60 builder.writeInt64(BigInt(e_d_underscore ?? 0));
61 builder.pad(2);
62 builder.writeInt8(e_c);
63
64 for (let i = 12; i >= 0; --i) {
65 builder.writeInt8((e_b?.[i] ?? 0));
66
67 }
68
69 builder.writeFloat64(e_a);
70
71 for (let i = 2; i >= 0; --i) {
72 const item = d?.[i];
73
74 if (item instanceof InnerStructT) {
75 item.pack(builder);
76 continue;
77 }
78
79 InnerStruct.createInnerStruct(builder,
80 item?.a,
81 item?.b,
82 item?.c,
83 item?.dUnderscore
84 );
85 }
86
87 builder.prep(8, 32);
88 builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
89 builder.pad(2);
90 builder.writeInt8(c_underscore_c);
91
92 for (let i = 12; i >= 0; --i) {
93 builder.writeInt8((c_underscore_b?.[i] ?? 0));
94
95 }
96
97 builder.writeFloat64(c_underscore_a);
98 builder.writeFloat64(b);
99 builder.pad(7);
100 builder.writeInt8(Number(Boolean(a)));
101 return builder.offset();
102 }
103
104
105 unpack(): OuterStructT {
106 return new OuterStructT(
107 this.a(),
108 this.b(),
109 (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
110 this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
111 (this.e() !== null ? this.e()!.unpack() : null),
112 this.bb!.createScalarList<number>(this.f.bind(this), 4)
113 );
114 }
115
116
117 unpackTo(_o: OuterStructT): void {
118 _o.a = this.a();
119 _o.b = this.b();
120 _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
121 _o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
122 _o.e = (this.e() !== null ? this.e()!.unpack() : null);
123 _o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
124 }
125 }
126
127 export class OuterStructT implements flatbuffers.IGeneratedObject {
128 constructor(
129 public a: boolean = false,
130 public b: number = 0.0,
131 public cUnderscore: InnerStructT|null = null,
132 public d: (InnerStructT)[] = [],
133 public e: InnerStructT|null = null,
134 public f: (number)[] = []
135 ){}
136
137
138 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
139 return OuterStruct.createOuterStruct(builder,
140 this.a,
141 this.b,
142 (this.cUnderscore?.a ?? 0),
143 (this.cUnderscore?.b ?? []),
144 (this.cUnderscore?.c ?? 0),
145 (this.cUnderscore?.dUnderscore ?? BigInt(0)),
146 this.d,
147 (this.e?.a ?? 0),
148 (this.e?.b ?? []),
149 (this.e?.c ?? 0),
150 (this.e?.dUnderscore ?? BigInt(0)),
151 this.f
152 );
153 }
154 }