Mirror of Svelto.ECS because we're a fan of it
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

97 рядки
5.0KB

  1. using System;
  2. using Svelto.Common;
  3. using Svelto.DataStructures;
  4. namespace Svelto.ECS.Internal
  5. {
  6. public interface ITypeSafeDictionary<TValue> : ITypeSafeDictionary where TValue : _IInternalEntityComponent
  7. {
  8. uint Add(uint egidEntityId, in TValue entityComponent);
  9. bool TryGetValue(uint entityId, out TValue item);
  10. ref TValue GetOrAdd(uint idEntityId);
  11. IBuffer<TValue> GetValues(out uint count);
  12. ref TValue GetDirectValueByRef(uint key);
  13. ref TValue GetValueByRef(uint key);
  14. IEntityIDs entityIDs { get; }
  15. }
  16. public interface ITypeSafeDictionary : IDisposable
  17. {
  18. int count { get; }
  19. ITypeSafeDictionary Create();
  20. void AddEntitiesToDictionary
  21. (ITypeSafeDictionary toDictionary, ExclusiveGroupStruct groupId
  22. #if SLOW_SVELTO_SUBMISSION
  23. , in EnginesRoot.EntityReferenceMap entityLocator
  24. #endif
  25. );
  26. void RemoveEntitiesFromDictionary(FasterList<(uint, string)> infosToProcess, FasterDictionary<uint, uint> entityIDsAffectedByRemoveAtSwapBack);
  27. void SwapEntitiesBetweenDictionaries(in FasterDictionary<uint, SwapInfo> infosToProcess, ExclusiveGroupStruct fromGroup,
  28. ExclusiveGroupStruct toGroup
  29. , ITypeSafeDictionary toComponentsDictionary, FasterDictionary<uint, uint> entityIDsAffectedByRemoveAtSwapBack);
  30. //------------
  31. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  32. void ExecuteEnginesAddCallbacks
  33. (FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnAdd>>> entityComponentEnginesDb
  34. , ITypeSafeDictionary destinationDatabase, ExclusiveGroupStruct toGroup, in PlatformProfiler profiler);
  35. //Version to use
  36. void ExecuteEnginesAddEntityCallbacksFast(
  37. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnAddEx>>> reactiveEnginesAdd,
  38. ExclusiveGroupStruct groupID, (uint, uint) rangeOfSubmittedEntitiesIndicies, in PlatformProfiler profiler);
  39. //------------
  40. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  41. void ExecuteEnginesSwapCallbacks(FasterDictionary<uint, SwapInfo> infosToProcess,
  42. FasterList<ReactEngineContainer<IReactOnSwap>> reactiveEnginesSwap, ExclusiveGroupStruct fromGroup,
  43. ExclusiveGroupStruct toGroup, in PlatformProfiler sampler);
  44. //Version to use
  45. void ExecuteEnginesSwapCallbacksFast(FasterList<ReactEngineContainer<IReactOnSwapEx>> reactiveEnginesSwap,
  46. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup, (uint, uint) rangeOfSubmittedEntitiesIndicies,
  47. in PlatformProfiler sampler);
  48. //------------
  49. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  50. void ExecuteEnginesRemoveCallbacks(FasterList<(uint, string)> infosToProcess,
  51. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnRemove>>> reactiveEnginesRemove,
  52. ExclusiveGroupStruct fromGroup, in PlatformProfiler sampler);
  53. //Version to use
  54. void ExecuteEnginesRemoveCallbacksFast(FasterList<ReactEngineContainer<IReactOnRemoveEx>> reactiveEnginesRemoveEx,
  55. ExclusiveGroupStruct fromGroup, (uint, uint) rangeOfSubmittedEntitiesIndicies,
  56. in PlatformProfiler sampler);
  57. //------------
  58. void ExecuteEnginesSwapCallbacks_Group(
  59. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnSwap>>> reactiveEnginesSwap,
  60. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnSwapEx>>> reactiveEnginesSwapEx,
  61. ITypeSafeDictionary toEntitiesDictionary, ExclusiveGroupStruct fromGroupId, ExclusiveGroupStruct toGroupId,
  62. in PlatformProfiler platformProfiler);
  63. void ExecuteEnginesRemoveCallbacks_Group(
  64. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnRemove>>> reactiveEnginesRemove,
  65. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnRemoveEx>>> reactiveEnginesRemoveEx,
  66. ExclusiveGroupStruct @group, in PlatformProfiler profiler);
  67. void ExecuteEnginesDisposeCallbacks_Group
  68. (FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnDispose>>> reactiveEnginesDispose,
  69. FasterDictionary<ComponentID, FasterList<ReactEngineContainer<IReactOnDisposeEx>>> reactiveEnginesDisposeEx,
  70. ExclusiveGroupStruct group, in PlatformProfiler profiler);
  71. void IncreaseCapacityBy(uint size);
  72. void EnsureCapacity(uint size);
  73. void Trim();
  74. void Clear();
  75. bool Has(uint key);
  76. bool ContainsKey(uint egidEntityId);
  77. uint GetIndex(uint valueEntityId);
  78. bool TryFindIndex(uint entityGidEntityId, out uint index);
  79. void KeysEvaluator(Action<uint> action);
  80. }
  81. }