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.

91 lines
4.6KB

  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 : IEntityComponent
  7. {
  8. void 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. EntityIDs entityIDs { get; }
  15. }
  16. public interface ITypeSafeDictionary : IDisposable
  17. {
  18. int count { get; }
  19. ITypeSafeDictionary Create();
  20. void AddEntitiesToDictionary
  21. (ITypeSafeDictionary toDictionary, ExclusiveGroupStruct groupId, in EnginesRoot.EntityReferenceMap entityLocator);
  22. void RemoveEntitiesFromDictionary(FasterList<(uint, string)> infosToProcess);
  23. void SwapEntitiesBetweenDictionaries(FasterList<(uint, uint, string)> infosToProcess,
  24. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup, ITypeSafeDictionary toComponentsDictionary);
  25. //------------
  26. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  27. void ExecuteEnginesAddCallbacks
  28. (FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnAdd>>> entityComponentEnginesDb
  29. , ITypeSafeDictionary destinationDatabase, ExclusiveGroupStruct toGroup, in PlatformProfiler profiler);
  30. //Version to use
  31. void ExecuteEnginesAddEntityCallbacksFast(
  32. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnAddEx>>> reactiveEnginesAdd,
  33. ExclusiveGroupStruct groupID, (uint, uint) rangeOfSubmittedEntitiesIndicies, in PlatformProfiler profiler);
  34. //------------
  35. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  36. void ExecuteEnginesSwapCallbacks(FasterList<(uint, uint, string)> infosToProcess,
  37. FasterList<ReactEngineContainer<IReactOnSwap>> reactiveEnginesSwap, ExclusiveGroupStruct fromGroup,
  38. ExclusiveGroupStruct toGroup, in PlatformProfiler sampler);
  39. //Version to use
  40. void ExecuteEnginesSwapCallbacksFast(FasterList<ReactEngineContainer<IReactOnSwapEx>> reactiveEnginesSwap,
  41. ExclusiveGroupStruct fromGroup, ExclusiveGroupStruct toGroup, (uint, uint) rangeOfSubmittedEntitiesIndicies,
  42. in PlatformProfiler sampler);
  43. //------------
  44. //This is now obsolete, but I cannot mark it as such because it's heavily used by legacy projects
  45. void ExecuteEnginesRemoveCallbacks(FasterList<(uint, string)> infosToProcess,
  46. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnRemove>>> reactiveEnginesRemove,
  47. ExclusiveGroupStruct fromGroup, in PlatformProfiler sampler);
  48. //Version to use
  49. void ExecuteEnginesRemoveCallbacksFast(FasterList<ReactEngineContainer<IReactOnRemoveEx>> reactiveEnginesRemoveEx,
  50. ExclusiveGroupStruct fromGroup, (uint, uint) rangeOfSubmittedEntitiesIndicies,
  51. in PlatformProfiler sampler);
  52. //------------
  53. void ExecuteEnginesSwapCallbacks_Group(
  54. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnSwap>>> reactiveEnginesSwap,
  55. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnSwapEx>>> reactiveEnginesSwapEx,
  56. ITypeSafeDictionary toEntitiesDictionary, ExclusiveGroupStruct fromGroupId, ExclusiveGroupStruct toGroupId,
  57. in PlatformProfiler platformProfiler);
  58. void ExecuteEnginesRemoveCallbacks_Group(
  59. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnRemove>>> engines,
  60. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnRemoveEx>>> reactiveEnginesRemoveEx,
  61. ExclusiveGroupStruct @group, in PlatformProfiler profiler);
  62. void ExecuteEnginesDisposeCallbacks_Group
  63. (FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer<IReactOnDispose>>> engines
  64. , ExclusiveGroupStruct group, in PlatformProfiler profiler);
  65. void IncreaseCapacityBy(uint size);
  66. void EnsureCapacity(uint size);
  67. void Trim();
  68. void Clear();
  69. bool Has(uint key);
  70. bool ContainsKey(uint egidEntityId);
  71. uint GetIndex(uint valueEntityId);
  72. bool TryFindIndex(uint entityGidEntityId, out uint index);
  73. void KeysEvaluator(System.Action<uint> action);
  74. }
  75. }