您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
55 行
2.3 KiB
55 行
2.3 KiB
using System.Collections.Generic;
|
|
|
|
namespace Unity.Services.Core.Internal
|
|
{
|
|
/// <summary>
|
|
/// Contain dependency relations between <see cref="IInitializablePackage"/>
|
|
/// types and <see cref="IServiceComponent"/> types using their hash code.
|
|
/// </summary>
|
|
class DependencyTree
|
|
{
|
|
/// <summary>
|
|
/// Key: Hash code of a <see cref="IInitializablePackage"/> type.
|
|
/// Value: Package instance.
|
|
/// </summary>
|
|
public Dictionary<int, IInitializablePackage> PackageTypeHashToInstance;
|
|
|
|
/// <summary>
|
|
/// Key: Hash code of a <see cref="IServiceComponent"/> type.
|
|
/// Value: Hash code of the <see cref="IInitializablePackage"/> type providing the component type.
|
|
/// </summary>
|
|
public Dictionary<int, int> ComponentTypeHashToPackageTypeHash;
|
|
|
|
/// <summary>
|
|
/// Key: Hash code of the <see cref="IInitializablePackage"/> type.
|
|
/// Value: Container of all hash code of <see cref="IServiceComponent"/>
|
|
/// types required to initialize the package.
|
|
/// </summary>
|
|
public Dictionary<int, List<int>> PackageTypeHashToComponentTypeHashDependencies;
|
|
|
|
/// <summary>
|
|
/// Key: Hash code of a <see cref="IServiceComponent"/> type.
|
|
/// Value: Component instance.
|
|
/// </summary>
|
|
public readonly Dictionary<int, IServiceComponent> ComponentTypeHashToInstance;
|
|
|
|
internal DependencyTree()
|
|
: this(
|
|
new Dictionary<int, IInitializablePackage>(),
|
|
new Dictionary<int, int>(),
|
|
new Dictionary<int, List<int>>(),
|
|
new Dictionary<int, IServiceComponent>()) {}
|
|
|
|
internal DependencyTree(
|
|
Dictionary<int, IInitializablePackage> packageToInstance,
|
|
Dictionary<int, int> componentToPackage,
|
|
Dictionary<int, List<int>> packageToComponentDependencies,
|
|
Dictionary<int, IServiceComponent> componentToInstance)
|
|
{
|
|
PackageTypeHashToInstance = packageToInstance;
|
|
ComponentTypeHashToPackageTypeHash = componentToPackage;
|
|
PackageTypeHashToComponentTypeHashDependencies = packageToComponentDependencies;
|
|
ComponentTypeHashToInstance = componentToInstance;
|
|
}
|
|
}
|
|
}
|