Debian Codegraph @

tests/ts/my-game/example/type-aliases.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
8
9 export class TypeAliases implements flatbuffers.IUnpackableObject<TypeAliasesT> {
10 bb: flatbuffers.ByteBuffer|null = null;
11 bb_pos = 0;
12 __init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
13 this.bb_pos = i;
14 this.bb = bb;
15 return this;
16 }
17
18 static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
19 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20 }
21
22 static getSizePrefixedRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
23 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
24 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
25 }
26
27 i8():number {
28 const offset = this.bb!.__offset(this.bb_pos, 4);
29 return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
30 }
31
32 mutate_i8(value:number):boolean {
33 const offset = this.bb!.__offset(this.bb_pos, 4);
34
35 if (offset === 0) {
36 return false;
37 }
38
39 this.bb!.writeInt8(this.bb_pos + offset, value);
40 return true;
41 }
42
43 u8():number {
44 const offset = this.bb!.__offset(this.bb_pos, 6);
45 return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
46 }
47
48 mutate_u8(value:number):boolean {
49 const offset = this.bb!.__offset(this.bb_pos, 6);
50
51 if (offset === 0) {
52 return false;
53 }
54
55 this.bb!.writeUint8(this.bb_pos + offset, value);
56 return true;
57 }
58
59 i16():number {
60 const offset = this.bb!.__offset(this.bb_pos, 8);
61 return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
62 }
63
64 mutate_i16(value:number):boolean {
65 const offset = this.bb!.__offset(this.bb_pos, 8);
66
67 if (offset === 0) {
68 return false;
69 }
70
71 this.bb!.writeInt16(this.bb_pos + offset, value);
72 return true;
73 }
74
75 u16():number {
76 const offset = this.bb!.__offset(this.bb_pos, 10);
77 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
78 }
79
80 mutate_u16(value:number):boolean {
81 const offset = this.bb!.__offset(this.bb_pos, 10);
82
83 if (offset === 0) {
84 return false;
85 }
86
87 this.bb!.writeUint16(this.bb_pos + offset, value);
88 return true;
89 }
90
91 i32():number {
92 const offset = this.bb!.__offset(this.bb_pos, 12);
93 return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
94 }
95
96 mutate_i32(value:number):boolean {
97 const offset = this.bb!.__offset(this.bb_pos, 12);
98
99 if (offset === 0) {
100 return false;
101 }
102
103 this.bb!.writeInt32(this.bb_pos + offset, value);
104 return true;
105 }
106
107 u32():number {
108 const offset = this.bb!.__offset(this.bb_pos, 14);
109 return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
110 }
111
112 mutate_u32(value:number):boolean {
113 const offset = this.bb!.__offset(this.bb_pos, 14);
114
115 if (offset === 0) {
116 return false;
117 }
118
119 this.bb!.writeUint32(this.bb_pos + offset, value);
120 return true;
121 }
122
123 i64():bigint {
124 const offset = this.bb!.__offset(this.bb_pos, 16);
125 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
126 }
127
128 mutate_i64(value:bigint):boolean {
129 const offset = this.bb!.__offset(this.bb_pos, 16);
130
131 if (offset === 0) {
132 return false;
133 }
134
135 this.bb!.writeInt64(this.bb_pos + offset, value);
136 return true;
137 }
138
139 u64():bigint {
140 const offset = this.bb!.__offset(this.bb_pos, 18);
141 return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
142 }
143
144 mutate_u64(value:bigint):boolean {
145 const offset = this.bb!.__offset(this.bb_pos, 18);
146
147 if (offset === 0) {
148 return false;
149 }
150
151 this.bb!.writeUint64(this.bb_pos + offset, value);
152 return true;
153 }
154
155 f32():number {
156 const offset = this.bb!.__offset(this.bb_pos, 20);
157 return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
158 }
159
160 mutate_f32(value:number):boolean {
161 const offset = this.bb!.__offset(this.bb_pos, 20);
162
163 if (offset === 0) {
164 return false;
165 }
166
167 this.bb!.writeFloat32(this.bb_pos + offset, value);
168 return true;
169 }
170
171 f64():number {
172 const offset = this.bb!.__offset(this.bb_pos, 22);
173 return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
174 }
175
176 mutate_f64(value:number):boolean {
177 const offset = this.bb!.__offset(this.bb_pos, 22);
178
179 if (offset === 0) {
180 return false;
181 }
182
183 this.bb!.writeFloat64(this.bb_pos + offset, value);
184 return true;
185 }
186
187 v8(index: number):number|null {
188 const offset = this.bb!.__offset(this.bb_pos, 24);
189 return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
190 }
191
192 v8Length():number {
193 const offset = this.bb!.__offset(this.bb_pos, 24);
194 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
195 }
196
197 v8Array():Int8Array|null {
198 const offset = this.bb!.__offset(this.bb_pos, 24);
199 return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
200 }
201
202 vf64(index: number):number|null {
203 const offset = this.bb!.__offset(this.bb_pos, 26);
204 return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
205 }
206
207 vf64Length():number {
208 const offset = this.bb!.__offset(this.bb_pos, 26);
209 return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
210 }
211
212 vf64Array():Float64Array|null {
213 const offset = this.bb!.__offset(this.bb_pos, 26);
214 return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
215 }
216
217 static getFullyQualifiedName():string {
218 return 'MyGame.Example.TypeAliases';
219 }
220
221 static startTypeAliases(builder:flatbuffers.Builder) {
222 builder.startObject(12);
223 }
224
225 static addI8(builder:flatbuffers.Builder, i8:number) {
226 builder.addFieldInt8(0, i8, 0);
227 }
228
229 static addU8(builder:flatbuffers.Builder, u8:number) {
230 builder.addFieldInt8(1, u8, 0);
231 }
232
233 static addI16(builder:flatbuffers.Builder, i16:number) {
234 builder.addFieldInt16(2, i16, 0);
235 }
236
237 static addU16(builder:flatbuffers.Builder, u16:number) {
238 builder.addFieldInt16(3, u16, 0);
239 }
240
241 static addI32(builder:flatbuffers.Builder, i32:number) {
242 builder.addFieldInt32(4, i32, 0);
243 }
244
245 static addU32(builder:flatbuffers.Builder, u32:number) {
246 builder.addFieldInt32(5, u32, 0);
247 }
248
249 static addI64(builder:flatbuffers.Builder, i64:bigint) {
250 builder.addFieldInt64(6, i64, BigInt('0'));
251 }
252
253 static addU64(builder:flatbuffers.Builder, u64:bigint) {
254 builder.addFieldInt64(7, u64, BigInt('0'));
255 }
256
257 static addF32(builder:flatbuffers.Builder, f32:number) {
258 builder.addFieldFloat32(8, f32, 0.0);
259 }
260
261 static addF64(builder:flatbuffers.Builder, f64:number) {
262 builder.addFieldFloat64(9, f64, 0.0);
263 }
264
265 static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) {
266 builder.addFieldOffset(10, v8Offset, 0);
267 }
268
269 static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array):flatbuffers.Offset;
270 /**
271 * @deprecated This Uint8Array overload will be removed in the future.
272 */
273 static createV8Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
274 static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array|Uint8Array):flatbuffers.Offset {
275 builder.startVector(1, data.length, 1);
276 for (let i = data.length - 1; i >= 0; i--) {
277 builder.addInt8(data[i]!);
278 }
279 return builder.endVector();
280 }
281
282 static startV8Vector(builder:flatbuffers.Builder, numElems:number) {
283 builder.startVector(1, numElems, 1);
284 }
285
286 static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) {
287 builder.addFieldOffset(11, vf64Offset, 0);
288 }
289
290 static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset;
291 /**
292 * @deprecated This Uint8Array overload will be removed in the future.
293 */
294 static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
295 static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
296 builder.startVector(8, data.length, 8);
297 for (let i = data.length - 1; i >= 0; i--) {
298 builder.addFloat64(data[i]!);
299 }
300 return builder.endVector();
301 }
302
303 static startVf64Vector(builder:flatbuffers.Builder, numElems:number) {
304 builder.startVector(8, numElems, 8);
305 }
306
307 static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
308 const offset = builder.endObject();
309 return offset;
310 }
311
312 static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
313 TypeAliases.startTypeAliases(builder);
314 TypeAliases.addI8(builder, i8);
315 TypeAliases.addU8(builder, u8);
316 TypeAliases.addI16(builder, i16);
317 TypeAliases.addU16(builder, u16);
318 TypeAliases.addI32(builder, i32);
319 TypeAliases.addU32(builder, u32);
320 TypeAliases.addI64(builder, i64);
321 TypeAliases.addU64(builder, u64);
322 TypeAliases.addF32(builder, f32);
323 TypeAliases.addF64(builder, f64);
324 TypeAliases.addV8(builder, v8Offset);
325 TypeAliases.addVf64(builder, vf64Offset);
326 return TypeAliases.endTypeAliases(builder);
327 }
328
329 serialize():Uint8Array {
330 return this.bb!.bytes();
331 }
332
333 static deserialize(buffer: Uint8Array):TypeAliases {
334 return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer))
335 }
336
337 unpack(): TypeAliasesT {
338 return new TypeAliasesT(
339 this.i8(),
340 this.u8(),
341 this.i16(),
342 this.u16(),
343 this.i32(),
344 this.u32(),
345 this.i64(),
346 this.u64(),
347 this.f32(),
348 this.f64(),
349 this.bb!.createScalarList<number>(this.v8.bind(this), this.v8Length()),
350 this.bb!.createScalarList<number>(this.vf64.bind(this), this.vf64Length())
351 );
352 }
353
354
355 unpackTo(_o: TypeAliasesT): void {
356 _o.i8 = this.i8();
357 _o.u8 = this.u8();
358 _o.i16 = this.i16();
359 _o.u16 = this.u16();
360 _o.i32 = this.i32();
361 _o.u32 = this.u32();
362 _o.i64 = this.i64();
363 _o.u64 = this.u64();
364 _o.f32 = this.f32();
365 _o.f64 = this.f64();
366 _o.v8 = this.bb!.createScalarList<number>(this.v8.bind(this), this.v8Length());
367 _o.vf64 = this.bb!.createScalarList<number>(this.vf64.bind(this), this.vf64Length());
368 }
369 }
370
371 export class TypeAliasesT implements flatbuffers.IGeneratedObject {
372 constructor(
373 public i8: number = 0,
374 public u8: number = 0,
375 public i16: number = 0,
376 public u16: number = 0,
377 public i32: number = 0,
378 public u32: number = 0,
379 public i64: bigint = BigInt('0'),
380 public u64: bigint = BigInt('0'),
381 public f32: number = 0.0,
382 public f64: number = 0.0,
383 public v8: (number)[] = [],
384 public vf64: (number)[] = []
385 ){}
386
387
388 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
389 const v8 = TypeAliases.createV8Vector(builder, this.v8);
390 const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
391
392 return TypeAliases.createTypeAliases(builder,
393 this.i8,
394 this.u8,
395 this.i16,
396 this.u16,
397 this.i32,
398 this.u32,
399 this.i64,
400 this.u64,
401 this.f32,
402 this.f64,
403 v8,
404 vf64
405 );
406 }
407 }