Page 1 of 1

How to access data of an UaModeler generated object instance?

Posted: 07 Jul 2021, 18:58
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

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

Posted: 07 Jul 2021, 21:24
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.