/// <summary> /// Add an output to the current node /// </summary> /// <param name="node">The node to add</param> /// <param name="pathName">The name of the path from this node to the other</param> /// <param name="weak">Indicates the output is weak</param> public virtual void AddOutput(BasePipelineNode node, string pathName, bool weak) { lock (_output) { _output.Add(new OutputNode(node, pathName, weak)); } }
/// <summary> /// Shutdown this node /// </summary> /// <param name="inputNode">The node which is requesting shutdown, if null then force</param> public virtual void Shutdown(BasePipelineNode inputNode) { bool doShutdown = false; lock (_shutdownInputs) { if (!IsShuttingdown) { if (inputNode != null) { _shutdownInputs.Remove(inputNode.Uuid); doShutdown = _shutdownInputs.Count == 0; } else { doShutdown = true; } IsShuttingdown = doShutdown; } } if (doShutdown) { // If true is returned we can safely pass along the shutdown if (OnShutdown()) { ShutdownOutputs(); } } }
/// <summary> /// Constructor /// </summary> /// <param name="frame">The data frame to edit</param> /// <param name="sender">The sending node</param> /// <param name="color">The colour to show in an edit window</param> /// <param name="tag">The textual tag to show in an edit window</param> public EditPacketEventArgs(DataFrame frame, BasePipelineNode sender, ColorValue color, string tag) { Frame = frame; Sender = sender; Color = color; Tag = tag; }
/// <summary> /// Constructor /// </summary> /// <param name="frame">The data frame to edit</param> /// <param name="selectPath">Path to select a node to edit</param> /// <param name="sender">The sending node</param> /// <param name="color">The colour to show in an edit window</param> /// <param name="tag">The textual tag to show in an edit window</param> public EditPacketEventArgs(DataFrame frame, string selectPath, BasePipelineNode sender, ColorValue color, string tag) : base() { Frame = frame; SelectPath = selectPath; Sender = sender; Color = color; Tag = tag; }
/// <summary> /// Edit a packet from the graph /// </summary> /// <param name="frame">The frame to edit</param> /// <param name="selectPath">A path to select when editing</param> /// <param name="sender">The sending nod</param> /// <param name="color">The colour to show in an edit window (if applicable)</param> /// <param name="tag">The textual tag to show in an edit window (if applicable)</param> /// <returns>The returned frame, this may or may not be the same frame as sent</returns> public DataFrame DoEditPacket(DataFrame frame, string selectPath, BasePipelineNode sender, ColorValue color, string tag) { NetGraph top = GetTopGraph(); EditPacketEventArgs args = new EditPacketEventArgs(frame, selectPath, sender, color, tag); top.OnEditPacket(this, args); return(args.Frame); }
/// <summary> /// Extended match syntax, can use details from a graph and node /// </summary> /// <param name="frame">The data frame to select off</param> /// <param name="globalMeta">The global meta</param> /// <param name="meta">Meta</param> /// <param name="node">The current node</param> /// <param name="properties">Property bag</param> /// <param name="uuid">The uuid for private names</param> /// <returns>True if the filter matches</returns> public bool IsMatch(DataFrame frame, MetaDictionary meta, MetaDictionary globalMeta, PropertyBag properties, Guid uuid, BasePipelineNode node) { bool match = false; DataNode[] nodes = GeneralUtils.SelectNodes(Path, frame, meta, globalMeta, properties, uuid, node); match = OnMatch(nodes); if (Invert) { return !match; } else { return match; } }
/// <summary> /// Add a node to the graph and ensure shutdown event is handled /// </summary> /// <param name="uuid">The Guid of the factory</param> /// <param name="node">The node itself</param> public void AddNode(Guid uuid, BasePipelineNode node) { Nodes.Add(uuid, node); node.NodeShutdown += new EventHandler(node_NodeShutdown); }
/// <summary> /// Constructor /// </summary> /// <param name="node"></param> /// <param name="pathName"></param> /// <param name="weak"></param> public OutputNode(BasePipelineNode node, string pathName, bool weak) { Node = node; PathName = pathName; WeakPath = weak; }
/// <summary> /// Edit a packet from the graph /// </summary> /// <param name="frame">The frame to edit</param> /// <param name="selectPath">A path to select when editing</param> /// <param name="sender">The sending nod</param> /// <param name="color">The colour to show in an edit window (if applicable)</param> /// <param name="tag">The textual tag to show in an edit window (if applicable)</param> /// <returns>The returned frame, this may or may not be the same frame as sent</returns> public DataFrame DoEditPacket(DataFrame frame, string selectPath, BasePipelineNode sender, ColorValue color, string tag) { NetGraph top = GetTopGraph(); EditPacketEventArgs args = new EditPacketEventArgs(frame, selectPath, sender, color, tag); top.OnEditPacket(this, args); return args.Frame; }
/// <summary> /// Add a node to the graph and ensure shutdown event is handled /// </summary> /// <param name="uuid">The Guid of the factory</param> /// <param name="node">The node itself</param> public void AddNode(Guid uuid, BasePipelineNode node) { Nodes.Add(uuid, node); node.NodeShutdown += new EventHandler(node_NodeShutdown); }
/// <summary> /// Extended match syntax, can use details from a graph and node /// </summary> /// <param name="frame">The data frame to select off</param> /// <param name="globalMeta">The global meta</param> /// <param name="meta">The meta</param> /// <param name="node">The current node</param> /// <param name="properties">The property bag</param> /// <param name="uuid">The uuid for private meta names</param> /// <returns>True if the filter matches</returns> public bool IsMatch(DataFrame frame, MetaDictionary meta, MetaDictionary globalMeta, PropertyBag properties, Guid uuid, BasePipelineNode node) { bool ret = true; foreach (IDataFrameFilter filter in _filters) { ret = filter.IsMatch(frame, meta, globalMeta, properties, uuid, node); if (_matchAll) { if (!ret) { break; } } else { if (ret) { break; } } } if (Invert) { return !ret; } else { return ret; } }
/// <summary> /// Constructor /// </summary> /// <param name="graph">The current netgraph</param> /// <param name="input">The input pipeline node</param> /// <param name="output">The output pipeline node</param> internal TestGraphContainer(NetGraph graph, BasePipelineNode input, BasePipelineNode output) { Graph = graph; Input = input; Output = output; }
private static NetGraph BuildGraph(ScriptContainer container, string classname, string selectionPath, out BasePipelineNode input, out ParseWithPipelineNode output) { DynamicNodeFactory factory = new DynamicNodeFactory("", Guid.NewGuid(), container, classname, null); ParseWithPipelineNodeFactory parseWithFactory = new ParseWithPipelineNodeFactory(); factory.SelectionPath = selectionPath; NetGraphBuilder builder = new NetGraphBuilder(); builder.AddNode(factory); builder.AddNode(parseWithFactory); builder.AddLine(factory, parseWithFactory, null); NetGraph graph = builder.Factory.Create(Logger.GetSystemLogger(), null, new MetaDictionary(), new MetaDictionary(), new PropertyBag("Connection")); input = graph.Nodes[factory.Id]; output = (ParseWithPipelineNode)graph.Nodes[parseWithFactory.Id]; return graph; }
/// <summary> /// Constructor /// </summary> /// <param name="node"></param> /// <param name="pathName"></param> /// <param name="weak"></param> public OutputNode(BasePipelineNode node, string pathName, bool weak) { Node = node; PathName = pathName; WeakPath = weak; }
/// <summary> /// Shutdown this node /// </summary> /// <param name="inputNode">The node which is requesting shutdown, if null then force</param> public virtual void Shutdown(BasePipelineNode inputNode) { bool doShutdown = false; lock(_shutdownInputs) { if (!IsShuttingdown) { if (inputNode != null) { _shutdownInputs.Remove(inputNode.Uuid); doShutdown = _shutdownInputs.Count == 0; } else { doShutdown = true; } IsShuttingdown = doShutdown; } } if (doShutdown) { // If true is returned we can safely pass along the shutdown if (OnShutdown()) { ShutdownOutputs(); } } }
/// <summary> /// Add an output to the current node /// </summary> /// <param name="node">The node to add</param> /// <param name="pathName">The name of the path from this node to the other</param> /// <param name="weak">Indicates the output is weak</param> public virtual void AddOutput(BasePipelineNode node, string pathName, bool weak) { lock (_output) { _output.Add(new OutputNode(node, pathName, weak)); } }