// <auto-generated>
//  automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>

namespace sd.graph
{

using global::System;
using global::FlatBuffers;

public struct UIHardwareState : IFlatbufferObject
{
  private Table __p;
  public ByteBuffer ByteBuffer { get { return __p.bb; } }
  public static UIHardwareState GetRootAsUIHardwareState(ByteBuffer _bb) { return GetRootAsUIHardwareState(_bb, new UIHardwareState()); }
  public static UIHardwareState GetRootAsUIHardwareState(ByteBuffer _bb, UIHardwareState 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 UIHardwareState __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

  public long GpuMemory(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetLong(__p.__vector(o) + j * 8) : (long)0; }
  public int GpuMemoryLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } }
#if ENABLE_SPAN_T
  public Span<byte> GetGpuMemoryBytes() { return __p.__vector_as_span(4); }
#else
  public ArraySegment<byte>? GetGpuMemoryBytes() { return __p.__vector_as_arraysegment(4); }
#endif
  public long[] GetGpuMemoryArray() { return __p.__vector_as_array<long>(4); }
  public long HostMemory { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }

  public static Offset<UIHardwareState> CreateUIHardwareState(FlatBufferBuilder builder,
      VectorOffset gpuMemoryOffset = default(VectorOffset),
      long hostMemory = 0) {
    builder.StartObject(2);
    UIHardwareState.AddHostMemory(builder, hostMemory);
    UIHardwareState.AddGpuMemory(builder, gpuMemoryOffset);
    return UIHardwareState.EndUIHardwareState(builder);
  }

  public static void StartUIHardwareState(FlatBufferBuilder builder) { builder.StartObject(2); }
  public static void AddGpuMemory(FlatBufferBuilder builder, VectorOffset gpuMemoryOffset) { builder.AddOffset(0, gpuMemoryOffset.Value, 0); }
  public static VectorOffset CreateGpuMemoryVector(FlatBufferBuilder builder, long[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddLong(data[i]); return builder.EndVector(); }
  public static VectorOffset CreateGpuMemoryVectorBlock(FlatBufferBuilder builder, long[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
  public static void StartGpuMemoryVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
  public static void AddHostMemory(FlatBufferBuilder builder, long hostMemory) { builder.AddLong(1, hostMemory, 0); }
  public static Offset<UIHardwareState> EndUIHardwareState(FlatBufferBuilder builder) {
    int o = builder.EndObject();
    return new Offset<UIHardwareState>(o);
  }
};


}
