// automatically generated by the FlatBuffers compiler, do not modify import * as flatbuffers from 'flatbuffers'; import { EnumInNestedNS } from '../namespace-a/namespace-b/enum-in-nested-n-s'; import { StructInNestedNS, StructInNestedNST } from '../namespace-a/namespace-b/struct-in-nested-n-s'; import { TableInNestedNS, TableInNestedNST } from '../namespace-a/namespace-b/table-in-nested-n-s'; import { UnionInNestedNS, unionToUnionInNestedNS, unionListToUnionInNestedNS } from '../namespace-a/namespace-b/union-in-nested-n-s'; export class TableInFirstNS { bb: flatbuffers.ByteBuffer|null = null; bb_pos = 0; __init(i:number, bb:flatbuffers.ByteBuffer):TableInFirstNS { this.bb_pos = i; this.bb = bb; return this; } static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS { return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } fooTable(obj?:TableInNestedNS):TableInNestedNS|null { const offset = this.bb!.__offset(this.bb_pos, 4); return offset ? (obj || new TableInNestedNS()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; } fooEnum():EnumInNestedNS { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.readInt8(this.bb_pos + offset) : EnumInNestedNS.A; } mutate_foo_enum(value:EnumInNestedNS):boolean { const offset = this.bb!.__offset(this.bb_pos, 6); if (offset === 0) { return false; } this.bb!.writeInt8(this.bb_pos + offset, value); return true; } fooUnionType():UnionInNestedNS { const offset = this.bb!.__offset(this.bb_pos, 8); return offset ? this.bb!.readUint8(this.bb_pos + offset) : UnionInNestedNS.NONE; } fooUnion(obj:any):any|null { const offset = this.bb!.__offset(this.bb_pos, 10); return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; } fooStruct(obj?:StructInNestedNS):StructInNestedNS|null { const offset = this.bb!.__offset(this.bb_pos, 12); return offset ? (obj || new StructInNestedNS()).__init(this.bb_pos + offset, this.bb!) : null; } static getFullyQualifiedName():string { return 'NamespaceA.TableInFirstNS'; } static startTableInFirstNS(builder:flatbuffers.Builder) { builder.startObject(5); } static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offset) { builder.addFieldOffset(0, fooTableOffset, 0); } static addFooEnum(builder:flatbuffers.Builder, fooEnum:EnumInNestedNS) { builder.addFieldInt8(1, fooEnum, EnumInNestedNS.A); } static addFooUnionType(builder:flatbuffers.Builder, fooUnionType:UnionInNestedNS) { builder.addFieldInt8(2, fooUnionType, UnionInNestedNS.NONE); } static addFooUnion(builder:flatbuffers.Builder, fooUnionOffset:flatbuffers.Offset) { builder.addFieldOffset(3, fooUnionOffset, 0); } static addFooStruct(builder:flatbuffers.Builder, fooStructOffset:flatbuffers.Offset) { builder.addFieldStruct(4, fooStructOffset, 0); } static endTableInFirstNS(builder:flatbuffers.Builder):flatbuffers.Offset { const offset = builder.endObject(); return offset; } unpack(): TableInFirstNST { return new TableInFirstNST( (this.fooTable() !== null ? this.fooTable()!.unpack() : null), this.fooEnum(), this.fooUnionType(), (() => { let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this)); if(temp === null) { return null; } return temp.unpack() })(), (this.fooStruct() !== null ? this.fooStruct()!.unpack() : null) ); } unpackTo(_o: TableInFirstNST): void { _o.fooTable = (this.fooTable() !== null ? this.fooTable()!.unpack() : null); _o.fooEnum = this.fooEnum(); _o.fooUnionType = this.fooUnionType(); _o.fooUnion = (() => { let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this)); if(temp === null) { return null; } return temp.unpack() })(); _o.fooStruct = (this.fooStruct() !== null ? this.fooStruct()!.unpack() : null); } } export class TableInFirstNST { constructor( public fooTable: TableInNestedNST|null = null, public fooEnum: EnumInNestedNS = EnumInNestedNS.A, public fooUnionType: UnionInNestedNS = UnionInNestedNS.NONE, public fooUnion: TableInNestedNST|null = null, public fooStruct: StructInNestedNST|null = null ){} pack(builder:flatbuffers.Builder): flatbuffers.Offset { const fooTable = (this.fooTable !== null ? this.fooTable!.pack(builder) : 0); const fooUnion = builder.createObjectOffset(this.fooUnion); TableInFirstNS.startTableInFirstNS(builder); TableInFirstNS.addFooTable(builder, fooTable); TableInFirstNS.addFooEnum(builder, this.fooEnum); TableInFirstNS.addFooUnionType(builder, this.fooUnionType); TableInFirstNS.addFooUnion(builder, fooUnion); TableInFirstNS.addFooStruct(builder, (this.fooStruct !== null ? this.fooStruct!.pack(builder) : 0)); return TableInFirstNS.endTableInFirstNS(builder); } }