Esempio n. 1
0
        public CodeGenVariableTypeBase CreateProperty(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                                      NodeState parent,
                                                      string fileNoExtension,
                                                      string name,
                                                      string typeId, ushort typeNamespaceIndex, IdType typeNodeIdType,
                                                      string nodeId, ushort namespaceIndex, IdType nodeIdType,
                                                      string parentNodeId, ushort parentNamespaceIndex, IdType parentNodeIdType,
                                                      int valueRank)
        {
            PropertyState property = new PropertyState(parent);

            property.SymbolicName     = name;
            property.ReferenceTypeId  = ReferenceTypes.HasProperty;
            property.TypeDefinitionId = VariableTypeIds.PropertyType;
            property.NodeId           = Helper.CreateID(childrenIDMap, this, nodeId, namespaceIndex, nodeIdType);
            property.ValueRank        = valueRank;
            property.ArrayDimensions  = null;

            //TODO: More code for different types
            if (valueRank == ValueRanks.OneDimension)
            {
                property.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> {
                    0
                });
            }
            else if (valueRank == ValueRanks.TwoDimensions)
            {
                property.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> {
                    0, 0
                });
            }

            if (parent != null)
            {
                parent.AddChild(property);
            }

            CodeGenVariableTypeBase newNode = CodeGenNodeFactory.CreateVariable(name, fileNoExtension,
                                                                                typeId, typeNamespaceIndex, typeNodeIdType,
                                                                                nodeId, namespaceIndex, nodeIdType,
                                                                                parentNodeId, parentNamespaceIndex, parentNodeIdType);

            newNode.SetNode(property);
            newNode.IsProperty(true);
            newNode.Initialize(childrenIDMap, this);
            return(newNode);
        }
Esempio n. 2
0
        public CodeGenVariableTypeBase CreateVariable(Dictionary <CodeGenNodeID, CodeGenNodeID> childrenIDMap,
                                                      NodeState parent,
                                                      string fileNoExtension,
                                                      string name,
                                                      string typeId, ushort typeNamespaceIndex, IdType typeNodeIdType,
                                                      string nodeId, ushort namespaceIndex, IdType nodeIdType,
                                                      string parentNodeId, ushort parentNamespaceIndex, IdType parentNodeIdType,
                                                      int valueRank)
        {
            BaseDataVariableState variable = new BaseDataVariableState(parent);

            variable.SymbolicName     = name;
            variable.TypeDefinitionId = Helper.CreateID(typeId, typeNamespaceIndex, typeNodeIdType);
            variable.NodeId           = Helper.CreateID(childrenIDMap, this, nodeId, namespaceIndex, nodeIdType);
            //variable.BrowseName       = new QualifiedName(name, NamespaceIndex);
            variable.ValueRank       = valueRank;
            variable.ArrayDimensions = null;

            //TODO: More code for different types
            if (valueRank == ValueRanks.OneDimension)
            {
                variable.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> {
                    0
                });
            }
            else if (valueRank == ValueRanks.TwoDimensions)
            {
                variable.ArrayDimensions = new ReadOnlyList <uint>(new List <uint> {
                    0, 0
                });
            }

            if (parent != null)
            {
                parent.AddChild(variable);
            }

            CodeGenVariableTypeBase newNode = CodeGenNodeFactory.CreateVariable(name, fileNoExtension,
                                                                                typeId, typeNamespaceIndex, typeNodeIdType,
                                                                                nodeId, namespaceIndex, nodeIdType,
                                                                                parentNodeId, parentNamespaceIndex, parentNodeIdType);

            newNode.SetNode(variable);
            newNode.Initialize(childrenIDMap, this);
            return(newNode);
        }