예제 #1
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;
            }
예제 #2
0
 public ForwardedPort CheckAndConvert(NodeSet set)
 {
     return(new ForwardedPort(IsInput, OriginPortID, set.Validate(Replacement), ReplacedPortID));
 }