Debian Codegraph @

tests/ts/my-game/example/stat.ts

raw symbols SCIP
1 // automatically generated by the FlatBuffers compiler, do not modify
2
3 import * as flatbuffers from 'flatbuffers';
4
5
6
7 export class Stat implements flatbuffers.IUnpackableObject<StatT> {
8 bb: flatbuffers.ByteBuffer|null = null;
9 bb_pos = 0;
10 __init(i:number, bb:flatbuffers.ByteBuffer):Stat {
11 this.bb_pos = i;
12 this.bb = bb;
13 return this;
14 }
15
16 static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
17 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18 }
19
20 static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
21 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23 }
24
25 id():string|null
26 id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
27 id(optionalEncoding?:any):string|Uint8Array|null {
28 const offset = this.bb!.__offset(this.bb_pos, 4);
29 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
30 }
31
32 val():bigint {
33 const offset = this.bb!.__offset(this.bb_pos, 6);
34 return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
35 }
36
37 mutate_val(value:bigint):boolean {
38 const offset = this.bb!.__offset(this.bb_pos, 6);
39
40 if (offset === 0) {
41 return false;
42 }
43
44 this.bb!.writeInt64(this.bb_pos + offset, value);
45 return true;
46 }
47
48 count():number {
49 const offset = this.bb!.__offset(this.bb_pos, 8);
50 return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
51 }
52
53 mutate_count(value:number):boolean {
54 const offset = this.bb!.__offset(this.bb_pos, 8);
55
56 if (offset === 0) {
57 return false;
58 }
59
60 this.bb!.writeUint16(this.bb_pos + offset, value);
61 return true;
62 }
63
64 static getFullyQualifiedName():string {
65 return 'MyGame.Example.Stat';
66 }
67
68 static startStat(builder:flatbuffers.Builder) {
69 builder.startObject(3);
70 }
71
72 static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
73 builder.addFieldOffset(0, idOffset, 0);
74 }
75
76 static addVal(builder:flatbuffers.Builder, val:bigint) {
77 builder.addFieldInt64(1, val, BigInt('0'));
78 }
79
80 static addCount(builder:flatbuffers.Builder, count:number) {
81 builder.addFieldInt16(2, count, 0);
82 }
83
84 static endStat(builder:flatbuffers.Builder):flatbuffers.Offset {
85 const offset = builder.endObject();
86 return offset;
87 }
88
89 static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset {
90 Stat.startStat(builder);
91 Stat.addId(builder, idOffset);
92 Stat.addVal(builder, val);
93 Stat.addCount(builder, count);
94 return Stat.endStat(builder);
95 }
96
97 serialize():Uint8Array {
98 return this.bb!.bytes();
99 }
100
101 static deserialize(buffer: Uint8Array):Stat {
102 return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer))
103 }
104
105 unpack(): StatT {
106 return new StatT(
107 this.id(),
108 this.val(),
109 this.count()
110 );
111 }
112
113
114 unpackTo(_o: StatT): void {
115 _o.id = this.id();
116 _o.val = this.val();
117 _o.count = this.count();
118 }
119 }
120
121 export class StatT implements flatbuffers.IGeneratedObject {
122 constructor(
123 public id: string|Uint8Array|null = null,
124 public val: bigint = BigInt('0'),
125 public count: number = 0
126 ){}
127
128
129 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
130 const id = (this.id !== null ? builder.createString(this.id!) : 0);
131
132 return Stat.createStat(builder,
133 id,
134 this.val,
135 this.count
136 );
137 }
138 }