/// <summary>
 /// Overload of <see cref="NodeMemoryInput{TTag,TBufferToMove}(NodeHandle, InputPortID)"/>
 /// targeting a port array with an index parameter.
 /// </summary>
 public NodeMemoryInput(NodeHandle node, InputPortID portArray, int arrayIndex)
 {
     Node                = node;
     InternalPort        = new InputPortArrayID(portArray, arrayIndex);
     ResolvedDestination = default;
     WasCreatedStrongly  = false;
 }
 /// <summary>
 /// See <see cref="NodeMemoryInput{TTag,TBufferToMove}(NodeHandle, InputPortID)"/>.
 /// </summary>
 public static NodeMemoryInput <TTag, TBufferToMove> Create <TDefinition>(NodeHandle <TDefinition> node, DataInput <TDefinition, Buffer <TBufferToMove> > port)
     where TDefinition : NodeDefinition, new()
 {
     return(new NodeMemoryInput <TTag, TBufferToMove>
     {
         Node = node,
         InternalPort = new InputPortArrayID((InputPortID)port),
         ResolvedDestination = default,
Пример #3
0
        public InputPair(NodeSet set, NodeHandle destHandle, InputPortArrayID destinationPort)
        {
            Handle = set.Validate(destHandle);
            var table = set.GetForwardingTable();

            for (var fH = set.GetNode(Handle).ForwardedPortHead; fH != ForwardPortHandle.Invalid; fH = table[fH].NextIndex)
            {
                ref var forwarding = ref table[fH];

                if (!forwarding.IsInput)
                {
                    continue;
                }

                var port = forwarding.GetOriginInputPortID();

                // Forwarded port list are monotonically increasing by port, so we can break out early
                if (forwarding.GetOriginPortCounter() > destinationPort.PortID.Port)
                {
                    break;
                }

                if (port != destinationPort.PortID)
                {
                    continue;
                }

                if (!set.StillExists(forwarding.Replacement))
                {
                    throw new InvalidOperationException("Replacement node for previously registered forward doesn't exist anymore");
                }

                Handle = forwarding.Replacement;
                Port   = destinationPort.IsArray
                    ? new InputPortArrayID(forwarding.GetReplacedInputPortID(), destinationPort.ArrayIndex)
                    : new InputPortArrayID(forwarding.GetReplacedInputPortID());

                return;
            }
        /// <summary>
        /// See <see cref="DisconnectAndRetainValue(NodeHandle, OutputPortID, NodeHandle, InputPortID)"/>
        /// </summary>
        void DisconnectAndRetainValue <TType, TSource, TDestination>(
            NodeHandle <TSource> sourceHandle,
            DataOutput <TSource, TType> sourcePort,
            NodeHandle <TDestination> destHandle,
            InputPortArrayID destPort
            )
            where TSource : NodeDefinition, new()
            where TDestination : NodeDefinition, new()
            where TType : struct
        {
            var source = new OutputPair(this, sourceHandle, sourcePort.Port);
            var dest   = new InputPair(this, destHandle, destPort);

            var portDef = GetFormalPort(dest);

            if (portDef.HasBuffers)
            {
                throw new InvalidOperationException($"Cannot retain data on a data port which includes buffers");
            }

            Disconnect(source, dest);
            m_Diff.RetainData(dest);
        }
Пример #5
0
 /// <summary>
 /// Get an enumerator to inputs connected to this port.
 /// </summary>
 /// <remarks>
 /// In DFG, it only makes sense to have one input to any input port, hence the naming.
 /// It should be checked.
 /// </remarks>
 public static Topology.InputConnectionCacheWalker GetInputForPatchingByPort(this Topology.VertexCache vertexCache, InputPortArrayID port)
 => vertexCache.GetParentConnectionsByPort(port, Topology.TraversalCache.Hierarchy.Alternate);