Creating nested structured variables

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

Moderator: uasdkcpp

Post Reply
Mick Mathers
Jr. Member
Jr. Member
Posts: 1
Joined: 05 Aug 2022, 13:38

Creating nested structured variables

Post by Mick Mathers »

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

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

Re: Creating nested structured variables

Post by Support Team »

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.

Code: Select all

void NodeManagerDemo::createTypeNodes()
UaStatus NmBuildingAutomation::createTypeNodes()
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.
Best regards
Unified Automation Support Team

Post Reply