@@ -9,16 +9,14 @@ Dynamic Types IDL Parsing
99
1010*Fast DDS * supports the implementation of |DynamicTypes | for parsing IDL files at runtime to generate dynamic
1111data types.
12- The |DynamicTypeBuilderFactory::create_type_w_uri | API allows users to provide a URI pointing to an IDL file.
13- Fast DDS will process the file and return the corresponding DynamicTypeBuilder, which can then be used to create a
14- DynamicType.
1512
1613This feature enables applications to dynamically load type definitions from IDL files instead of relying solely on
1714pre-generated types or XML profiles.
1815This enhances flexibility, as new data types can be introduced without modifying and recompiling the application.
1916
20- Type definition
21- ^^^^^^^^^^^^^^^
17+ Supported Types
18+ ---------------
19+
2220Below, the types supported by *eProsima Fast DDS * IDL parsing are presented.
2321For further information about the supported |DynamicTypes |, please, refer to :ref: `xtypes_supportedtypes `.
2422
@@ -44,8 +42,8 @@ The following types are currently not supported by the IDL parsing feature:
4442* Inheritance
4543* Member ID
4644
47- Example
48- ^^^^^^^
45+ Create a Dynamic Type from a IDL file
46+ -------------------------------------
4947
5048*Fast DDS * application can use dynamic types generated in runtime just by loading the corresponding IDL files into the
5149|DynamicTypeBuilderFactory-api | using |DynamicTypeBuilderFactory::create_type_w_uri |.
@@ -61,10 +59,46 @@ data.
6159
6260 The preprocessor can be manually selected using |DynamicTypeBuilderFactory::set_preprocessor |
6361
62+ Example
63+ ^^^^^^^
64+
6465The following snippet shows the previously explained steps:
6566
6667.. literalinclude :: /../code/DDSCodeTester.cpp
6768 :language: c++
6869 :dedent: 8
69- :start-after: //DDS_DYNAMIC_TYPES_IDL_PARSING
70+ :start-after: //DDS_DYNAMIC_TYPES_IDL_PARSING_CREATE_TYPE
71+ :end-before: //!--
72+
73+
74+ Iterate over the parsed IDL types
75+ ---------------------------------
76+
77+ *Fast DDS * application supports a simple way to iterate over each aggregated type declared and parsed in the IDL file,
78+ *i.e *:
79+
80+ * :ref: `xtypes_supportedtypes_union `
81+ * :ref: `xtypes_supportedtypes_enumeration `
82+ * :ref: `xtypes_supportedtypes_structure `
83+ * :ref: `xtypes_supportedtypes_alias `
84+
85+ using |DynamicTypeBuilderFactory::for_each_type_w_uri | method.
86+ User can customize the runtime behavior by providing a lambda expression, which will be triggered
87+ when a new aggregated type is parsed.
88+
89+ The callback provided by the user receives the |DynamicTypeBuilder-api | instance related to the parsed type
90+ and returns a boolean value, indicating whether the iteration should continue or not.
91+ In case of returning false for a given type,
92+ the parsing process will stop and no further types will be processed.
93+
94+ Example
95+ ^^^^^^^
96+
97+ The following snippet shows how to iterate over the aggregated types declared in the IDL file,
98+ storing their names in a vector:
99+
100+ .. literalinclude :: /../code/DDSCodeTester.cpp
101+ :language: c++
102+ :dedent: 8
103+ :start-after: //DDS_DYNAMIC_TYPES_IDL_PARSING_ITERATE_OVER_TYPES
70104 :end-before: //!--
0 commit comments