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

namespace Frontend
{

using global::System;
using global::System.Collections.Generic;
using global::Google.FlatBuffers;

public struct RobotConfiguration : IFlatbufferObject
{
  private Table __p;
  public ByteBuffer ByteBuffer { get { return __p.bb; } }
  public static void ValidateVersion() { }
  public static RobotConfiguration GetRootAsRobotConfiguration(ByteBuffer _bb) { return GetRootAsRobotConfiguration(_bb, new RobotConfiguration()); }
  public static RobotConfiguration GetRootAsRobotConfiguration(ByteBuffer _bb, RobotConfiguration obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
  public static bool VerifyRobotConfiguration(ByteBuffer _bb) {Google.FlatBuffers.Verifier verifier = new Google.FlatBuffers.Verifier(_bb); return verifier.VerifyBuffer("", false, RobotConfigurationVerify.Verify); }
  public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
  public RobotConfiguration __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

  public RobotModule? Modules(int j) { int o = __p.__offset(4); return o != 0 ? (RobotModule?)(new RobotModule()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
  public int ModulesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } }
  public Frontend.ModuleConnection? Connections(int j) { int o = __p.__offset(6); return o != 0 ? (Frontend.ModuleConnection?)(new Frontend.ModuleConnection()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
  public int ConnectionsLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } }

  public static Offset<Frontend.RobotConfiguration> CreateRobotConfiguration(FlatBufferBuilder builder,
      VectorOffset modulesOffset = default(VectorOffset),
      VectorOffset connectionsOffset = default(VectorOffset)) {
    builder.StartTable(2);
    RobotConfiguration.AddConnections(builder, connectionsOffset);
    RobotConfiguration.AddModules(builder, modulesOffset);
    return RobotConfiguration.EndRobotConfiguration(builder);
  }

  public static void StartRobotConfiguration(FlatBufferBuilder builder) { builder.StartTable(2); }
  public static void AddModules(FlatBufferBuilder builder, VectorOffset modulesOffset) { builder.AddOffset(0, modulesOffset.Value, 0); }
  public static VectorOffset CreateModulesVector(FlatBufferBuilder builder, Offset<RobotModule>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
  public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, Offset<RobotModule>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
  public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<RobotModule>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
  public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<RobotModule>>(dataPtr, sizeInBytes); return builder.EndVector(); }
  public static void StartModulesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
  public static void AddConnections(FlatBufferBuilder builder, VectorOffset connectionsOffset) { builder.AddOffset(1, connectionsOffset.Value, 0); }
  public static VectorOffset CreateConnectionsVector(FlatBufferBuilder builder, Offset<Frontend.ModuleConnection>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
  public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, Offset<Frontend.ModuleConnection>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
  public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<Frontend.ModuleConnection>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
  public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<Frontend.ModuleConnection>>(dataPtr, sizeInBytes); return builder.EndVector(); }
  public static void StartConnectionsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
  public static Offset<Frontend.RobotConfiguration> EndRobotConfiguration(FlatBufferBuilder builder) {
    int o = builder.EndTable();
    return new Offset<Frontend.RobotConfiguration>(o);
  }
  public static void FinishRobotConfigurationBuffer(FlatBufferBuilder builder, Offset<Frontend.RobotConfiguration> offset) { builder.Finish(offset.Value); }
  public static void FinishSizePrefixedRobotConfigurationBuffer(FlatBufferBuilder builder, Offset<Frontend.RobotConfiguration> offset) { builder.FinishSizePrefixed(offset.Value); }
}


static public class RobotConfigurationVerify
{
  static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
  {
    return verifier.VerifyTableStart(tablePos)
      && verifier.VerifyVectorOfTables(tablePos, 4 /*Modules*/, RobotModuleVerify.Verify, false)
      && verifier.VerifyVectorOfTables(tablePos, 6 /*Connections*/, Frontend.ModuleConnectionVerify.Verify, false)
      && verifier.VerifyTableEnd(tablePos);
  }
}

}
