...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/TypeAliases.cs

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1// <auto-generated>
     2//  automatically generated by the FlatBuffers compiler, do not modify
     3// </auto-generated>
     4
     5namespace MyGame.Example
     6{
     7
     8using global::System;
     9using global::System.Collections.Generic;
    10using global::Google.FlatBuffers;
    11
    12public struct TypeAliases : IFlatbufferObject
    13{
    14  private Table __p;
    15  public ByteBuffer ByteBuffer { get { return __p.bb; } }
    16  public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_5_26(); }
    17  public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb) { return GetRootAsTypeAliases(_bb, new TypeAliases()); }
    18  public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
    19  public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
    20  public TypeAliases __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    21
    22  public sbyte I8 { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } }
    23  public bool MutateI8(sbyte i8) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, i8); return true; } else { return false; } }
    24  public byte U8 { get { int o = __p.__offset(6); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
    25  public bool MutateU8(byte u8) { int o = __p.__offset(6); if (o != 0) { __p.bb.Put(o + __p.bb_pos, u8); return true; } else { return false; } }
    26  public short I16 { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetShort(o + __p.bb_pos) : (short)0; } }
    27  public bool MutateI16(short i16) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutShort(o + __p.bb_pos, i16); return true; } else { return false; } }
    28  public ushort U16 { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } }
    29  public bool MutateU16(ushort u16) { int o = __p.__offset(10); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, u16); return true; } else { return false; } }
    30  public int I32 { get { int o = __p.__offset(12); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
    31  public bool MutateI32(int i32) { int o = __p.__offset(12); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, i32); return true; } else { return false; } }
    32  public uint U32 { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } }
    33  public bool MutateU32(uint u32) { int o = __p.__offset(14); if (o != 0) { __p.bb.PutUint(o + __p.bb_pos, u32); return true; } else { return false; } }
    34  public long I64 { get { int o = __p.__offset(16); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }
    35  public bool MutateI64(long i64) { int o = __p.__offset(16); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, i64); return true; } else { return false; } }
    36  public ulong U64 { get { int o = __p.__offset(18); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } }
    37  public bool MutateU64(ulong u64) { int o = __p.__offset(18); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, u64); return true; } else { return false; } }
    38  public float F32 { get { int o = __p.__offset(20); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } }
    39  public bool MutateF32(float f32) { int o = __p.__offset(20); if (o != 0) { __p.bb.PutFloat(o + __p.bb_pos, f32); return true; } else { return false; } }
    40  public double F64 { get { int o = __p.__offset(22); return o != 0 ? __p.bb.GetDouble(o + __p.bb_pos) : (double)0.0; } }
    41  public bool MutateF64(double f64) { int o = __p.__offset(22); if (o != 0) { __p.bb.PutDouble(o + __p.bb_pos, f64); return true; } else { return false; } }
    42  public sbyte V8(int j) { int o = __p.__offset(24); return o != 0 ? __p.bb.GetSbyte(__p.__vector(o) + j * 1) : (sbyte)0; }
    43  public int V8Length { get { int o = __p.__offset(24); return o != 0 ? __p.__vector_len(o) : 0; } }
    44#if ENABLE_SPAN_T
    45  public Span<sbyte> GetV8Bytes() { return __p.__vector_as_span<sbyte>(24, 1); }
    46#else
    47  public ArraySegment<byte>? GetV8Bytes() { return __p.__vector_as_arraysegment(24); }
    48#endif
    49  public sbyte[] GetV8Array() { return __p.__vector_as_array<sbyte>(24); }
    50  public bool MutateV8(int j, sbyte v8) { int o = __p.__offset(24); if (o != 0) { __p.bb.PutSbyte(__p.__vector(o) + j * 1, v8); return true; } else { return false; } }
    51  public double Vf64(int j) { int o = __p.__offset(26); return o != 0 ? __p.bb.GetDouble(__p.__vector(o) + j * 8) : (double)0; }
    52  public int Vf64Length { get { int o = __p.__offset(26); return o != 0 ? __p.__vector_len(o) : 0; } }
    53#if ENABLE_SPAN_T
    54  public Span<double> GetVf64Bytes() { return __p.__vector_as_span<double>(26, 8); }
    55#else
    56  public ArraySegment<byte>? GetVf64Bytes() { return __p.__vector_as_arraysegment(26); }
    57#endif
    58  public double[] GetVf64Array() { return __p.__vector_as_array<double>(26); }
    59  public bool MutateVf64(int j, double vf64) { int o = __p.__offset(26); if (o != 0) { __p.bb.PutDouble(__p.__vector(o) + j * 8, vf64); return true; } else { return false; } }
    60
    61  public static Offset<MyGame.Example.TypeAliases> CreateTypeAliases(FlatBufferBuilder builder,
    62      sbyte i8 = 0,
    63      byte u8 = 0,
    64      short i16 = 0,
    65      ushort u16 = 0,
    66      int i32 = 0,
    67      uint u32 = 0,
    68      long i64 = 0,
    69      ulong u64 = 0,
    70      float f32 = 0.0f,
    71      double f64 = 0.0,
    72      VectorOffset v8Offset = default(VectorOffset),
    73      VectorOffset vf64Offset = default(VectorOffset)) {
    74    builder.StartTable(12);
    75    TypeAliases.AddF64(builder, f64);
    76    TypeAliases.AddU64(builder, u64);
    77    TypeAliases.AddI64(builder, i64);
    78    TypeAliases.AddVf64(builder, vf64Offset);
    79    TypeAliases.AddV8(builder, v8Offset);
    80    TypeAliases.AddF32(builder, f32);
    81    TypeAliases.AddU32(builder, u32);
    82    TypeAliases.AddI32(builder, i32);
    83    TypeAliases.AddU16(builder, u16);
    84    TypeAliases.AddI16(builder, i16);
    85    TypeAliases.AddU8(builder, u8);
    86    TypeAliases.AddI8(builder, i8);
    87    return TypeAliases.EndTypeAliases(builder);
    88  }
    89
    90  public static void StartTypeAliases(FlatBufferBuilder builder) { builder.StartTable(12); }
    91  public static void AddI8(FlatBufferBuilder builder, sbyte i8) { builder.AddSbyte(0, i8, 0); }
    92  public static void AddU8(FlatBufferBuilder builder, byte u8) { builder.AddByte(1, u8, 0); }
    93  public static void AddI16(FlatBufferBuilder builder, short i16) { builder.AddShort(2, i16, 0); }
    94  public static void AddU16(FlatBufferBuilder builder, ushort u16) { builder.AddUshort(3, u16, 0); }
    95  public static void AddI32(FlatBufferBuilder builder, int i32) { builder.AddInt(4, i32, 0); }
    96  public static void AddU32(FlatBufferBuilder builder, uint u32) { builder.AddUint(5, u32, 0); }
    97  public static void AddI64(FlatBufferBuilder builder, long i64) { builder.AddLong(6, i64, 0); }
    98  public static void AddU64(FlatBufferBuilder builder, ulong u64) { builder.AddUlong(7, u64, 0); }
    99  public static void AddF32(FlatBufferBuilder builder, float f32) { builder.AddFloat(8, f32, 0.0f); }
   100  public static void AddF64(FlatBufferBuilder builder, double f64) { builder.AddDouble(9, f64, 0.0); }
   101  public static void AddV8(FlatBufferBuilder builder, VectorOffset v8Offset) { builder.AddOffset(10, v8Offset.Value, 0); }
   102  public static VectorOffset CreateV8Vector(FlatBufferBuilder builder, sbyte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddSbyte(data[i]); return builder.EndVector(); }
   103  public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, sbyte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
   104  public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, ArraySegment<sbyte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
   105  public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<sbyte>(dataPtr, sizeInBytes); return builder.EndVector(); }
   106  public static void StartV8Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
   107  public static void AddVf64(FlatBufferBuilder builder, VectorOffset vf64Offset) { builder.AddOffset(11, vf64Offset.Value, 0); }
   108  public static VectorOffset CreateVf64Vector(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddDouble(data[i]); return builder.EndVector(); }
   109  public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
   110  public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, ArraySegment<double> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
   111  public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<double>(dataPtr, sizeInBytes); return builder.EndVector(); }
   112  public static void StartVf64Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
   113  public static Offset<MyGame.Example.TypeAliases> EndTypeAliases(FlatBufferBuilder builder) {
   114    int o = builder.EndTable();
   115    return new Offset<MyGame.Example.TypeAliases>(o);
   116  }
   117  public TypeAliasesT UnPack() {
   118    var _o = new TypeAliasesT();
   119    this.UnPackTo(_o);
   120    return _o;
   121  }
   122  public void UnPackTo(TypeAliasesT _o) {
   123    _o.I8 = this.I8;
   124    _o.U8 = this.U8;
   125    _o.I16 = this.I16;
   126    _o.U16 = this.U16;
   127    _o.I32 = this.I32;
   128    _o.U32 = this.U32;
   129    _o.I64 = this.I64;
   130    _o.U64 = this.U64;
   131    _o.F32 = this.F32;
   132    _o.F64 = this.F64;
   133    _o.V8 = new List<sbyte>();
   134    for (var _j = 0; _j < this.V8Length; ++_j) {_o.V8.Add(this.V8(_j));}
   135    _o.Vf64 = new List<double>();
   136    for (var _j = 0; _j < this.Vf64Length; ++_j) {_o.Vf64.Add(this.Vf64(_j));}
   137  }
   138  public static Offset<MyGame.Example.TypeAliases> Pack(FlatBufferBuilder builder, TypeAliasesT _o) {
   139    if (_o == null) return default(Offset<MyGame.Example.TypeAliases>);
   140    var _v8 = default(VectorOffset);
   141    if (_o.V8 != null) {
   142      var __v8 = _o.V8.ToArray();
   143      _v8 = CreateV8Vector(builder, __v8);
   144    }
   145    var _vf64 = default(VectorOffset);
   146    if (_o.Vf64 != null) {
   147      var __vf64 = _o.Vf64.ToArray();
   148      _vf64 = CreateVf64Vector(builder, __vf64);
   149    }
   150    return CreateTypeAliases(
   151      builder,
   152      _o.I8,
   153      _o.U8,
   154      _o.I16,
   155      _o.U16,
   156      _o.I32,
   157      _o.U32,
   158      _o.I64,
   159      _o.U64,
   160      _o.F32,
   161      _o.F64,
   162      _v8,
   163      _vf64);
   164  }
   165}
   166
   167public class TypeAliasesT
   168{
   169  [Newtonsoft.Json.JsonProperty("i8")]
   170  public sbyte I8 { get; set; }
   171  [Newtonsoft.Json.JsonProperty("u8")]
   172  public byte U8 { get; set; }
   173  [Newtonsoft.Json.JsonProperty("i16")]
   174  public short I16 { get; set; }
   175  [Newtonsoft.Json.JsonProperty("u16")]
   176  public ushort U16 { get; set; }
   177  [Newtonsoft.Json.JsonProperty("i32")]
   178  public int I32 { get; set; }
   179  [Newtonsoft.Json.JsonProperty("u32")]
   180  public uint U32 { get; set; }
   181  [Newtonsoft.Json.JsonProperty("i64")]
   182  public long I64 { get; set; }
   183  [Newtonsoft.Json.JsonProperty("u64")]
   184  public ulong U64 { get; set; }
   185  [Newtonsoft.Json.JsonProperty("f32")]
   186  public float F32 { get; set; }
   187  [Newtonsoft.Json.JsonProperty("f64")]
   188  public double F64 { get; set; }
   189  [Newtonsoft.Json.JsonProperty("v8")]
   190  public List<sbyte> V8 { get; set; }
   191  [Newtonsoft.Json.JsonProperty("vf64")]
   192  public List<double> Vf64 { get; set; }
   193
   194  public TypeAliasesT() {
   195    this.I8 = 0;
   196    this.U8 = 0;
   197    this.I16 = 0;
   198    this.U16 = 0;
   199    this.I32 = 0;
   200    this.U32 = 0;
   201    this.I64 = 0;
   202    this.U64 = 0;
   203    this.F32 = 0.0f;
   204    this.F64 = 0.0;
   205    this.V8 = null;
   206    this.Vf64 = null;
   207  }
   208}
   209
   210
   211static public class TypeAliasesVerify
   212{
   213  static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
   214  {
   215    return verifier.VerifyTableStart(tablePos)
   216      && verifier.VerifyField(tablePos, 4 /*I8*/, 1 /*sbyte*/, 1, false)
   217      && verifier.VerifyField(tablePos, 6 /*U8*/, 1 /*byte*/, 1, false)
   218      && verifier.VerifyField(tablePos, 8 /*I16*/, 2 /*short*/, 2, false)
   219      && verifier.VerifyField(tablePos, 10 /*U16*/, 2 /*ushort*/, 2, false)
   220      && verifier.VerifyField(tablePos, 12 /*I32*/, 4 /*int*/, 4, false)
   221      && verifier.VerifyField(tablePos, 14 /*U32*/, 4 /*uint*/, 4, false)
   222      && verifier.VerifyField(tablePos, 16 /*I64*/, 8 /*long*/, 8, false)
   223      && verifier.VerifyField(tablePos, 18 /*U64*/, 8 /*ulong*/, 8, false)
   224      && verifier.VerifyField(tablePos, 20 /*F32*/, 4 /*float*/, 4, false)
   225      && verifier.VerifyField(tablePos, 22 /*F64*/, 8 /*double*/, 8, false)
   226      && verifier.VerifyVectorOfData(tablePos, 24 /*V8*/, 1 /*sbyte*/, false)
   227      && verifier.VerifyVectorOfData(tablePos, 26 /*Vf64*/, 8 /*double*/, false)
   228      && verifier.VerifyTableEnd(tablePos);
   229  }
   230}
   231
   232}

View as plain text