5.1. What’s New in 4.2.0

5.1.1. Code Generator Will Not Parse Duplicated XML Files

Previously, Code Generator would display an error if you generated code for the following scenario:

You have three XML files:A.xml, B.xml and C.xml.

A.xml includes B.xml and C.xml.

B.xml includes C.xml.

If you generated code for A.xml, you would get an error that the types from C.xml are duplicated. If the files were IDL, this could be resolved by using#ifdef or#ifndef clauses, but these are not available in XML.

Code Generator now checks if an XML file has already been included and will not parse it again. You won’t receive a type duplication error in the above scenario.

5.1.2. Added Warning to Code Generator when Defining Multiple Enums with Common Enumerator in the Same Namespace

The OMG ‘Interface Definition Language’ specification, version 4.2 does not allow the use of a common enumerator in multiple enums in the same namespace. For example, the following IDL is not compliant with the IDL 4.2 specification:

enum ENUM1 {A,B,C};
enum ENUM2 {C,D,E}; // C is a common enumerator in both enums.

Previously, Code Generator would not display a warning if it generated code for the above IDL, even though the IDL was not compliant with the OMG specification.

Now, if you try to generate code for the above IDL, Code Generator will display a warning, but will still generate the code. If the flag -strict is used (to enable strict OMG specification compliance checks) and you try to generate code for the above IDL, Code Generator will fail and report that there is a common enumerator in multiple enums.

Note

If you are generating code for C or C++98 for an IDL with a common enumerator in multiple enums, you must use the flag -qualifiedEnumerator, or else code generation will fail.

5.1.3. Added Java Exit Code to Code Generator

If a Java program does not end with an explicit System.exit(0) command, it might continue running inside a Docker™ container or virtual machine. This improvement ends Code Generator with an explicit System.exit(0).

5.1.4. Added Flag to Display Type Sizes

The -typeSizes flag has been added to Code Generator. This flag will display the following types information:

  • Maximum key serialization size.

  • Minimum serialization size.

  • Maximum serialization size.

If the type sizes can be computed, Code Generator will display the sizes. In some scenarios, however, Code Generator will not be able to compute the type sizes and will display the following:

  • If there is a recursive type, Code Generator will display Undefined (Recursive Type).

  • If there is a type that is unresolved because you are using @resolve-name false, Code Generator will display Undefined (Unresolved Member).

  • If the type is bigger than the maximum serialized size, Code Generator will display Error (Over Max Serialized Size).

As an example, for the following IDL:

union typeUnion switch(boolean){
    case TRUE: int16 m1;
    case FALSE: int64 m2;
};

struct typeStruct {
    @optional int32 m1;
    typeUnion m2;
};

If you call rtiddsgen with the -typeSizes flag:

rtiddsgen -typeSizes idlFile.idl

Code Generator will produce the following output:

INFO com.rti.ndds.nddsgen.Main Running rtiddsgen version 4.1.0, please wait ...
INFO com.rti.ndds.nddsgen.dataRepresentation.CDR
Xcdr1 types sizes from idlFile.idl:
+==================================================================================+
| Type Name  | Max Key Serialized Size | Min Serialized Size | Max Serialized Size |
+==================================================================================+
| typeUnion  | 16                      | 4                   | 16                  |
+----------------------------------------------------------------------------------+
| typeStruct | 28                      | 8                   | 28                  |
+----------------------------------------------------------------------------------+

INFO com.rti.ndds.nddsgen.dataRepresentation.CDR
Xcdr2 types sizes from idlFile.idl:
+==================================================================================+
| Type Name  | Max Key Serialized Size | Min Serialized Size | Max Serialized Size |
+==================================================================================+
| typeUnion  | 16                      | 8                   | 16                  |
+----------------------------------------------------------------------------------+
| typeStruct | 28                      | 16                  | 28                  |
+----------------------------------------------------------------------------------+

INFO com.rti.ndds.nddsgen.Main Done

Note

Using the flag may reduce Code Generator performance. We recommend you disable the flag if you just want to generate code and you don’t want or need type information.

5.1.5. Added Support to Generate Examples in C# for .Net 8

Code Generator can now generate example C# files for .Net 8 with the command-line argument -platform net8.

5.1.6. New Command-Line Arguments to Define the Endianness and Data Representation

Code Generator has two new command-line arguments to specify the endianness and the data representation. These will optimize DomainParticipant creation for a specific endianness and data representation. The arguments are only valid in C, C++98, and C++11.

-allowedDataRepresentation: Generates code for just one data representation: XCDR1 or XCDR2.

-allowedEndian: Defines the endianness for the generated code: bigEndian or littleEndian.

5.1.7. Added Support for New OMG IDL4 to C++ Language Mapping

Code Generator provides a new mapping for Modern C++, based on the new OMG IDL4 to C++ Language Mapping standard (IDL4-CPP).

To generate code for the new mapping, use the following command-line options:

-language C++11 -standard IDL4_CPP

The most notable changes in the IDL4-CPP mapping are:

  • IDL structs map to C++ structs with public fields, instead of classes with getters and setters

  • IDL unions still map to classes with getters and setters with the following additions:

    • For members selected by multiple labels, a setter receiving the discriminator value as a second argument is also generated

    • A method called _default() that sets the union to its default discriminator is generated

  • string and wstring constants map to std::string_view and std::wstring_view for platforms that support C++17

5.1.8. Added Support for rtiddsgen_server on macOS

RTI Code Generator’s rtiddsgen_server is now supported on macOS. Previously, it was supported only on Windows and Linux. This support was added in release 7.1.0, but not documented at that time.

5.1.9. Third-Party Software Upgrades

The following third-party software used by Code Generator has been upgraded:

Third-Party Software

Previous Version

Current Version

AdoptOpenJDK

11.0.13

17.0.6

AdoptOpenJRE

11.0.13

17.0.6

For information on third-party software used by Connext products, see the “3rdPartySoftware” documents in your installation: <NDDSHOME>/doc/manuals/connext_dds_professional/release_notes_3rdparty.