Files
UnrealEngineUWP/Engine/Source/Programs/Shared/EpicGames.BuildGraph/Expressions/BgAgent.cs
Ben Marsh 38f3bc55ef BuildGraph: Various VM improvements.
* Added support for deserializing BgObject types directly into native classes.
* Removed opcodes for creating graph structures. These are now created in user code from BgObject types.
* Removed BgNodeSpecBuilder. BgNode objects can now be modified directly (returning a modified copy).
* Added concrete types for option parameters. The VM now keeps track of any parameters for evaluated options, allowing them to be added into the graph definition.
* Order dependencies now take nodes rather than outputs.
* Added explicit support for native thunks, whose bindings are saved to a sideband channel during compilation and referenced in bytecode as an index. This generalizes code that was previously specific to node definitions.
* Added a name table to bytecode, to optimize situations where we reference the same string mulitple times.

#preflight 62bf3c583f0d6beee2e8f4a6

[CL 20918762 by Ben Marsh in ue5-main branch]
2022-07-01 14:47:54 -04:00

59 lines
1.4 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using EpicGames.BuildGraph.Expressions;
using EpicGames.Core;
using Microsoft.Extensions.Logging;
namespace EpicGames.BuildGraph.Expressions
{
/// <summary>
/// Describes an agent that can execute execute build steps
/// </summary>
public class BgAgent : BgExpr
{
/// <summary>
/// Name of the agent
/// </summary>
public BgString Name { get; }
/// <summary>
/// List of agent types to select from, in order of preference. The first agent type supported by a stream will be used.
/// </summary>
public BgList<BgString> Types { get; set; }
/// <summary>
/// Constructor
/// </summary>
public BgAgent(BgString name, BgString type)
: this(name, BgList.Create(type))
{
}
/// <summary>
/// Constructor
/// </summary>
public BgAgent(BgString name, BgList<BgString> types)
: base(BgExprFlags.ForceFragment)
{
Name = name;
Types = types;
}
/// <inheritdoc/>
public override void Write(BgBytecodeWriter writer)
{
BgObject<BgAgentDef> obj = BgObject<BgAgentDef>.Empty;
obj = obj.Set(x => x.Name, Name);
obj = obj.Set(x => x.PossibleTypes, Types);
writer.WriteExpr(obj);
}
/// <inheritdoc/>
public override BgString ToBgString() => "{Agent}";
}
}