示例#1
0
        /// <summary>
        /// Adds the <see cref="IInstanceNode" /> to the collection of a type children with goal to build inheritance chain and override the attributes of the base type by the derived type.
        /// </summary>
        /// <param name="childItem">The child item of the <paramref name="modelParentNode" />.</param>
        /// <param name="modelParentNode">The model parent node - the node, which type is processed and <paramref name="childItem" /> added.</param>
        /// <param name="typeParentID">The parent identifier of the type provisioning instance declarations - prefix to the relative reference path.</param>
        void IInstanceNodesCollection.Add(IInstanceNode childItem, IInstanceNodeContext modelParentNode, XmlQualifiedName typeParentID)
        {
            XmlQualifiedName _itemNodeID       = InstanceIdentifier.AddSuffix(modelParentNode.NodeID, childItem.SymbolicName.Name);
            string           _stringItemNodeID = InstanceIdentifier.NodeId(_itemNodeID);

            if (this.m_dictionary.ContainsKey(_stringItemNodeID))
            {
                this.m_dictionary[_stringItemNodeID].AddInstanceDeclarationOf(childItem, typeParentID);
            }
            else
            {
                this.Add(_stringItemNodeID, childItem, _itemNodeID, modelParentNode.AddressSpaceIndex, true);
            }
        }
示例#2
0
        void IInstanceNodesCollection.Add(IInstanceNode childItem, XmlQualifiedName parentNodeID, int parentAddressSpaceIndex, bool isInstanceDeclaration)
        {
            XmlQualifiedName _itemNodeID       = InstanceIdentifier.AddSuffix(parentNodeID, childItem.SymbolicName.Name);
            string           _stringItemNodeId = InstanceIdentifier.NodeId(_itemNodeID);

            if (!this.m_dictionary.ContainsKey(_stringItemNodeId))
            {
                this.Add(_stringItemNodeId, childItem, _itemNodeID, parentAddressSpaceIndex, isInstanceDeclaration);
            }
            else
            {
                string _msg = String.Format("The node {0} is declared twice and has been removed from the model", childItem.SymbolicName.ToString());
                m_compiler.Assert(false, parentAddressSpaceIndex, _msg);
            }
        }
        /// <summary>
        /// Adds the reference of an instance declaration.
        /// </summary>
        /// <param name="reference">The reference to be added.</param>
        /// <param name="referenceParent">The reference parent.</param>
        /// <param name="typeParentID">The parent identifier of the type provisioning instance declarations - prefix to the relative reference path.</param>
        public void AddReference(Reference reference, INodeDesign referenceParent, XmlQualifiedName typeParentID)
        {
            string           _relativeName = referenceParent.CalculateReferenceRelativeName(reference.Wrapper.TargetId.Name);
            XmlQualifiedName id            = null;

            if (string.IsNullOrEmpty(_relativeName))
            {
                id = new XmlQualifiedName(InstanceIdentifier.AddSuffix(typeParentID.Name, reference.Wrapper.TargetId.Name), m_Parent.NodeID.Namespace);
            }
            else
            {
                id = new XmlQualifiedName(InstanceIdentifier.AddSuffix(typeParentID.Name, _relativeName), m_Parent.NodeID.Namespace);
            }
            ReferenceStub rs = new ReferenceStub()
            {
                Inverse       = reference.Wrapper.IsInverse,
                ReferenceType = reference.Wrapper.ReferenceType.XmlQualifiedName,
                TargetName    = id
            };

            m_References.Add(rs);
        }