Class SystemDependencyTracker
- Namespace
- KeenEyes
- Assembly
- KeenEyes.Core.dll
Tracks component dependencies for all registered systems.
public sealed class SystemDependencyTracker
- Inheritance
-
SystemDependencyTracker
- Inherited Members
Remarks
The SystemDependencyTracker collects and manages component read/write dependencies for systems, enabling the parallel scheduler to determine which systems can execute concurrently.
Dependencies can come from three sources:
- Explicit declaration via KeenEyes.ISystemDependencyProvider
- Manual registration via RegisterDependencies(Type, ComponentDependencies)
- Assumed full access if not declared (conservative)
Properties
Count
Gets the number of systems with registered dependencies.
public int Count { get; }
Property Value
Methods
CanRunInParallelWith(Type, IEnumerable<Type>)
Checks if a system can run in parallel with all specified systems.
public bool CanRunInParallelWith(Type systemType, IEnumerable<Type> otherSystems)
Parameters
systemTypeTypeThe system to check.
otherSystemsIEnumerable<Type>The other systems that would run concurrently.
Returns
- bool
True if the system can run in parallel with all others.
Clear()
Clears all registered dependencies.
public void Clear()
GetConflicts(Type, Type)
Gets the component types that cause conflicts between two systems.
public IReadOnlyCollection<Type> GetConflicts(Type systemType1, Type systemType2)
Parameters
Returns
- IReadOnlyCollection<Type>
The conflicting component types.
GetDependencies(Type)
Gets the dependencies for a system type.
public ComponentDependencies GetDependencies(Type systemType)
Parameters
systemTypeTypeThe system type.
Returns
- ComponentDependencies
The system's dependencies, or empty if not registered.
GetDependencies<TSystem>()
Gets the dependencies for a system type.
public ComponentDependencies GetDependencies<TSystem>() where TSystem : ISystem
Returns
- ComponentDependencies
The system's dependencies, or empty if not registered.
Type Parameters
TSystemThe system type.
GetRegisteredSystems()
Gets all registered system types.
public IEnumerable<Type> GetRegisteredSystems()
Returns
- IEnumerable<Type>
An enumerable of all registered system types.
HasConflict(Type, Type)
Checks if two system types have conflicting dependencies.
public bool HasConflict(Type systemType1, Type systemType2)
Parameters
Returns
- bool
True if the systems have conflicting dependencies.
RegisterDependencies(Type, ComponentDependencies)
Registers a system with explicit dependencies.
public void RegisterDependencies(Type systemType, ComponentDependencies dependencies)
Parameters
systemTypeTypeThe system type.
dependenciesComponentDependenciesThe component dependencies.
RegisterDependencies<TSystem>(params QueryDescription[])
Registers a system with dependencies derived from query descriptions.
public void RegisterDependencies<TSystem>(params QueryDescription[] queries) where TSystem : ISystem
Parameters
queriesQueryDescription[]The queries used by the system.
Type Parameters
TSystemThe system type.
RegisterSystem(ISystem)
Registers a system and extracts its dependencies.
public void RegisterSystem(ISystem system)
Parameters
systemISystemThe system to register.
Remarks
If the system implements KeenEyes.ISystemDependencyProvider, dependencies are extracted via KeenEyes.ISystemDependencyProvider.GetDependencies(KeenEyes.ISystemDependencyBuilder). Otherwise, empty dependencies are assumed (system is assumed to have no conflicts).
TryGetDependencies(Type, out ComponentDependencies)
Tries to get the dependencies for a system type.
public bool TryGetDependencies(Type systemType, out ComponentDependencies dependencies)
Parameters
systemTypeTypeThe system type.
dependenciesComponentDependenciesThe dependencies if found.
Returns
- bool
True if the system was registered and has dependencies.
Unregister(Type)
Removes a system's dependency registration.
public bool Unregister(Type systemType)
Parameters
systemTypeTypeThe system type to unregister.
Returns
- bool
True if the system was unregistered.