Spaces:
Runtime error
Runtime error
| // automatically generated by the FlatBuffers compiler, do not modify | |
| import * as flatbuffers from 'flatbuffers'; | |
| /** | |
| * Exact decimal value represented as an integer value in two's | |
| * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers | |
| * are used. The representation uses the endianness indicated | |
| * in the Schema. | |
| */ | |
| export class Decimal { | |
| bb: flatbuffers.ByteBuffer|null = null; | |
| bb_pos = 0; | |
| __init(i:number, bb:flatbuffers.ByteBuffer):Decimal { | |
| this.bb_pos = i; | |
| this.bb = bb; | |
| return this; | |
| } | |
| static getRootAsDecimal(bb:flatbuffers.ByteBuffer, obj?:Decimal):Decimal { | |
| return (obj || new Decimal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); | |
| } | |
| static getSizePrefixedRootAsDecimal(bb:flatbuffers.ByteBuffer, obj?:Decimal):Decimal { | |
| bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); | |
| return (obj || new Decimal()).__init(bb.readInt32(bb.position()) + bb.position(), bb); | |
| } | |
| /** | |
| * Total number of decimal digits | |
| */ | |
| precision():number { | |
| const offset = this.bb!.__offset(this.bb_pos, 4); | |
| return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; | |
| } | |
| /** | |
| * Number of digits after the decimal point "." | |
| */ | |
| scale():number { | |
| const offset = this.bb!.__offset(this.bb_pos, 6); | |
| return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; | |
| } | |
| /** | |
| * Number of bits per value. The only accepted widths are 128 and 256. | |
| * We use bitWidth for consistency with Int::bitWidth. | |
| */ | |
| bitWidth():number { | |
| const offset = this.bb!.__offset(this.bb_pos, 8); | |
| return offset ? this.bb!.readInt32(this.bb_pos + offset) : 128; | |
| } | |
| static startDecimal(builder:flatbuffers.Builder) { | |
| builder.startObject(3); | |
| } | |
| static addPrecision(builder:flatbuffers.Builder, precision:number) { | |
| builder.addFieldInt32(0, precision, 0); | |
| } | |
| static addScale(builder:flatbuffers.Builder, scale:number) { | |
| builder.addFieldInt32(1, scale, 0); | |
| } | |
| static addBitWidth(builder:flatbuffers.Builder, bitWidth:number) { | |
| builder.addFieldInt32(2, bitWidth, 128); | |
| } | |
| static endDecimal(builder:flatbuffers.Builder):flatbuffers.Offset { | |
| const offset = builder.endObject(); | |
| return offset; | |
| } | |
| static createDecimal(builder:flatbuffers.Builder, precision:number, scale:number, bitWidth:number):flatbuffers.Offset { | |
| Decimal.startDecimal(builder); | |
| Decimal.addPrecision(builder, precision); | |
| Decimal.addScale(builder, scale); | |
| Decimal.addBitWidth(builder, bitWidth); | |
| return Decimal.endDecimal(builder); | |
| } | |
| } | |