Skip to content

Commit 4b7c0ef

Browse files
author
tempate
committed
Review - Apply suggestions
Signed-off-by: tempate <danieldiaz@eprosima.com>
1 parent a35c6c5 commit 4b7c0ef

5 files changed

Lines changed: 40 additions & 14 deletions

File tree

src/cpp/fastdds/xtypes/serializers/idl/dynamic_type_idl.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,22 @@ ReturnCode_t node_to_idl(
224224
///////////////////////
225225

226226
/**
227-
* @brief Gathers the \c element_type of the DynamicType.
227+
* @brief Gathers the \c element_type of the @ref DynamicType.
228228
*
229-
* @param dyn_type The DynamicType to gather the members from.
229+
* @param dyn_type The DynamicType to gather the \c element_type from.
230230
* @param element_type The element type of the DynamicType's \c type_descriptor.
231231
*/
232232
ReturnCode_t get_element_type(
233233
const DynamicType::_ref_type& dyn_type,
234234
DynamicType::_ref_type& element_type) noexcept;
235235

236236
/**
237-
* @brief Gathers the \c bounds of the DynamicType.
237+
* @brief Gathers the \c bounds of the @ref DynamicType.
238238
*
239-
* @param dyn_type The DynamicType to gather the members from.
240-
* @param bounds The vector to store the bounds in.
239+
* If there is a single bound of LENGTH_UNLIMITED, the bounds will be empty.
240+
*
241+
* @param dyn_type The DynamicType to gather the \c bounds from.
242+
* @param bounds The bounds of the DynamicType's \c type_descriptor.
241243
*/
242244
ReturnCode_t get_bounds(
243245
const DynamicType::_ref_type& dyn_type,

src/cpp/fastdds/xtypes/utils.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,30 @@ ReturnCode_t idl_serialize(
3636
const DynamicType::_ref_type& dynamic_type,
3737
std::ostream& output) noexcept
3838
{
39+
ReturnCode_t ret = RETCODE_OK;
40+
3941
// Create a tree representation of the dynamic type
4042
utilities::collections::TreeNode<TreeNodeType> parent_type;
41-
const auto ret = dyn_type_to_tree(dynamic_type, "PARENT", parent_type);
43+
ret = dyn_type_to_tree(dynamic_type, "PARENT", parent_type);
4244

4345
if (ret != RETCODE_OK)
4446
{
47+
EPROSIMA_LOG_WARNING(XTYPES_UTILS,
48+
"Failed to convert DynamicType to tree.");
4549
return ret;
4650
}
4751

4852
// Serialize the tree to IDL
49-
return dyn_type_tree_to_idl(parent_type, output);
53+
ret = dyn_type_tree_to_idl(parent_type, output);
54+
55+
if (ret != RETCODE_OK)
56+
{
57+
EPROSIMA_LOG_WARNING(XTYPES_UTILS,
58+
"Failed to convert DynamicType tree to IDL.");
59+
return ret;
60+
}
61+
62+
return RETCODE_OK;
5063
}
5164

5265
ReturnCode_t json_serialize(

test/unittest/dds/xtypes/serializers/idl/DynTypeIDLTests.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ TEST_P(DynTypeIDLTests, to_idl)
110110
std::stringstream idl_serialization;
111111
ASSERT_EQ(idl_serialize(dyn_type, idl_serialization), RETCODE_OK);
112112

113-
std::cout << idl_serialization.str() << std::endl;
114-
115113
// Compare IDLs
116114
ASSERT_EQ(idl_file, idl_serialization.str());
117115
}

test/unittest/dds/xtypes/serializers/idl/types/union_struct/gen/union_struct.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class BasicUnion
318318
int64_t _second)
319319
{
320320
second_() = _second;
321-
m__d = 2;
321+
m__d = 32767;
322322
}
323323

324324
/*!
@@ -392,7 +392,7 @@ class BasicUnion
392392
}
393393

394394

395-
int16_t m__d {2};
395+
int16_t m__d {32767};
396396

397397
union
398398
{
@@ -657,7 +657,7 @@ class ComplexUnion
657657
const BasicUnion& _fourth)
658658
{
659659
fourth_() = _fourth;
660-
m__d = 2;
660+
m__d = 2147483647;
661661
}
662662

663663
/*!
@@ -668,7 +668,7 @@ class ComplexUnion
668668
BasicUnion&& _fourth)
669669
{
670670
fourth_() = _fourth;
671-
m__d = 2;
671+
m__d = 2147483647;
672672
}
673673

674674
/*!
@@ -742,7 +742,7 @@ class ComplexUnion
742742
}
743743

744744

745-
int32_t m__d {2};
745+
int32_t m__d {2147483647};
746746

747747
union
748748
{

utils/scripts/update_generated_code_from_idl.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ files_needing_output_dir=(
4545
'./thirdparty/dds-types-test/IDL/strings.idl|../../../test/dds-types-test'
4646
'./thirdparty/dds-types-test/IDL/structures.idl|../../../test/dds-types-test'
4747
'./thirdparty/dds-types-test/IDL/unions.idl|../../../test/dds-types-test'
48+
'./test/unittest/dds/xtypes/serializers/idl/types/alias_struct/alias_struct.idl|./gen'
49+
'./test/unittest/dds/xtypes/serializers/idl/types/array_struct/array_struct.idl|./gen'
50+
'./test/unittest/dds/xtypes/serializers/idl/types/bitmask_struct/bitmask_struct.idl|./gen'
51+
'./test/unittest/dds/xtypes/serializers/idl/types/bitset_struct/bitset_struct.idl|./gen'
52+
'./test/unittest/dds/xtypes/serializers/idl/types/enum_struct/enum_struct.idl|./gen'
53+
'./test/unittest/dds/xtypes/serializers/idl/types/extensibility_struct/extensibility_struct.idl|./gen'
54+
'./test/unittest/dds/xtypes/serializers/idl/types/key_struct/key_struct.idl|./gen'
55+
'./test/unittest/dds/xtypes/serializers/idl/types/map_struct/map_struct.idl|./gen'
56+
'./test/unittest/dds/xtypes/serializers/idl/types/primitives_struct/primitives_struct.idl|./gen'
57+
'./test/unittest/dds/xtypes/serializers/idl/types/sequence_struct/sequence_struct.idl|./gen'
58+
'./test/unittest/dds/xtypes/serializers/idl/types/string_struct/string_struct.idl|./gen'
59+
'./test/unittest/dds/xtypes/serializers/idl/types/struct_struct/struct_struct.idl|./gen'
60+
'./test/unittest/dds/xtypes/serializers/idl/types/union_struct/union_struct.idl|./gen'
4861
)
4962

5063
files_needing_no_typesupport=(

0 commit comments

Comments
 (0)