How to access data of an UaModeler generated object instance?

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

Moderator: uasdkcpp

Post Reply
MartinMajewski
Full Member
Full Member
Posts: 7
Joined: 24 Jun 2021, 17:13

How to access data of an UaModeler generated object instance?

Post by MartinMajewski »

Hi,

I used UaModeler to generate all h and cpp files with all my types, as well as an instance of those types in the objects folder. Your tutorial shows how to implement the fktSum method. Okay, I got that. But how to access variables of those instances like from the MyNs_NodeManagerBLABLA.cpp? I have retrieved the UaNode with getNode and inside the debugger, I can see, that there are all methods and variables somehow present. But how do I access them from code?

Best wishes,
Martin

MartinMajewski
Full Member
Full Member
Posts: 7
Joined: 24 Jun 2021, 17:13

Re: How to access data of an UaModeler generated object instance?

Post by MartinMajewski »

Found a solution, but I don't know if it is best practice:

Code: Select all

ChildNodeType* pChildNodeInstance = dynamic_cast<ChildNodeType*>(this->pParentNodeTypeInstance); // Parent pointer retrieved with getNode(UaNodeId) from MyNsNodeManager
pChildNodeInstance->setVariableValue(NewValue);
I would appreciate it if such short HowTos would be present in die documentation in an easily discoverable place.

Post Reply