...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/StructOfStructs.java

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

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3package MyGame.Example;
     4
     5import com.google.flatbuffers.BaseVector;
     6import com.google.flatbuffers.BooleanVector;
     7import com.google.flatbuffers.ByteVector;
     8import com.google.flatbuffers.Constants;
     9import com.google.flatbuffers.DoubleVector;
    10import com.google.flatbuffers.FlatBufferBuilder;
    11import com.google.flatbuffers.FloatVector;
    12import com.google.flatbuffers.IntVector;
    13import com.google.flatbuffers.LongVector;
    14import com.google.flatbuffers.ShortVector;
    15import com.google.flatbuffers.StringVector;
    16import com.google.flatbuffers.Struct;
    17import com.google.flatbuffers.Table;
    18import com.google.flatbuffers.UnionVector;
    19import java.nio.ByteBuffer;
    20import java.nio.ByteOrder;
    21
    22@SuppressWarnings("unused")
    23public final class StructOfStructs extends Struct {
    24  public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
    25  public StructOfStructs __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    26
    27  public MyGame.Example.Ability a() { return a(new MyGame.Example.Ability()); }
    28  public MyGame.Example.Ability a(MyGame.Example.Ability obj) { return obj.__assign(bb_pos + 0, bb); }
    29  public MyGame.Example.Test b() { return b(new MyGame.Example.Test()); }
    30  public MyGame.Example.Test b(MyGame.Example.Test obj) { return obj.__assign(bb_pos + 8, bb); }
    31  public MyGame.Example.Ability c() { return c(new MyGame.Example.Ability()); }
    32  public MyGame.Example.Ability c(MyGame.Example.Ability obj) { return obj.__assign(bb_pos + 12, bb); }
    33
    34  public static int createStructOfStructs(FlatBufferBuilder builder, long a_id, long a_distance, short b_a, byte b_b, long c_id, long c_distance) {
    35    builder.prep(4, 20);
    36    builder.prep(4, 8);
    37    builder.putInt((int) c_distance);
    38    builder.putInt((int) c_id);
    39    builder.prep(2, 4);
    40    builder.pad(1);
    41    builder.putByte(b_b);
    42    builder.putShort(b_a);
    43    builder.prep(4, 8);
    44    builder.putInt((int) a_distance);
    45    builder.putInt((int) a_id);
    46    return builder.offset();
    47  }
    48
    49  public static final class Vector extends BaseVector {
    50    public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
    51
    52    public StructOfStructs get(int j) { return get(new StructOfStructs(), j); }
    53    public StructOfStructs get(StructOfStructs obj, int j) {  return obj.__assign(__element(j), bb); }
    54  }
    55  public StructOfStructsT unpack() {
    56    StructOfStructsT _o = new StructOfStructsT();
    57    unpackTo(_o);
    58    return _o;
    59  }
    60  public void unpackTo(StructOfStructsT _o) {
    61    a().unpackTo(_o.getA());
    62    b().unpackTo(_o.getB());
    63    c().unpackTo(_o.getC());
    64  }
    65  public static int pack(FlatBufferBuilder builder, StructOfStructsT _o) {
    66    if (_o == null) return 0;
    67    int _a_id = (int) _o.getA().getId();
    68    int _a_distance = (int) _o.getA().getDistance();
    69    short _b_a = _o.getB().getA();
    70    byte _b_b = _o.getB().getB();
    71    int _c_id = (int) _o.getC().getId();
    72    int _c_distance = (int) _o.getC().getDistance();
    73    return createStructOfStructs(
    74      builder,
    75      _a_id,
    76      _a_distance,
    77      _b_a,
    78      _b_b,
    79      _c_id,
    80      _c_distance);
    81  }
    82}
    83

View as plain text