using System.Collections.Generic;
using MfGames.Gallium;
namespace MfGames.Nitride.Pipelines;
///
/// A basic pipeline that is configured through properties and methods.
///
public abstract class PipelineBase : IPipeline
{
private readonly List dependencies;
protected PipelineBase()
{
this.dependencies = new List();
}
///
/// Adds one or more pipeline dependencies into the current one. All of
/// the dependencies are guaranteed to run before this pipeline's RunAsync
/// is called.
///
/// The pipelines to add as a dependency.
/// The same object for chaining operations.
public PipelineBase AddDependency(params IPipeline[] pipelines)
{
foreach (IPipeline pipeline in pipelines)
{
this.dependencies.Add(pipeline);
}
return this;
}
///
public IEnumerable GetDependencies()
{
return this.dependencies;
}
///
public abstract IAsyncEnumerable RunAsync(
IEnumerable entities);
///
public override string ToString()
{
return this.GetType()
.Name;
}
}