mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 03:25:07 +00:00
101 lines
2.9 KiB
TypeScript
101 lines
2.9 KiB
TypeScript
// 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';
|
|
|
|
import { Info, InfoT } from '../one/info.js';
|
|
import { Identity, IdentityT } from '../two/identity.js';
|
|
|
|
|
|
export class Header implements flatbuffers.IUnpackableObject<HeaderT> {
|
|
bb: flatbuffers.ByteBuffer|null = null;
|
|
bb_pos: number = 0;
|
|
__init(i:number, bb:flatbuffers.ByteBuffer):Header {
|
|
this.bb_pos = i;
|
|
this.bb = bb;
|
|
return this;
|
|
}
|
|
|
|
static getRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
|
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
}
|
|
|
|
static getSizePrefixedRootAsHeader(bb:flatbuffers.ByteBuffer, obj?:Header):Header {
|
|
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
}
|
|
|
|
info(obj?:Info):Info|null {
|
|
const offset = this.bb!.__offset(this.bb_pos, 4);
|
|
return offset ? (obj || new Info()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
|
}
|
|
|
|
id(obj?:Identity):Identity|null {
|
|
const offset = this.bb!.__offset(this.bb_pos, 6);
|
|
return offset ? (obj || new Identity()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
|
|
}
|
|
|
|
static getFullyQualifiedName(): "Transit.Three.Header" {
|
|
return 'Transit.Three.Header';
|
|
}
|
|
|
|
static startHeader(builder:flatbuffers.Builder):void {
|
|
builder.startObject(2);
|
|
}
|
|
|
|
static addInfo(builder:flatbuffers.Builder, infoOffset:flatbuffers.Offset):void {
|
|
builder.addFieldOffset(0, infoOffset, 0);
|
|
}
|
|
|
|
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset):void {
|
|
builder.addFieldOffset(1, idOffset, 0);
|
|
}
|
|
|
|
static endHeader(builder:flatbuffers.Builder):flatbuffers.Offset {
|
|
const offset = builder.endObject();
|
|
return offset;
|
|
}
|
|
|
|
static finishHeaderBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
|
builder.finish(offset);
|
|
}
|
|
|
|
static finishSizePrefixedHeaderBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
|
builder.finish(offset, undefined, true);
|
|
}
|
|
|
|
|
|
unpack(): HeaderT {
|
|
return new HeaderT(
|
|
(this.info() !== null ? this.info()!.unpack() : null),
|
|
(this.id() !== null ? this.id()!.unpack() : null)
|
|
);
|
|
}
|
|
|
|
|
|
unpackTo(_o: HeaderT): void {
|
|
_o.info = (this.info() !== null ? this.info()!.unpack() : null);
|
|
_o.id = (this.id() !== null ? this.id()!.unpack() : null);
|
|
}
|
|
}
|
|
|
|
export class HeaderT implements flatbuffers.IGeneratedObject {
|
|
constructor(
|
|
public info: InfoT|null = null,
|
|
public id: IdentityT|null = null
|
|
){}
|
|
|
|
|
|
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
|
const info = (this.info !== null ? this.info!.pack(builder) : 0);
|
|
const id = (this.id !== null ? this.id!.pack(builder) : 0);
|
|
|
|
Header.startHeader(builder);
|
|
Header.addInfo(builder, info);
|
|
Header.addId(builder, id);
|
|
|
|
return Header.endHeader(builder);
|
|
}
|
|
}
|