3.5.12. Fast DDS-Gen for data types source code generation¶
eProsima Fast DDS comes with a built-in source code generation tool, Fast DDS-Gen, which eases the process of translating an IDL specification of a data type to a functional implementation. Thus, this tool automatically generates the source code of a data type defined using IDL. A basic use of the tool is described below. To learn about all the features that Fast DDS offers, please refer to Fast DDS-Gen section.
188.8.131.52. Basic usage¶
Fast DDS can be executed by calling fastddsgen on Linux or fastddsgen.bat on Windows.
The IDL file containing the data type definition is given with the
fastddsgen [<options>] <IDLfile> [<IDLfile> ...]
fastddsgen.bat [<options>] <IDLfile> [<IDLfile> ...]
Among the available arguments defined in Usage, the main Fast DDS-Gen options for data type source code generation are the following:
-replace: It replaces existing files in case the data type files have been previously generated.
-help: It lists the currently supported platforms and Visual Studio versions.
-typeobject: It builds additional files for
TypeObjectgeneration and management (see TypeObject).
-example: It generates a basic example of a DDS application and the files to build it for the given
platform. Thus, Fast DDS-Gen tool can generate a sample application using the provided data type, together with a Makefile, to compile it on Linux distributions, and a Visual Studio project for Windows. To see an example of this please refer to tutorial Building a publish/subscribe application.
184.108.40.206. Output files¶
Fast DDS-Gen outputs several files. Assuming the IDL file had the name “Mytype”, and none of the above options have been defined, these files are:
MyType.cxx/.h: Type definition.
MyTypePubSubType.cxx/.h: Serialization and deserialization source code for the data type. It also defines the
getKey()member function of the
MyTypePubSubTypeclass in case the topic implements keys (see Data types with a key).
-typeobject argument was used, MyType.cxx is modified to register the
TypeObject representation in
TypeObjectFactory, and these files will also be generated:
MyTypeTypeObject.cxx/.h: TypeObject representation for MyType IDL.