xref: /aosp_15_r20/external/flatbuffers/tests/union_vector/falling-tub.ts (revision 890232f25432b36107d06881e0a25aaa6b473652)
1// automatically generated by the FlatBuffers compiler, do not modify
2
3import * as flatbuffers from 'flatbuffers';
4
5
6
7export class FallingTub {
8  bb: flatbuffers.ByteBuffer|null = null;
9  bb_pos = 0;
10  __init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
11  this.bb_pos = i;
12  this.bb = bb;
13  return this;
14}
15
16weight():number {
17  return this.bb!.readInt32(this.bb_pos);
18}
19
20mutate_weight(value:number):boolean {
21  this.bb!.writeInt32(this.bb_pos + 0, value);
22  return true;
23}
24
25static getFullyQualifiedName():string {
26  return 'FallingTub';
27}
28
29static sizeOf():number {
30  return 4;
31}
32
33static createFallingTub(builder:flatbuffers.Builder, weight: number):flatbuffers.Offset {
34  builder.prep(4, 4);
35  builder.writeInt32(weight);
36  return builder.offset();
37}
38
39
40unpack(): FallingTubT {
41  return new FallingTubT(
42    this.weight()
43  );
44}
45
46
47unpackTo(_o: FallingTubT): void {
48  _o.weight = this.weight();
49}
50}
51
52export class FallingTubT {
53constructor(
54  public weight: number = 0
55){}
56
57
58pack(builder:flatbuffers.Builder): flatbuffers.Offset {
59  return FallingTub.createFallingTub(builder,
60    this.weight
61  );
62}
63}
64