// Copyright Epic Games, Inc. All Rights Reserved. namespace EpicGames.BuildGraph.Expressions { /// /// Specification for a graph in fluent syntax /// public class BgGraph : BgExpr { /// /// Nodes for the graph /// public BgList Nodes { get; } /// /// Aggregates for the graph /// public BgList Aggregates { get; } /// /// Constructor /// public BgGraph(BgList nodes, BgList aggregates) : base(BgExprFlags.ForceFragment) { Nodes = nodes; Aggregates = aggregates; } /// /// Implicit conversion from a node spec /// public static implicit operator BgGraph(BgNode node) { return new BgGraph(node, BgList.Empty); } /// /// Implicit conversion from a list of node specs /// public static implicit operator BgGraph(BgList nodes) { return new BgGraph(nodes, BgList.Empty); } /// /// Implicit conversion from an aggregate spec /// public static implicit operator BgGraph(BgAggregate aggregate) { return new BgGraph(BgList.Empty, aggregate); } /// /// Implicit conversion from a list of node specs /// public static implicit operator BgGraph(BgList aggregates) { return new BgGraph(BgList.Empty, aggregates); } /// public override void Write(BgBytecodeWriter writer) { BgObject obj = BgObject.Empty; obj = obj.Set(x => x.Nodes, Nodes); obj = obj.Set(x => x.Aggregates, Aggregates); writer.WriteExpr(obj); } /// public override BgString ToBgString() => "{Graph}"; } }