Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2KB

  1. using System.Runtime.CompilerServices;
  2. using Svelto.ECS.DataStructures;
  3. namespace Svelto.ECS
  4. {
  5. public readonly struct FilteredIndices
  6. {
  7. public FilteredIndices(NativeDynamicArrayCast<uint> denseListOfIndicesToEntityComponentArray)
  8. {
  9. _denseListOfIndicesToEntityComponentArray = denseListOfIndicesToEntityComponentArray;
  10. _count = _denseListOfIndicesToEntityComponentArray.count;
  11. }
  12. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  13. public int Count() => _count;
  14. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  15. public uint Get(uint index) => _denseListOfIndicesToEntityComponentArray[index];
  16. public uint this[uint index]
  17. {
  18. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  19. get => _denseListOfIndicesToEntityComponentArray[index];
  20. }
  21. public uint this[int index]
  22. {
  23. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  24. get => _denseListOfIndicesToEntityComponentArray[index];
  25. }
  26. readonly NativeDynamicArrayCast<uint> _denseListOfIndicesToEntityComponentArray;
  27. readonly int _count;
  28. }
  29. }