3.3 Creating User Data Types with IDL

You can create user data types in a text file using IDL (Interface Description Language). IDL is programming-language independent, so the same file can be used to generate code in C, Traditional C++, Modern C++, C++/CLI, Ada, and Java (the languages supported by RTI Code Generator (rtiddsgen)). RTI Code Generator parses the IDL file and automatically generates all the necessary routines and wrapper functions to bind the types for use by Connext DDS at run time. You will end up with a set of required routines and structures that your application and Connext DDS will use to manipulate the data.

Connext DDS only uses a subset of the IDL 4.2 (https://www.omg.org/spec/IDL) syntax. IDL was originally defined by the OMG for the use of CORBA client/server applications in an enterprise setting. Not all of the constructs that can be described by the language are as useful in the context of high-performance data-centric embedded applications. These include the constructs that define method and function prototypes like “interface.”

RTI Code Generator will parse any file that follows version 4.2 of the IDL specification. It will ignore and show a warning for all syntax that is not recognized by Connext DDS.

Certain keywords are considered reserved by the IDL specification; see Table 3.3 Reserved IDL Keywords.

Table 3.3 Reserved IDL Keywords

abstract

any

alias

attribute

bitfield

bitmask

bitset

boolean

case

char

component

connector

const

consumes

context

custom

default

double

exception

emits

enum

eventtype

factory

FALSE

finder

fixed

float

getraises

home

import

in

inout

interface

local

long

manages

map

mirrorport

module

multiple

native

Object

octet

oneway

out

primarykey

private

port

porttype

provides

public

publishes

raises

readonly

setraises

sequence

short

string

struct

supports

switch

TRUE

truncatable

typedef

typeid

typename

typeprefix

unsigned

union

uses

ValueBase

valuetype

void

wchar

wstring

int8

uint8

int16

int32

int64

uint16

uint32

uint64

 

 

The IDL constructs supported by RTI Code Generator are described in Table 3.5 Specifying Data Types in IDL for C through Table 3.9 Specifying Data Types in IDL for Java. Use these tables to map primitive types to their equivalent IDL syntax, and vice versa.

For C and Traditional C++, RTI Code Generator uses typedefs instead of the language keywords for primitive types. For example, DDS_Long instead of long or DDS_Double instead of double. This ensures that the types are of the same size regardless of the platform. 1 The number of bytes sent on the wire for each data type is determined by the Common Data Representation (CDR) defined in the ‘Extensible and Dynamic Topic Types for DDS’ specification (https://www.omg.org/spec/DDS-XTypes). There are two different CDR representations, encoding version 1 and encoding version 2. Connext DDS implements both. See the RTI Connext DDS Core Libraries Getting Started Guide Addendum for Extensible Types for more information.

© 2020 RTI