TypeObject and TypeCode

TypeObject and TypeCode support in RTI Connext DDS

During the matching process, RTI Connext DDS compares the structure of the topic types provided by the DataWriters and DataReaders to determine if they can communicate. To do so, the TypeObject or TypeCode is needed. If the TypeObject or TypeCode is not available, matching is done based on the topic name only.

Earlier versions of RTI Connext DDS (4.5f and lower) use TypeCodes as the wire representation to communicate types over the network and the TypeCode API to introspect and manipulate the types at run time.

RTI Connext DDS 5.x releases include partial support for the “Extensible and Dynamic Topic Types for DDS” (DDS-XTYPES) specification from the Object Management Group (OMG). This is achieved by means of TypeObjects, which is an evolution of TypeCodes. TypeObjects allow systems to define data types in a more flexible way and to evolve data types over time without giving up portability, interoperability, or the expressiveness of the DDS type system.

The XTYPES specification uses TypeObjects as the wire representation. This specification also uses the DynamicType API to introspect and manipulate the types. However, RTI Connext DDS 5.x does not currently support the DynamicType API. Therefore, you must continue using the TypeCode API to introspect the types at run time.

Furthermore, RTI Connext DDS 5.x still supports propagation of TypeCodes in order to maintain backward compatibility with previous releases.

However, support for TypeCodes for introspecting the types at run time may be discontinued in future releases. 

Differences between TypeObjects and TypeCodes

One important limitation of using TypeCodes as the wire representation is that their serialized size is limited to 65 KB. This is a problem for services and tools that depend on the discovered types, such as RTI Routing Service and RTI Spreadsheet Add-in for Microsoft Excel. With the introduction of TypeObjects, this limitation is removed since the size of the serialized representation is unbounded.

The following table summarizes the differences between TypeCodes and TypeObjects:
 
 

RTI Connext DDS 5.x

RTI Connext DDS 4.5f and Earlier

Wire representation

TypeObjects or TypeCodes (for backwards compatibility)

TypeCodes

For introspection at run time

TypeCode API

TypeCode API

Maximum size of serialized representation

When using TypeObjects: Unbounded

When using Typecodes: 65 KB

65 KB

For more information, see the documentation about Type Representation.

Configuring TypeObjects and TypeCodes

The DomainParticipantResourceLimitsQosPolicy includes fields that control resource utilization when TypeObjects in a DomainParticipant are stored and propagated. Note that memory usage is optimized; only one instance of a TypeObject will be stored, even if multiple local or remote DataReaders or DataWriters use it.

By default, RTI Connext DDS will propagate both the pre-standard TypeCode and the new standard TypeObject. It is also possible to send either or none of them:

<participant_qos>
    <resource_limits>
        <type_code_max_serialized_length>0</type_code_max_serialized_length>
    </resource_limits>
</participant_qos>  
<participant_qos>
    <resource_limits>
        <type_object_max_serialized_length>0</type_object_max_serialized_length>
    </resource_limits>
</participant_qos>  

When running RTI Code Generator, you may use the option -notypecode  to disable the generation of TypeCode information.

Those QoS policies can also be used to change the size of the TypeObjects or TypeCodes. In order to see the possible scenarios refer to this solution .

If the default size is changed, it affects the system performance because the endpoint discovery messages will be bigger. Also, if the types are bigger than 65KB (it will use TypeObject), the writing will be asynchronous, and it will impact the performace:

It is important to note that using asynchronous writing has other impacts, like longer time for writes (depending on flow controller settings), additional thread creation and complexity. Therefore, this mode should only be used when necessary.