blob: 46eec4344144c58a54b693b7d77362290605fc66 [file] [log] [blame]
James Kuszmaul8e62b022022-03-22 09:33:25 -07001// automatically generated by the FlatBuffers compiler, do not modify
2import * as flatbuffers from 'flatbuffers';
3export class Stat {
4 constructor() {
5 this.bb = null;
6 this.bb_pos = 0;
7 }
8 __init(i, bb) {
9 this.bb_pos = i;
10 this.bb = bb;
11 return this;
12 }
13 static getRootAsStat(bb, obj) {
14 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
15 }
16 static getSizePrefixedRootAsStat(bb, obj) {
17 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
18 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19 }
20 id(optionalEncoding) {
21 const offset = this.bb.__offset(this.bb_pos, 4);
22 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
23 }
24 val() {
25 const offset = this.bb.__offset(this.bb_pos, 6);
26 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
27 }
28 mutate_val(value) {
29 const offset = this.bb.__offset(this.bb_pos, 6);
30 if (offset === 0) {
31 return false;
32 }
33 this.bb.writeInt64(this.bb_pos + offset, value);
34 return true;
35 }
36 count() {
37 const offset = this.bb.__offset(this.bb_pos, 8);
38 return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
39 }
40 mutate_count(value) {
41 const offset = this.bb.__offset(this.bb_pos, 8);
42 if (offset === 0) {
43 return false;
44 }
45 this.bb.writeUint16(this.bb_pos + offset, value);
46 return true;
47 }
48 static getFullyQualifiedName() {
49 return 'MyGame.Example.Stat';
50 }
51 static startStat(builder) {
52 builder.startObject(3);
53 }
54 static addId(builder, idOffset) {
55 builder.addFieldOffset(0, idOffset, 0);
56 }
57 static addVal(builder, val) {
58 builder.addFieldInt64(1, val, BigInt('0'));
59 }
60 static addCount(builder, count) {
61 builder.addFieldInt16(2, count, 0);
62 }
63 static endStat(builder) {
64 const offset = builder.endObject();
65 return offset;
66 }
67 static createStat(builder, idOffset, val, count) {
68 Stat.startStat(builder);
69 Stat.addId(builder, idOffset);
70 Stat.addVal(builder, val);
71 Stat.addCount(builder, count);
72 return Stat.endStat(builder);
73 }
74 serialize() {
75 return this.bb.bytes();
76 }
77 static deserialize(buffer) {
78 return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
79 }
80 unpack() {
81 return new StatT(this.id(), this.val(), this.count());
82 }
83 unpackTo(_o) {
84 _o.id = this.id();
85 _o.val = this.val();
86 _o.count = this.count();
87 }
88}
89export class StatT {
90 constructor(id = null, val = BigInt('0'), count = 0) {
91 this.id = id;
92 this.val = val;
93 this.count = count;
94 }
95 pack(builder) {
96 const id = (this.id !== null ? builder.createString(this.id) : 0);
97 return Stat.createStat(builder, id, this.val, this.count);
98 }
99}