Opc.Ua.Server.CoreNodeManager.FindInstanceDeclarationsInType C# (CSharp) Method

FindInstanceDeclarationsInType() private method

Recursively finds the first instance declaration that matches the browse path.
private FindInstanceDeclarationsInType ( ExpandedNodeId instanceId, List browsePath, int index, List declarations ) : bool
instanceId ExpandedNodeId
browsePath List
index int
declarations List
return bool
        private bool FindInstanceDeclarationsInType(
            ExpandedNodeId      instanceId, 
            List<QualifiedName> browsePath, 
            int                 index, 
            List<ILocalNode>    declarations)
        {            
            // ignore remote nodes.
            ILocalNode instance = GetLocalNode(instanceId) as ILocalNode;

            if (instance == null)
            {
                return false;
            }
                  
            // nothing more to do if no match on current browse name.
            if (instance.BrowseName != browsePath[index])
            {
                return false;
            }

            // add match to list of declarations.
            if (index >= browsePath.Count-1)
            {
                declarations.Add(instance);
                return true;
            }
            
            // recursivily find chilren.
            IList<IReference> children = instance.References.Find(ReferenceTypeIds.HierarchicalReferences, false, true, m_server.TypeTree);
            
            foreach (IReference reference in children)
            {
                if (FindInstanceDeclarationsInType(reference.TargetId, browsePath, index+1, declarations))
                {
                    return true;
                }
            }

            return false;
        }
        

Same methods

CoreNodeManager::FindInstanceDeclarationsInType ( ILocalNode type, List browsePath, List declarations ) : void