using System.Runtime.CompilerServices; using Svelto.DataStructures; using Svelto.ECS.Internal; namespace Svelto.ECS { public readonly ref struct EntityCollection where T : struct, _IInternalEntityComponent { public EntityCollection(IBuffer buffer, IEntityIDs entityIDs, uint count) : this() { DBC.ECS.Check.Require(count == 0 || buffer.isValid, "Buffer is found in impossible state"); this.buffer = buffer; this.entityIDs = entityIDs; this.count = count; } public uint count { get; } public readonly IBufferBase buffer; public readonly IEntityIDs entityIDs; } public readonly ref struct EntityCollection where T1 : struct, _IInternalEntityComponent where T2 : struct, _IInternalEntityComponent { internal EntityCollection(in EntityCollection array1, in EntityCollection array2) { buffer1 = array1; buffer2 = array2; } public int count => (int)buffer1.count; public EntityCollection buffer2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } } public readonly ref struct EntityCollection where T3 : struct, _IInternalEntityComponent where T2 : struct, _IInternalEntityComponent where T1 : struct, _IInternalEntityComponent { internal EntityCollection (in EntityCollection array1, in EntityCollection array2, in EntityCollection array3) { buffer1 = array1; buffer2 = array2; buffer3 = array3; } public EntityCollection buffer1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer3 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public int count => (int)buffer1.count; } public readonly ref struct EntityCollection where T1 : struct, _IInternalEntityComponent where T2 : struct, _IInternalEntityComponent where T3 : struct, _IInternalEntityComponent where T4 : struct, _IInternalEntityComponent { internal EntityCollection (in EntityCollection array1, in EntityCollection array2, in EntityCollection array3 , in EntityCollection array4) { buffer1 = array1; buffer2 = array2; buffer3 = array3; buffer4 = array4; } public EntityCollection buffer1 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer2 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer3 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public EntityCollection buffer4 { [MethodImpl(MethodImplOptions.AggressiveInlining)] get; } public int count => (int)buffer1.count; } }