public CodeGenMethodTypeBase CreateMethod(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) { MethodState method = new MethodState(parent); method.SymbolicName = name; method.ReferenceTypeId = ReferenceTypeIds.HasComponent; method.NodeId = Helper.CreateID(childrenIDMap, this, nodeId, namespaceIndex, nodeIdType); //method.BrowseName = name; //method.DisplayName = name; method.UserWriteMask = AttributeWriteMask.None; method.UserExecutable = true; if (parent != null) { parent.AddChild(method); } CodeGenMethodTypeBase newNode = CodeGenNodeFactory.CreateMethod(name, fileNoExtension, typeId, typeNamespaceIndex, typeNodeIdType, nodeId, namespaceIndex, nodeIdType, parentNodeId, parentNamespaceIndex, parentNodeIdType); newNode.SetNode(method); newNode.Initialize(childrenIDMap, this); return(newNode); }
public CodeGenObjectTypeBase CreateObject( 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) { BaseObjectState obj = new BaseObjectState(parent); obj.SymbolicName = name; obj.TypeDefinitionId = Helper.CreateID(typeId, typeNamespaceIndex, typeNodeIdType); obj.NodeId = Helper.CreateID(childrenIDMap, this, nodeId, namespaceIndex, nodeIdType); obj.BrowseName = new QualifiedName(name, NamespaceIndex); obj.DisplayName = obj.BrowseName.Name; obj.UserWriteMask = AttributeWriteMask.None; obj.EventNotifier = EventNotifiers.None; if (parent != null) { parent.AddChild(obj); } CodeGenObjectTypeBase newNode = CodeGenNodeFactory.CreateObject(name, fileNoExtension, typeId, typeNamespaceIndex, typeNodeIdType, nodeId, namespaceIndex, nodeIdType, parentNodeId, parentNamespaceIndex, parentNodeIdType); newNode.SetNode(obj); newNode.Initialize(childrenIDMap, this); return(newNode); }
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); }
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); }