supercat666's picture
add igv
78c921d
raw
history blame
5.13 kB
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { Endianness } from './endianness.js';
import { Field } from './field.js';
import { KeyValue } from './key-value.js';
/**
* ----------------------------------------------------------------------
* A Schema describes the columns in a row batch
*/
export class Schema {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Schema {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
/**
* endianness of the buffer
* it is Little Endian by default
* if endianness doesn't match the underlying system then the vectors need to be converted
*/
endianness():Endianness {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : Endianness.Little;
}
fields(index: number, obj?:Field):Field|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? (obj || new Field()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
fieldsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
customMetadata(index: number, obj?:KeyValue):KeyValue|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
customMetadataLength():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
/**
* Features used in the stream/file.
*/
features(index: number):flatbuffers.Long|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : this.bb!.createLong(0, 0);
}
featuresLength():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static startSchema(builder:flatbuffers.Builder) {
builder.startObject(4);
}
static addEndianness(builder:flatbuffers.Builder, endianness:Endianness) {
builder.addFieldInt16(0, endianness, Endianness.Little);
}
static addFields(builder:flatbuffers.Builder, fieldsOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, fieldsOffset, 0);
}
static createFieldsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startFieldsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addCustomMetadata(builder:flatbuffers.Builder, customMetadataOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, customMetadataOffset, 0);
}
static createCustomMetadataVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startCustomMetadataVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addFeatures(builder:flatbuffers.Builder, featuresOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, featuresOffset, 0);
}
static createFeaturesVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
builder.startVector(8, data.length, 8);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt64(data[i]!);
}
return builder.endVector();
}
static startFeaturesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static endSchema(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset);
}
static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, undefined, true);
}
static createSchema(builder:flatbuffers.Builder, endianness:Endianness, fieldsOffset:flatbuffers.Offset, customMetadataOffset:flatbuffers.Offset, featuresOffset:flatbuffers.Offset):flatbuffers.Offset {
Schema.startSchema(builder);
Schema.addEndianness(builder, endianness);
Schema.addFields(builder, fieldsOffset);
Schema.addCustomMetadata(builder, customMetadataOffset);
Schema.addFeatures(builder, featuresOffset);
return Schema.endSchema(builder);
}
}