Table of Contents

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:

  1. Explicit declaration via KeenEyes.ISystemDependencyProvider
  2. Manual registration via RegisterDependencies(Type, ComponentDependencies)
  3. Assumed full access if not declared (conservative)

Properties

Count

Gets the number of systems with registered dependencies.

public int Count { get; }

Property Value

int

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

systemType Type

The system to check.

otherSystems IEnumerable<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

systemType1 Type

First system type.

systemType2 Type

Second system type.

Returns

IReadOnlyCollection<Type>

The conflicting component types.

GetDependencies(Type)

Gets the dependencies for a system type.

public ComponentDependencies GetDependencies(Type systemType)

Parameters

systemType Type

The 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

TSystem

The 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

systemType1 Type

First system type.

systemType2 Type

Second system type.

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

systemType Type

The system type.

dependencies ComponentDependencies

The 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

queries QueryDescription[]

The queries used by the system.

Type Parameters

TSystem

The system type.

RegisterSystem(ISystem)

Registers a system and extracts its dependencies.

public void RegisterSystem(ISystem system)

Parameters

system ISystem

The 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

systemType Type

The system type.

dependencies ComponentDependencies

The 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

systemType Type

The system type to unregister.

Returns

bool

True if the system was unregistered.