From 7c42ada62442aedd03608a97b5bda0df963c29ae Mon Sep 17 00:00:00 2001 From: cferreiragonz Date: Tue, 13 May 2025 15:02:33 +0200 Subject: [PATCH 1/2] Refs #23150: Apply custom templates to included IDL files Signed-off-by: cferreiragonz --- code/FastDDSGenCodeTester.cpp | 1 + docs/fastddsgen/dataTypes/dataTypes.rst | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/code/FastDDSGenCodeTester.cpp b/code/FastDDSGenCodeTester.cpp index 8829bea92..54fc8b0ba 100644 --- a/code/FastDDSGenCodeTester.cpp +++ b/code/FastDDSGenCodeTester.cpp @@ -182,5 +182,6 @@ enum MyBitMask : uint8_t // INCLUDE_MORE_IDL_FILES #include "OtherFile.idl" #include + #include //! /**/ diff --git a/docs/fastddsgen/dataTypes/dataTypes.rst b/docs/fastddsgen/dataTypes/dataTypes.rst index 498ac269c..5858282cb 100644 --- a/docs/fastddsgen/dataTypes/dataTypes.rst +++ b/docs/fastddsgen/dataTypes/dataTypes.rst @@ -449,6 +449,23 @@ If *Fast DDS-Gen* does not find a C/C++ preprocessor in default system paths, th using parameter ``-ppPath``. The parameter ``-ppDisable`` can be used to disable the usage of the C/C++ preprocessor. +The parameter ``-extrastg`` can also be used to apply custom templates to included IDL files. +To enable this feature, the output file name passed to ``-extrastg`` must include the character ``@``, which will be +be replaced by the name of the included file to generate the output file. + +The following command will generate two custom templates, one for the main IDL file and another for the included one: + +- ``MainIDL_Custom.cpp`` +- ``IncludedIDL_Custom.cpp`` + +Where ``IncludedIDL.idl`` is included in ``MainIDL.idl`` file. + +.. code-block:: bash + + /scripts/fastddsgen MainIDL.idl -I -extrastg /Custom.stg @_Custom.cpp + +Check :ref:`fastddsgen_supported_options` for more information about the ``-extrastg`` option. + Annotations -------------- From a2f7ed70dbdc058864cc6e6d5ce2d634990a6b54 Mon Sep 17 00:00:00 2001 From: cferreiragonz Date: Fri, 16 May 2025 09:13:03 +0200 Subject: [PATCH 2/2] Refs #23150: Apply suggestion Signed-off-by: cferreiragonz --- docs/fastddsgen/dataTypes/dataTypes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fastddsgen/dataTypes/dataTypes.rst b/docs/fastddsgen/dataTypes/dataTypes.rst index 5858282cb..23661aac1 100644 --- a/docs/fastddsgen/dataTypes/dataTypes.rst +++ b/docs/fastddsgen/dataTypes/dataTypes.rst @@ -451,7 +451,7 @@ The parameter ``-ppDisable`` can be used to disable the usage of the C/C++ prepr The parameter ``-extrastg`` can also be used to apply custom templates to included IDL files. To enable this feature, the output file name passed to ``-extrastg`` must include the character ``@``, which will be -be replaced by the name of the included file to generate the output file. +replaced by the name of the included file to generate the output file. The following command will generate two custom templates, one for the main IDL file and another for the included one: