Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/BuildGraph/ManualTrigger.cs
Ryan Durand 9ef3748747 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870955 by Ryan Durand in Main branch]
2019-12-26 23:01:54 -05:00

95 lines
2.5 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutomationTool
{
/// <summary>
/// Defines a manual trigger; a fence behind which build nodes will only be built if explicitly activated in the job setup.
/// </summary>
class ManualTrigger
{
/// <summary>
/// The parent trigger
/// </summary>
public readonly ManualTrigger Parent;
/// <summary>
/// Name of this trigger
/// </summary>
public readonly string Name;
/// <summary>
/// List of users to notify about this trigger
/// </summary>
public HashSet<string> NotifyUsers = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
/// <summary>
/// Constructor
/// </summary>
/// <param name="InParent">The parent trigger</param>
/// <param name="InName">Name of this trigger</param>
public ManualTrigger(ManualTrigger InParent, string InName)
{
Parent = InParent;
Name = InName;
}
/// <summary>
/// Checks whether this trigger is upstream of another
/// </summary>
/// <param name="Other">The other trigger to check</param>
/// <returns>True if this trigger is upstream of the given trigger</returns>
public bool IsUpstreamFrom(ManualTrigger Other)
{
for(ManualTrigger Ancestor = Other; Ancestor != null; Ancestor = Ancestor.Parent)
{
if(Ancestor == this)
{
return true;
}
}
return false;
}
/// <summary>
/// Checks whether this trigger is downstream of another
/// </summary>
/// <param name="Other">The parent trigger to check</param>
/// <returns>True if the trigger is downstream of the given trigger</returns>
public bool IsDownstreamFrom(ManualTrigger Other)
{
for(ManualTrigger Ancestor = Parent; Ancestor != null; Ancestor = Ancestor.Parent)
{
if(Ancestor == Other)
{
return true;
}
}
return false;
}
/// <summary>
/// The qualified name of this trigger. For triggers which are nested more than one level deep, this consists of all the required triggers in order, separated by dot characters.
/// </summary>
public string QualifiedName
{
get { return (Parent == null)? Name : (Parent.QualifiedName + "." + Name); }
}
/// <summary>
/// Get the name of this trigger
/// </summary>
/// <returns>The qualified name of this trigger</returns>
public override string ToString()
{
return QualifiedName;
}
}
}