예제 #1
0
 private FunctionalNode(Node parentNode, FunctionalNode nodeToCopy, NodeCopyInfo nodeCopyInfo)
     : base(parentNode, nodeToCopy, nodeCopyInfo)
 {
     Signature              = nodeToCopy.Signature;
     FunctionType           = nodeToCopy.FunctionType;
     RequiredFeatureToggles = nodeToCopy.RequiredFeatureToggles;
 }
예제 #2
0
        public void VisitFunctionalNode(SourceModel.FunctionalNode functionalNode)
        {
            var functionalNodeDfir = new Nodes.FunctionalNode(_currentDiagram, functionalNode.Signature, functionalNode.RequiredFeatureToggles);

            _map.AddMapping(functionalNode, functionalNodeDfir);
            MapTerminalsInOrder(functionalNode, functionalNodeDfir);
        }
예제 #3
0
        public void VisitNode(Node node)
        {
            var typePassthrough = node as TypePassthrough;

            if (typePassthrough != null)
            {
                var typePassthroughDfir = new Nodes.FunctionalNode(_currentDiagram, Signatures.ImmutablePassthroughType);
                _map.AddMapping(typePassthrough, typePassthroughDfir);
                _map.MapTerminalsInOrder(typePassthrough, typePassthroughDfir);
                return;
            }
            throw new NotImplementedException();
        }
예제 #4
0
        public void VisitLiteral(ILiteralModel literal)
        {
            NIType dataType = literal.DataType;

            if (dataType.IsRebarReferenceType())
            {
                dataType = dataType.GetUnderlyingTypeFromRebarType();
            }
            NIType constantType;

            if (dataType.IsString() && RebarFeatureToggles.IsStringDataTypeEnabled)
            {
                // Temporary: create a &'static str constant, and wire it through a StringFromSlice node
                // Get rid of this once there is source model support for &str Literals
                Constant             stringSliceConstant = Constant.Create(_currentDiagram, literal.Data, DataTypes.StringSliceType.CreateImmutableReference());
                Nodes.FunctionalNode stringFromSliceNode = new Nodes.FunctionalNode(
                    _currentDiagram,
                    Signatures.StringFromSliceType,
                    new[] { RebarFeatureToggles.StringDataType });
                NationalInstruments.Dfir.Wire.Create(_currentDiagram, stringSliceConstant.OutputTerminal, stringFromSliceNode.InputTerminals[0]);

                _map.AddMapping((Content)literal, stringFromSliceNode);
                _map.AddMapping(literal.OutputTerminal, stringFromSliceNode.OutputTerminals[1]);
                return;
            }

            if (dataType.WireTypeMayFork())
            {
                constantType = dataType;
            }
            else
            {
                constantType = dataType.CreateImmutableReference();
            }
            Constant constant = Constant.Create(_currentDiagram, literal.Data, constantType);

            _map.AddMapping((Content)literal, constant);
            _map.AddMapping(literal.OutputTerminal, constant.Terminals.ElementAt(0));
        }