Opc.Ua.NodeBrowser.IsRequired C# (CSharp) Method

IsRequired() public method

Returns true if the reference type is required.
public IsRequired ( Opc.Ua.NodeId referenceType, bool isInverse ) : bool
referenceType Opc.Ua.NodeId
isInverse bool
return bool
        public virtual bool IsRequired(NodeId referenceType, bool isInverse)
        {
            if (NodeId.IsNull(referenceType))
            {
                return false;
            }

            // easiet to check inverse flag first.
            if (isInverse)
            {
                if (m_browseDirection == BrowseDirection.Forward)
                {
                    return false;
                }
            }
            else
            {
                if (m_browseDirection == BrowseDirection.Inverse)
                {
                    return false;
                }
            }

            // check for no filter or exact match.
            if (NodeId.IsNull(m_referenceType) || referenceType == m_referenceType)
            {
                return true;
            }

            // check subtypes if possible.
            if (m_includeSubtypes && m_context != null)
            {
                if (m_context.TypeTable.IsTypeOf(referenceType, m_referenceType))
                {
                    return true;
                }
            }

            return false;
        }

Same methods

NodeBrowser::IsRequired ( NodeState target ) : bool

Usage Example

コード例 #1
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            if (!NodeId.IsNull(m_typeDefinitionId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasTypeDefinition, false))
                {
                    browser.Add(ReferenceTypeIds.HasTypeDefinition, false, m_typeDefinitionId);
                }
            }

            if (!NodeId.IsNull(m_modellingRuleId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasModellingRule, false))
                {
                    browser.Add(ReferenceTypeIds.HasModellingRule, false, m_modellingRuleId);
                }
            }

            if (m_parent != null)
            {
                if (!NodeId.IsNull(m_referenceTypeId))
                {
                    if (browser.IsRequired(m_referenceTypeId, true))
                    {
                        browser.Add(m_referenceTypeId, true, m_parent);
                    }
                }
            }
        }
All Usage Examples Of Opc.Ua.NodeBrowser::IsRequired