Cross reference between nodemanagers

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
mazel
Jr. Member
Jr. Member
Posts: 2
Joined: 04 Jun 2012, 06:32

Cross reference between nodemanagers

Post by mazel »

Hello All,

In my sample server I have to reference nodes from different nodemanager(s). Is there any example? Sombody can provide any description what has to be done?

Thank you for your time.

Martin

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re:Cross reference between nodemanagers

Post by Support Team »

Hello Martin,

There is already sample code in the tutorials and server examples. There are overloads for NodeManagerUaNode::addUaReference() and NodeManagerUaNode::addNodeAndReference(). They take either a UaNode pointer or a UaNodeId. If both nodes are in the same namespace, you can pass in the node pointers. If one node (source or target) is in another namespace, you can pass in the NodeId of source and target node. The NodeManagerUaNode (included in NodeManagerBase) takes care about creating references between NodeManagers.

See the following pseudo code for examples.

Best Regards,
Unified Automation Support Team

Code: Select all

UaNode* pSourceNode;
UaNode* pTargetNode;
UaNodeId sourceNodeId;
UaNodeId targetNodeId;
UaNodeId referenceTypeNodeId;

// Adds new node with reference
// Source node is in different namespace
addNodeAndReference(sourceNodeId, pTargetNode, referenceTypeNodeId);
// Source and target are in same namespace
addNodeAndReference(pSourceNode, pTargetNode, referenceTypeNodeId);

// Adds only reference
// Source or target are in different namespace
addUaReference(sourceNodeId, targetNodeId, referenceTypeNodeId);
// Source and target are in same namespace
addUaReference(pSourceNode, pTargetNode, referenceTypeNodeId);
Best regards
Unified Automation Support Team

Post Reply