Hello,
This is regarding this FAQ.
https://forum.unified-automation.com/viewtopic.php?f=34&t=316
Question:
With deleteUaNode(pNodeToDelete, OpcUa_True, OpcUa_True, OpcUa_True) with all flags set to True can delete all children recursively?
Background:
I was trying [server_lesson03] from [UaSdkCppBundleSource\examples\server_gettingstarted] with C++ based OPC UA Client Server SDK (Bundle) v1.7.4.
The following two modifications were made.
(1) Only use AIR_CONDITIONER type and did not use FURNACE type.
#define NUMBER_AIRCONDITIONER 10
#define NUMBER_FURNACES 0
(2) Only two Variables (PowerConsumption) and (State) are added and the tree will be something like below.
> Root
>> Objects
>>> BuildingAutomation
>>>>> AirConditioner_1
>>>>>> PowerConsumption
>>>>>> State
Delete folder:
UaNodeId folderNodeId("BuildingAutomation", getNameSpaceIndex());
UaNode* folderNode = getNode(folderNodeId);
if (folderNode != NULL)
{
deleteUaNode(folderNode, OpcUa_True, OpcUa_True, OpcUa_True);
folderNode->releaseReference();
folderNode = NULL;
}
Above method will delete everything including AirConditioner_1 node?
After I have tried to delete folder, it seems I still need to delete "AirConditioner_1" to re-create the same nodes.
Thank you.
Will deleteUaNode delete Children recursively?
Moderator: uasdkcpp
-
- Sr. Member
- Posts: 17
- Joined: 09 Jun 2021, 11:42
- Support Team
- Hero Member
- Posts: 3068
- Joined: 18 Mar 2011, 15:09
Re: Will deleteUaNode delete Children recursively?
Hello ssmaung,
if the deleteAllChildren flag is set all child nodes are deleted.
Here child nodes means:
All nodes that are reachable by following forward references that are of type "HasChild" or any subtype. The AirConditioner objects however are referenced by references of type "Organizes".
see:
http://documentation.unified-automation.com/uasdkcpp/1.7.4/html/classNodeManagerUaNode.html#a42f15b979114c6ca9026683433d6ac5c
if the deleteAllChildren flag is set all child nodes are deleted.
Here child nodes means:
All nodes that are reachable by following forward references that are of type "HasChild" or any subtype. The AirConditioner objects however are referenced by references of type "Organizes".
see:
http://documentation.unified-automation.com/uasdkcpp/1.7.4/html/classNodeManagerUaNode.html#a42f15b979114c6ca9026683433d6ac5c
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Sr. Member
- Posts: 17
- Joined: 09 Jun 2021, 11:42
Re: Will deleteUaNode delete Children recursively?
Dear Support Team,
Thank you very much.
It is working as expected now after modifying child nodes to HasComponent or HasProperty.
Thank you very much.
It is working as expected now after modifying child nodes to HasComponent or HasProperty.