2.3. Generate Type Support Code with rtiddsgen¶
You will provide your IDL as an input to rtiddsgen. rtiddsgen supports code generation for the following standard types:
octet, char, wchar
short, unsigned short
long, unsigned long
long long, unsigned long long float
double, long double
boolean
string
struct
array
enum
wstring
sequence
union
typedef
value type
rtiddsgen is in <your_top_level_dir>/rti_connext_dds-<version>/rti_connext_micro-<version>/bin.
To generate support code for data types in a file called HelloWorld.idl:
rtiddsgen -micro -language C -replace HelloWorld.idl
Run rtiddsgen -help to see all available options. For the options used here:
The
-microoption is necessary to generate support code specific to Connext Micro, as rtiddsgen is also capable of generating support code for Connext, and the generated code for the two are different. Note that Connext Micro and RTI Connext Cert use the same rtiddsgen and similar code is generated. However, when the generated code is compiled with RTI_CERT certain APIs are excluded.
The
-languageoption specifies the language of the generated code. Connext Micro supports C and traditional C++ (with-language C++).
The
-replaceoption specifies that the new generated code will replace, or overwrite, any existing files with the same name.
rtiddsgen generates the following files for an input file HelloWorld.idl:
HelloWorld.h and HelloWorld.c. Operations to manage a sample of the type, and a DDS sequence of the type.
HelloWorldPlugin.h and HelloWorldPlugin.c. Implements the type-plugin interface defined by Connext Micro. Includes operations to serialize and deserialize a sample of the type and its DDS instance keys.
HelloWorldSupport.h and HelloWorldSupport.c. Operations to generate a type-specific DataWriter and DataReader, and to register the type with a DDS DomainParticipant.
- Connext Micro supports generating two different types of type support:
XTypes - This is the default method and generates type support for types compatible with the DDS XTypes standard.
CDR - This is the original CDR support and uses less memory. To enable this method, pass the option
-intepreted 0to rtiddsgen.
For more details, see Generating Type Support with rtiddsgen.