If I want to create a variable with nested structures, what's the best way to proceed?
Can I use the UaStructureDefinition::addChild() method to add a field that's a structure, or is another approach preferred?
TIA
Mick Mathers
Creating nested structured variables
Moderator: uasdkcpp
-
- Jr. Member
- Posts: 1
- Joined: 05 Aug 2022, 13:38
- Support Team
- Hero Member
- Posts: 3070
- Joined: 18 Mar 2011, 15:09
Re: Creating nested structured variables
Hello Mick,
You should use the addChild() method only. There is no other approach.
https://documentation.unified-automation.com/uasdkcpp/1.7.7/html/classUaStructureDefinition.html#a405947ab03a9aff024f27269be220f9e
We have examples to create custom data structures. Please look for the below methods in the DemoServer.
https://documentation.unified-automation.com/uasdkcpp/1.7.7/html/L2DemoServer.html#L3DemoServer_5
We also always advise, if the structures are already known at compile time, to generate the code for the structures using the UaModeler.
You should use the addChild() method only. There is no other approach.
https://documentation.unified-automation.com/uasdkcpp/1.7.7/html/classUaStructureDefinition.html#a405947ab03a9aff024f27269be220f9e
We have examples to create custom data structures. Please look for the below methods in the DemoServer.
Code: Select all
void NodeManagerDemo::createTypeNodes()
UaStatus NmBuildingAutomation::createTypeNodes()
We also always advise, if the structures are already known at compile time, to generate the code for the structures using the UaModeler.
Best regards
Unified Automation Support Team
Unified Automation Support Team