Files
flatbuffers/tests/ts/relative_imports/transit/two/identity.js

58 lines
1.7 KiB
JavaScript

// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import * as flatbuffers from 'flatbuffers';
export class Identity {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsIdentity(bb, obj) {
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsIdentity(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Identity()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
}
static getFullyQualifiedName() {
return 'Transit.Two.Identity';
}
static startIdentity(builder) {
builder.startObject(1);
}
static addId(builder, id) {
builder.addFieldInt32(0, id, 0);
}
static endIdentity(builder) {
const offset = builder.endObject();
return offset;
}
static createIdentity(builder, id) {
Identity.startIdentity(builder);
Identity.addId(builder, id);
return Identity.endIdentity(builder);
}
unpack() {
return new IdentityT(this.id());
}
unpackTo(_o) {
_o.id = this.id();
}
}
export class IdentityT {
constructor(id = 0) {
this.id = id;
}
pack(builder) {
return Identity.createIdentity(builder, this.id);
}
}