Generated Nodemanager - Parsing instances from XML

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

Moderator: uasdkcpp

Post Reply
andrenicolaysen
Jr. Member
Jr. Member
Posts: 2
Joined: 17 Aug 2018, 11:27

Generated Nodemanager - Parsing instances from XML

Post by andrenicolaysen »

Hi,

Currently trying to develop an server application using generated cpp files from UaModeler. These files contain the type definitions, no instances.
We would like to load the instances from XMLfile, but we can't seem to tie the generated types / Nodemanager in with the loaded instances.

Are there any guidelines or examples on how to use generated classes together with instances loaded from XML?

Thank you for the help
-André

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

Re: Generated Nodemanager - Parsing instances from XML

Post by Support Team »

Hi André,

There is extended documentation in the latest C++ SDK that provides more background and information for the different options.

Firt of all you have to understand the concept of namespaces and that it is strongly recommend to have types and instances in different namespaces.
See for more details:
https://documentation.unified-automation.com/uasdkcpp/1.7.4/html/L2UaAdrSpaceConceptNamespaces.html
and more specific for static (type) namespaces:
https://documentation.unified-automation.com/uasdkcpp/1.7.4/html/L2UaAdrSpaceConceptNamespaces.html#L3UaAdrSpaceConceptNamespaces_static

It is a typical scenario to create code for a type namespace and to load instances from an instance namespace from a UANodeSet XML file.

If you have two namespaces in UaModeler, you can create code for the type namespace following the tutorial in UaModler:
https://documentation.unified-automation.com/uamodeler/1.6.5/html/howprojwin_sec.html

The different options to integrate namespaces and nodes into a server are described in the C++ SDK introduction:
https://documentation.unified-automation.com/uasdkcpp/1.7.4/html/L2ServerSdkServerAddressSpace.html
The option to load from UANodeSet XML is described here:
https://documentation.unified-automation.com/uasdkcpp/1.7.4/html/L2ServerSdkServerAddressSpace.html#L3ServerSdkServerAddressSpace_xml

The generated code includes a node factory. In older SDK versions it was necessary to pass in the factories for the depending namespaces.
Starting with C++ SDK 1.7.3, the SDK creates a default factory manager with the default factories for the NodeManagers (if available). The necessary code is created with UaModler 1.6.5 and later.

The sample code in the above referenced (option to load from UANodeSet XML) documentation is enough to instantiate the corresponding C++ Classes for the ObjectTypes from the type namespace (generated code) when the imported XML UANodeSet contains an instance of such an ObjecType.

Another typical requirement is that variable instances provide information in the UANodeSet about the underlying system and how to get the value for the variable from the underlying system. The C++ SDK demo server provides sample code and a sample XML UANodeSet that contains such information in node extensions.
See
https://documentation.unified-automation.com/uasdkcpp/1.7.4/html/L2DemoServer.html#L3DemoServer_3
Best regards
Unified Automation Support Team

Post Reply