The Qt OPC UA data type generator

Starting with Qt 6.7, Qt OPC UA comes with a data type generator named qopcuaxmldatatypes2cpp which generates Qt OPC UA compatible C++ enumerations and data classes from enums and structured types in .bsd files.

The generator is a command line tool which can be controlled by the following argument:

LongShortPurpose
–input-iA .bsd file for which all contained enum and struct types will be generated. Can be used more than once to generate code for multiple models.
–dependencyinput-dA dependency input .bsd file where only types required by a struct from an input file passed via —input will be generated. Can be used more than once to accommodate models with dependencies to multiple other models.
–output-oThe output directory where the generated files will be placed.
–prefix-pThe prefix for the generated file, enum and class names. The default value is GeneratedOpcUa.

The following files are generated for each run:

  • One .h file containing a namespace with all enumerated types
  • One .h and one .cpp file for each structured type
  • One .h and one .cpp file containing encoding and decoding methods