blob: 149b136fcc29b0a1804c91abebd404bcff76886e [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// <auto-generated>
2// automatically generated by the FlatBuffers compiler, do not modify
3// </auto-generated>
4
5namespace MyGame.Example
6{
7
8using global::System;
Austin Schuh272c6132020-11-14 16:37:52 -08009using global::System.Collections.Generic;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070010using global::FlatBuffers;
11
12public struct Stat : IFlatbufferObject
13{
14 private Table __p;
15 public ByteBuffer ByteBuffer { get { return __p.bb; } }
James Kuszmaul8e62b022022-03-22 09:33:25 -070016 public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
Austin Schuhe89fa2d2019-08-14 20:24:23 -070017 public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); }
18 public static Stat GetRootAsStat(ByteBuffer _bb, Stat 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 Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
21
22 public string Id { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
23#if ENABLE_SPAN_T
Austin Schuh272c6132020-11-14 16:37:52 -080024 public Span<byte> GetIdBytes() { return __p.__vector_as_span<byte>(4, 1); }
Austin Schuhe89fa2d2019-08-14 20:24:23 -070025#else
26 public ArraySegment<byte>? GetIdBytes() { return __p.__vector_as_arraysegment(4); }
27#endif
28 public byte[] GetIdArray() { return __p.__vector_as_array<byte>(4); }
29 public long Val { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }
30 public bool MutateVal(long val) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, val); return true; } else { return false; } }
31 public ushort Count { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } }
32 public bool MutateCount(ushort count) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, count); return true; } else { return false; } }
33
34 public static Offset<MyGame.Example.Stat> CreateStat(FlatBufferBuilder builder,
35 StringOffset idOffset = default(StringOffset),
36 long val = 0,
37 ushort count = 0) {
38 builder.StartTable(3);
39 Stat.AddVal(builder, val);
40 Stat.AddId(builder, idOffset);
41 Stat.AddCount(builder, count);
42 return Stat.EndStat(builder);
43 }
44
45 public static void StartStat(FlatBufferBuilder builder) { builder.StartTable(3); }
46 public static void AddId(FlatBufferBuilder builder, StringOffset idOffset) { builder.AddOffset(0, idOffset.Value, 0); }
47 public static void AddVal(FlatBufferBuilder builder, long val) { builder.AddLong(1, val, 0); }
48 public static void AddCount(FlatBufferBuilder builder, ushort count) { builder.AddUshort(2, count, 0); }
49 public static Offset<MyGame.Example.Stat> EndStat(FlatBufferBuilder builder) {
50 int o = builder.EndTable();
51 return new Offset<MyGame.Example.Stat>(o);
52 }
James Kuszmaul8e62b022022-03-22 09:33:25 -070053
54 public static VectorOffset CreateSortedVectorOfStat(FlatBufferBuilder builder, Offset<Stat>[] offsets) {
55 Array.Sort(offsets, (Offset<Stat> o1, Offset<Stat> o2) => builder.DataBuffer.GetUshort(Table.__offset(8, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUshort(Table.__offset(8, o2.Value, builder.DataBuffer))));
56 return builder.CreateVectorOfTables(offsets);
57 }
58
59 public static Stat? __lookup_by_key(int vectorLocation, ushort key, ByteBuffer bb) {
60 int span = bb.GetInt(vectorLocation - 4);
61 int start = 0;
62 while (span != 0) {
63 int middle = span / 2;
64 int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
65 int comp = bb.GetUshort(Table.__offset(8, bb.Length - tableOffset, bb)).CompareTo(key);
66 if (comp > 0) {
67 span = middle;
68 } else if (comp < 0) {
69 middle++;
70 start += middle;
71 span -= middle;
72 } else {
73 return new Stat().__assign(tableOffset, bb);
74 }
75 }
76 return null;
77 }
Austin Schuh272c6132020-11-14 16:37:52 -080078 public StatT UnPack() {
79 var _o = new StatT();
80 this.UnPackTo(_o);
81 return _o;
82 }
83 public void UnPackTo(StatT _o) {
84 _o.Id = this.Id;
85 _o.Val = this.Val;
86 _o.Count = this.Count;
87 }
88 public static Offset<MyGame.Example.Stat> Pack(FlatBufferBuilder builder, StatT _o) {
89 if (_o == null) return default(Offset<MyGame.Example.Stat>);
90 var _id = _o.Id == null ? default(StringOffset) : builder.CreateString(_o.Id);
91 return CreateStat(
92 builder,
93 _id,
94 _o.Val,
95 _o.Count);
96 }
James Kuszmaul8e62b022022-03-22 09:33:25 -070097}
Austin Schuhe89fa2d2019-08-14 20:24:23 -070098
Austin Schuh272c6132020-11-14 16:37:52 -080099public class StatT
100{
101 [Newtonsoft.Json.JsonProperty("id")]
102 public string Id { get; set; }
103 [Newtonsoft.Json.JsonProperty("val")]
104 public long Val { get; set; }
105 [Newtonsoft.Json.JsonProperty("count")]
106 public ushort Count { get; set; }
107
108 public StatT() {
109 this.Id = null;
110 this.Val = 0;
111 this.Count = 0;
112 }
113}
114
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700115
116}