You are here: Part 2: Core Concepts > Data Types and DDS Data Samples > Creating User Data Types with IDL

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, 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 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 3.0.3 of the IDL specification. It will quietly ignore all syntax that is not recognized by Connext DDS. In addition, even though “anonymous sequences” (sequences of sequences with no intervening typedef) are currently legal in IDL, they have been deprecated by the specification; thus RTI Code Generator does not support them.

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

Reserved IDL Keywords

abstract

emits

local

pseudo

typeid

alias

enum

long

public

typename

any

eventtype

mirrorport

publishes

typeprefix

attribute

exception

module

raises

union

boolean

factory

multiple

readonly

unsigned

case

FALSE

native

sequence

uses

char

finder

object

setraises

valuebase

component

fixed

octet

short

valuetype

connector

float

oneway

string

void

const

getraises

out

struct

wchar

consumes

home

port

supports

wstring

context

import

porttype

switch

 

custom

in

primarykey

TRUE

 

default

inout

private

truncatable

 

double

interface

provides

typedef

 

The IDL constructs supported by RTI Code Generator are described in Specifying Data Types in IDL for C through 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.1The number of bytes sent on the wire for each data type is determined by the Common Data Representation (CDR) standard. For details on CDR, please see the Common Object Request Broker Architecture (CORBA) Specification, Version 3.1, Part 2: CORBA Interoperability, Section 9.3, CDR Transfer Syntax (http://www.omg.org/spec/CORBA/3.3/ ).

The remainder of this section includes:

Variable-Length Types

Value Types

Type Codes

Translations for IDL Types

Escaped Identifiers

Namespaces in IDL

Referring to Other IDL Files

Preprocessor Directives

Using Builtin Annotations

© 2017 RTI