// // automatically generated by the FlatBuffers compiler, do not modify // namespace MyGame.Example { using global::System; using global::FlatBuffers; public struct Referrable : IFlatbufferObject { private Table __p; public ByteBuffer ByteBuffer { get { return __p.bb; } } public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); } public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } public ulong Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } } public bool MutateId(ulong id) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, id); return true; } else { return false; } } public static Offset CreateReferrable(FlatBufferBuilder builder, ulong id = 0) { builder.StartObject(1); Referrable.AddId(builder, id); return Referrable.EndReferrable(builder); } public static void StartReferrable(FlatBufferBuilder builder) { builder.StartObject(1); } public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); } public static Offset EndReferrable(FlatBufferBuilder builder) { int o = builder.EndObject(); return new Offset(o); } public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset[] offsets) { Array.Sort(offsets, (Offset o1, Offset o2) => builder.DataBuffer.GetUlong(Table.__offset(4, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUlong(Table.__offset(4, o2.Value, builder.DataBuffer)))); return builder.CreateVectorOfTables(offsets); } public static Referrable? __lookup_by_key(int vectorLocation, ulong key, ByteBuffer bb) { int span = bb.GetInt(vectorLocation - 4); int start = 0; while (span != 0) { int middle = span / 2; int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb); int comp = bb.GetUlong(Table.__offset(4, bb.Length - tableOffset, bb)).CompareTo(key); if (comp > 0) { span = middle; } else if (comp < 0) { middle++; start += middle; span -= middle; } else { return new Referrable().__assign(tableOffset, bb); } } return null; } }; }