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.

48 lines
2.2KB

  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. ref TValue this[uint idEntityId] { get; }
  10. bool TryGetValue(uint entityId, out TValue item);
  11. ref TValue GetOrCreate(uint idEntityId);
  12. IBuffer<TValue> GetValues(out uint count);
  13. ref TValue GetDirectValueByRef(uint key);
  14. }
  15. public interface ITypeSafeDictionary:IDisposable
  16. {
  17. uint count { get; }
  18. ITypeSafeDictionary Create();
  19. //todo: there is something wrong in the design of the execute callback methods. Something to cleanup
  20. void ExecuteEnginesAddOrSwapCallbacks(FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer>> entityComponentEnginesDb,
  21. ITypeSafeDictionary realDic, ExclusiveGroupStruct? fromGroup, ExclusiveGroupStruct toGroup, in PlatformProfiler profiler);
  22. void ExecuteEnginesSwapOrRemoveCallbacks(EGID fromEntityGid, EGID? toEntityID, ITypeSafeDictionary toGroup,
  23. FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer>> engines, in PlatformProfiler profiler);
  24. void ExecuteEnginesRemoveCallbacks(FasterDictionary<RefWrapperType, FasterList<ReactEngineContainer>> entityComponentEnginesDB,
  25. in PlatformProfiler profiler, ExclusiveGroupStruct @group);
  26. void AddEntitiesFromDictionary
  27. (ITypeSafeDictionary entitiesToSubmit, ExclusiveGroupStruct groupId, EnginesRoot enginesRoot);
  28. void AddEntityToDictionary(EGID fromEntityGid, EGID toEntityID, ITypeSafeDictionary toGroup);
  29. void RemoveEntityFromDictionary(EGID fromEntityGid);
  30. void ResizeTo(uint size);
  31. void Trim();
  32. void Clear();
  33. void FastClear();
  34. bool Has(uint key);
  35. bool ContainsKey(uint egidEntityId);
  36. uint GetIndex(uint valueEntityId);
  37. bool TryFindIndex(uint entityGidEntityId, out uint index);
  38. void KeysEvaluator(System.Action<uint> action);
  39. }
  40. }