...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/ArrayStruct.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 ArrayStruct : IFlatbufferObject
    13{
    14  private Struct __p;
    15  public ByteBuffer ByteBuffer { get { return __p.bb; } }
    16  public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
    17  public ArrayStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    18
    19  public float A { get { return __p.bb.GetFloat(__p.bb_pos + 0); } }
    20  public void MutateA(float a) { __p.bb.PutFloat(__p.bb_pos + 0, a); }
    21  public int B(int j) { return __p.bb.GetInt(__p.bb_pos + 4 + j * 4); }
    22  public void MutateB(int j, int b) { __p.bb.PutInt(__p.bb_pos + 4 + j * 4, b); }
    23  public sbyte C { get { return __p.bb.GetSbyte(__p.bb_pos + 64); } }
    24  public void MutateC(sbyte c) { __p.bb.PutSbyte(__p.bb_pos + 64, c); }
    25  public MyGame.Example.NestedStruct D(int j) { return (new MyGame.Example.NestedStruct()).__assign(__p.bb_pos + 72 + j * 32, __p.bb); }
    26  public int E { get { return __p.bb.GetInt(__p.bb_pos + 136); } }
    27  public void MutateE(int e) { __p.bb.PutInt(__p.bb_pos + 136, e); }
    28  public long F(int j) { return __p.bb.GetLong(__p.bb_pos + 144 + j * 8); }
    29  public void MutateF(int j, long f) { __p.bb.PutLong(__p.bb_pos + 144 + j * 8, f); }
    30
    31  public static Offset<MyGame.Example.ArrayStruct> CreateArrayStruct(FlatBufferBuilder builder, float A, int[] B, sbyte C, int[,] d_A, MyGame.Example.TestEnum[] d_B, MyGame.Example.TestEnum[,] d_C, long[,] d_D, int E, long[] F) {
    32    builder.Prep(8, 160);
    33    for (int _idx0 = 2; _idx0 > 0; _idx0--) {
    34      builder.PutLong(F[_idx0-1]);
    35    }
    36    builder.Pad(4);
    37    builder.PutInt(E);
    38    for (int _idx0 = 2; _idx0 > 0; _idx0--) {
    39      builder.Prep(8, 32);
    40      for (int _idx1 = 2; _idx1 > 0; _idx1--) {
    41        builder.PutLong(d_D[_idx0-1,_idx1-1]);
    42      }
    43      builder.Pad(5);
    44      for (int _idx1 = 2; _idx1 > 0; _idx1--) {
    45        builder.PutSbyte((sbyte)d_C[_idx0-1,_idx1-1]);
    46      }
    47      builder.PutSbyte((sbyte)d_B[_idx0-1]);
    48      for (int _idx1 = 2; _idx1 > 0; _idx1--) {
    49        builder.PutInt(d_A[_idx0-1,_idx1-1]);
    50      }
    51    }
    52    builder.Pad(7);
    53    builder.PutSbyte(C);
    54    for (int _idx0 = 15; _idx0 > 0; _idx0--) {
    55      builder.PutInt(B[_idx0-1]);
    56    }
    57    builder.PutFloat(A);
    58    return new Offset<MyGame.Example.ArrayStruct>(builder.Offset);
    59  }
    60  public ArrayStructT UnPack() {
    61    var _o = new ArrayStructT();
    62    this.UnPackTo(_o);
    63    return _o;
    64  }
    65  public void UnPackTo(ArrayStructT _o) {
    66    _o.A = this.A;
    67    _o.B = new int[15];
    68    for (var _j = 0; _j < 15; ++_j) { _o.B[_j] = this.B(_j); }
    69    _o.C = this.C;
    70    _o.D = new MyGame.Example.NestedStructT[2];
    71    for (var _j = 0; _j < 2; ++_j) { _o.D[_j] = this.D(_j).UnPack(); }
    72    _o.E = this.E;
    73    _o.F = new long[2];
    74    for (var _j = 0; _j < 2; ++_j) { _o.F[_j] = this.F(_j); }
    75  }
    76  public static Offset<MyGame.Example.ArrayStruct> Pack(FlatBufferBuilder builder, ArrayStructT _o) {
    77    if (_o == null) return default(Offset<MyGame.Example.ArrayStruct>);
    78    var _b = _o.B;
    79    var _d_a = new int[2,2];
    80    for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_a[idx0,idx1] = _o.D[idx0].A[idx1];}}
    81    var _d_b = new MyGame.Example.TestEnum[2];
    82    for (var idx0 = 0; idx0 < 2; ++idx0) {_d_b[idx0] = _o.D[idx0].B;}
    83    var _d_c = new MyGame.Example.TestEnum[2,2];
    84    for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_c[idx0,idx1] = _o.D[idx0].C[idx1];}}
    85    var _d_d = new long[2,2];
    86    for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_d[idx0,idx1] = _o.D[idx0].D[idx1];}}
    87    var _f = _o.F;
    88    return CreateArrayStruct(
    89      builder,
    90      _o.A,
    91      _b,
    92      _o.C,
    93      _d_a,
    94      _d_b,
    95      _d_c,
    96      _d_d,
    97      _o.E,
    98      _f);
    99  }
   100}
   101
   102public class ArrayStructT
   103{
   104  [Newtonsoft.Json.JsonProperty("a")]
   105  public float A { get; set; }
   106  [Newtonsoft.Json.JsonProperty("b")]
   107  public int[] B { get; set; }
   108  [Newtonsoft.Json.JsonProperty("c")]
   109  public sbyte C { get; set; }
   110  [Newtonsoft.Json.JsonProperty("d")]
   111  public MyGame.Example.NestedStructT[] D { get; set; }
   112  [Newtonsoft.Json.JsonProperty("e")]
   113  public int E { get; set; }
   114  [Newtonsoft.Json.JsonProperty("f")]
   115  public long[] F { get; set; }
   116
   117  public ArrayStructT() {
   118    this.A = 0.0f;
   119    this.B = new int[15];
   120    this.C = 0;
   121    this.D = new MyGame.Example.NestedStructT[2];
   122    this.E = 0;
   123    this.F = new long[2];
   124  }
   125}
   126
   127
   128}

View as plain text