Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding ParentId from a reference. #238

Open
xydan83 opened this issue Jun 30, 2023 · 1 comment
Open

Finding ParentId from a reference. #238

xydan83 opened this issue Jun 30, 2023 · 1 comment

Comments

@xydan83
Copy link
Contributor

xydan83 commented Jun 30, 2023

Hi again))
There is some code in import.c

Code num 1.

static NL_Reference *getHierachicalInverseReference(const NL_Node *node)
{

    NL_Reference *hierachicalRef = node->hierachicalRefs;
    while (hierachicalRef)
    {
        if (!hierachicalRef->isForward)
        {
            return hierachicalRef;
        }
        hierachicalRef = hierachicalRef->next;
    }
    return NULL;
}

And this code (num 2):

static UA_NodeId getParentId(const NL_Node *node, UA_NodeId *parentRefId)
{
    UA_NodeId parentId = UA_NODEID_NULL;

    if(NodesetLoader_isInstanceNode(node))
    {
        parentId = ((const NL_InstanceNode*)node)->parentNodeId;
    }
    NL_Reference *ref = getHierachicalInverseReference((const NL_Node *)node);
    *parentRefId = getReferenceTypeId(ref);
    if (UA_NodeId_equal(&parentId, &UA_NODEID_NULL))
    {
        parentId = getReferenceTarget(ref);
    }
    return parentId;
}

I have a question. If we can't find the ParentNodeId from ((const NL_InstanceNode*)node)->parentNodeId; and we need to find it by reference, we try to find it by the first inverse reference (code number 1). But the references are sorted before it or not?

@matkonnerth
Copy link
Collaborator

the first inverse hierachical reference is taken, they are not sorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants