Mirror of Svelto.ECS because we're a fan of it
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

ITypeSafeDictionary.cs 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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(ITypeSafeDictionary entitiesToSubmit, uint groupId, EnginesRoot enginesRoot);
  27. void AddEntityToDictionary(EGID fromEntityGid, EGID toEntityID, ITypeSafeDictionary toGroup);
  28. void RemoveEntityFromDictionary(EGID fromEntityGid);
  29. void ResizeTo(uint size);
  30. void Trim();
  31. void Clear();
  32. void FastClear();
  33. bool Has(uint key);
  34. bool ContainsKey(uint egidEntityId);
  35. uint GetIndex(uint valueEntityId);
  36. bool TryFindIndex(uint entityGidEntityId, out uint index);
  37. void KeysEvaluator(System.Action<uint> action);
  38. }
  39. }