private BorrowTunnel(Structure parentStructure, BorrowTunnel toCopy, NodeCopyInfo copyInfo)
            : base(parentStructure, toCopy, copyInfo)
        {
            BorrowMode = toCopy.BorrowMode;
            Node mappedTunnel;

            if (copyInfo.TryGetMappingFor(toCopy.TerminateLifetimeTunnel, out mappedTunnel))
            {
                TerminateLifetimeTunnel = (TerminateLifetimeTunnel)mappedTunnel;
                TerminateLifetimeTunnel.BeginLifetimeTunnel = this;
            }
        }
Beispiel #2
0
        private NationalInstruments.Dfir.BorderNode TranslateBorderNode(BorderNode sourceModelBorderNode, NationalInstruments.Dfir.Structure dfirParentStructure)
        {
            var flatSequenceSimpleTunnel = sourceModelBorderNode as FlatSequenceSimpleTunnel;
            var loopTunnel          = sourceModelBorderNode as LoopTunnel;
            var borrowTunnel        = sourceModelBorderNode as SourceModel.BorrowTunnel;
            var loopBorrowTunnel    = sourceModelBorderNode as LoopBorrowTunnel;
            var lockTunnel          = sourceModelBorderNode as SourceModel.LockTunnel;
            var loopConditionTunnel = sourceModelBorderNode as SourceModel.LoopConditionTunnel;
            var loopIterateTunnel   = sourceModelBorderNode as SourceModel.LoopIterateTunnel;
            var flatSequenceTerminateLifetimeTunnel = sourceModelBorderNode as FlatSequenceTerminateLifetimeTunnel;
            var loopTerminateLifetimeTunnel         = sourceModelBorderNode as LoopTerminateLifetimeTunnel;
            var unwrapOptionTunnel = sourceModelBorderNode as SourceModel.UnwrapOptionTunnel;

            if (borrowTunnel != null)
            {
                var borrowDfir = new Nodes.BorrowTunnel(dfirParentStructure, borrowTunnel.BorrowMode);
                CreateTerminateLifetimeTunnel(borrowDfir, dfirParentStructure);
                return(borrowDfir);
            }
            else if (loopBorrowTunnel != null)
            {
                var borrowDfir = new Nodes.BorrowTunnel(dfirParentStructure, loopBorrowTunnel.BorrowMode);
                CreateTerminateLifetimeTunnel(borrowDfir, dfirParentStructure);
                return(borrowDfir);
            }
            else if (lockTunnel != null)
            {
                var lockDfir = new Nodes.LockTunnel(dfirParentStructure);
                CreateTerminateLifetimeTunnel(lockDfir, dfirParentStructure);
                return(lockDfir);
            }
            else if (loopConditionTunnel != null)
            {
                var loopConditionDfir = new Nodes.LoopConditionTunnel((Nodes.Loop)dfirParentStructure);
                CreateTerminateLifetimeTunnel(loopConditionDfir, dfirParentStructure);
                return(loopConditionDfir);
            }
            else if (loopIterateTunnel != null)
            {
                var loopIterateDfir = new IterateTunnel(dfirParentStructure);
                CreateTerminateLifetimeTunnel(loopIterateDfir, dfirParentStructure);
                return(loopIterateDfir);
            }
            else if (flatSequenceTerminateLifetimeTunnel != null)
            {
                var beginLifetimeDfir = (Nodes.IBeginLifetimeTunnel)_map.GetDfirForModel((Element)flatSequenceTerminateLifetimeTunnel.BeginLifetimeTunnel);
                return(beginLifetimeDfir.TerminateLifetimeTunnel);
            }
            else if (loopTerminateLifetimeTunnel != null)
            {
                var beginLifetimeDfir = (Nodes.IBeginLifetimeTunnel)_map.GetDfirForModel((Element)loopTerminateLifetimeTunnel.BeginLifetimeTunnel);
                return(beginLifetimeDfir.TerminateLifetimeTunnel);
            }
            else if (flatSequenceSimpleTunnel != null || loopTunnel != null)
            {
                return(dfirParentStructure.CreateTunnel(
                           VIDfirBuilder.TranslateDirection(sourceModelBorderNode.PrimaryOuterTerminal.Direction),
                           NationalInstruments.Dfir.TunnelMode.LastValue,
                           sourceModelBorderNode.PrimaryOuterTerminal.DataType,
                           sourceModelBorderNode.PrimaryInnerTerminals.First().DataType));
            }
            else if (unwrapOptionTunnel != null)
            {
                return(new Nodes.UnwrapOptionTunnel(dfirParentStructure));
            }
            throw new NotImplementedException("Unknown BorderNode type: " + sourceModelBorderNode.GetType().Name);
        }