2 // automatically generated by the FlatBuffers compiler, do not modify
5 namespace Apache.Arrow.Flatbuf
9 using global::FlatBuffers;
11 /// Exact decimal value represented as an integer value in two's
12 /// complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers
13 /// are used. The representation uses the endianness indicated
15 internal struct Decimal: IFlatbufferObject
18 public ByteBuffer ByteBuffer { get { return __p.bb; } }
19 public static Decimal GetRootAsDecimal(ByteBuffer _bb) { return GetRootAsDecimal(_bb, new Decimal()); }
20 public static Decimal GetRootAsDecimal(ByteBuffer _bb, Decimal obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
21 public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
22 public Decimal __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
24 /// Total number of decimal digits
25 public int Precision { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
26 /// Number of digits after the decimal point "."
27 public int Scale { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
28 /// Number of bits per value. The only accepted widths are 128 and 256.
29 /// We use bitWidth for consistency with Int::bitWidth.
30 public int BitWidth { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)128; } }
32 public static Offset<Decimal> CreateDecimal(FlatBufferBuilder builder,
36 builder.StartObject(3);
37 Decimal.AddBitWidth(builder, bitWidth);
38 Decimal.AddScale(builder, scale);
39 Decimal.AddPrecision(builder, precision);
40 return Decimal.EndDecimal(builder);
43 public static void StartDecimal(FlatBufferBuilder builder) { builder.StartObject(3); }
44 public static void AddPrecision(FlatBufferBuilder builder, int precision) { builder.AddInt(0, precision, 0); }
45 public static void AddScale(FlatBufferBuilder builder, int scale) { builder.AddInt(1, scale, 0); }
46 public static void AddBitWidth(FlatBufferBuilder builder, int bitWidth) { builder.AddInt(2, bitWidth, 128); }
47 public static Offset<Decimal> EndDecimal(FlatBufferBuilder builder) {
48 int o = builder.EndObject();
49 return new Offset<Decimal>(o);