From bc557b75500a4c500d380609513a0fc0693b5db0 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:49:11 +0200 Subject: [PATCH] Refactor XML Parser to return DynamicTypeBuilder instead of DynamicType (#4970) * Refs #21184: Refactor get_dynamic_type_builder_from_xml_by_name and getDynamicTypeByName to get a DynamicTypeBuilder Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Adjust dynamic types tests Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Add flag to xtypes example to get types and profiles from xml Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Update methods name Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Update version.md Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Uncrustify Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Make type definition by xml loaded by environment variable works Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Make type works with hello world Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Add test for the example to load the type from xml Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: UNcrustify Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Clarify how to use xml-type flag Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Fix xml parser test Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Fix parse XML dynamic type throwing exception to return nullptr Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #Apply suggestions Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Compare DynamicType with DynamicType, instead of DynamicTypeBuilder Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #21184: Fix xml parser las test Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --------- Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- .../HelloWorldPublisher.cpp | 9 +- examples/cpp/xtypes/CLIParser.hpp | 46 +++- examples/cpp/xtypes/PublisherApp.cpp | 95 ++++--- examples/cpp/xtypes/PublisherApp.hpp | 3 +- examples/cpp/xtypes/README.md | 4 +- examples/cpp/xtypes/SubscriberApp.cpp | 1 + examples/cpp/xtypes/xtypes_profile.xml | 111 +++++---- .../dds/domain/DomainParticipantFactory.hpp | 3 +- .../domain/DomainParticipantFactory.cpp | 4 +- src/cpp/xmlparser/XMLDynamicParser.cpp | 73 ++++-- src/cpp/xmlparser/XMLParser.h | 2 +- src/cpp/xmlparser/XMLProfileManager.cpp | 8 +- src/cpp/xmlparser/XMLProfileManager.h | 8 +- test/examples/xtypes.compose.yml | 22 +- .../dynamic_types/DynamicTypesTests.cpp | 231 +++++++++--------- .../dds/participant/ParticipantTests.cpp | 15 +- .../xmlparser/XMLProfileParserTests.cpp | 11 +- versions.md | 1 + 18 files changed, 372 insertions(+), 275 deletions(-) diff --git a/examples/cpp/dds/DynamicHelloWorldExample/HelloWorldPublisher.cpp b/examples/cpp/dds/DynamicHelloWorldExample/HelloWorldPublisher.cpp index d5c6f93a514..c91b27a4c30 100644 --- a/examples/cpp/dds/DynamicHelloWorldExample/HelloWorldPublisher.cpp +++ b/examples/cpp/dds/DynamicHelloWorldExample/HelloWorldPublisher.cpp @@ -28,7 +28,6 @@ #include #include #include -#include using namespace eprosima::fastdds::dds; @@ -49,18 +48,18 @@ bool HelloWorldPublisher::init() return false; } - DynamicType::_ref_type dyn_type; + DynamicTypeBuilder::_ref_type dyn_type_builder; if (RETCODE_OK != DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("HelloWorld", - dyn_type)) + dyn_type_builder)) { std::cout << "Error getting dynamic type \"HelloWorld\"." << std::endl; return false; } - TypeSupport m_type(new DynamicPubSubType(dyn_type)); - m_Hello = DynamicDataFactory::get_instance()->create_data(dyn_type); + TypeSupport m_type(new DynamicPubSubType(dyn_type_builder->build())); + m_Hello = DynamicDataFactory::get_instance()->create_data(dyn_type_builder->build()); m_Hello->set_string_value(m_Hello->get_member_id_by_name("message"), "Hello DDS Dynamic World"); m_Hello->set_uint32_value(m_Hello->get_member_id_by_name("index"), 0); m_Hello->set_uint32_values(m_Hello->get_member_id_by_name("array"), {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}); diff --git a/examples/cpp/xtypes/CLIParser.hpp b/examples/cpp/xtypes/CLIParser.hpp index feb8019c3e8..0dd75aa08ec 100644 --- a/examples/cpp/xtypes/CLIParser.hpp +++ b/examples/cpp/xtypes/CLIParser.hpp @@ -45,6 +45,7 @@ class CLIParser { CLIParser::EntityKind entity = CLIParser::EntityKind::UNDEFINED; uint16_t samples = 0; + bool use_xml = false; }; /** @@ -57,17 +58,22 @@ class CLIParser static void print_help( uint8_t return_code) { - std::cout << "Usage: xtypes [options]" << std::endl; - std::cout << "" << std::endl; - std::cout << "Entities:" << std::endl; - std::cout << " publisher Run a publisher entity" << std::endl; - std::cout << " subscriber Run a subscriber entity" << std::endl; - std::cout << "" << std::endl; - std::cout << "Common options:" << std::endl; - std::cout << " -h, --help Print this help message" << std::endl; - std::cout << " -s , --samples Number of samples to send or receive" << std::endl; - std::cout << " [0 <= <= 65535]" << std::endl; - std::cout << " (Default: 0 [unlimited])" << std::endl; + std::cout << "Usage: xtypes [options]" << std::endl; + std::cout << "" << std::endl; + std::cout << "Entities:" << std::endl; + std::cout << " publisher Run a publisher entity" << std::endl; + std::cout << " subscriber Run a subscriber entity" << std::endl; + std::cout << "" << std::endl; + std::cout << "Common options:" << std::endl; + std::cout << " -h, --help Print this help message" << std::endl; + std::cout << " -s , --samples Number of samples to send or receive" << std::endl; + std::cout << " [0 <= <= 65535]" << std::endl; + std::cout << " (Default: 0 [unlimited])" << std::endl; + std::cout << "Publisher options:" << std::endl; + std::cout << " --xml-type Get types defined in xml file. " << std::endl; + std::cout << " The xml file to use must be set " << std::endl; + std::cout << " through environment variable." << std::endl; + std::cout << " (Default: Types defined with C++ API) " << std::endl; std::exit(return_code); } @@ -158,6 +164,24 @@ class CLIParser print_help(EXIT_FAILURE); } } + else if (arg == "--xml-type") + { + if (config.entity == CLIParser::EntityKind::PUBLISHER) + { + config.use_xml = true; + } + else if (config.entity == CLIParser::EntityKind::SUBSCRIBER) + { + EPROSIMA_LOG_ERROR(CLI_PARSER, "--xml-type flag available only for subscriber entity"); + print_help(EXIT_FAILURE); + } + else + { + EPROSIMA_LOG_ERROR(CLI_PARSER, "entity not specified for --xml-type flag"); + print_help(EXIT_FAILURE); + } + } + else { EPROSIMA_LOG_ERROR(CLI_PARSER, "unknown option " + arg); diff --git a/examples/cpp/xtypes/PublisherApp.cpp b/examples/cpp/xtypes/PublisherApp.cpp index 0cc866694ca..3dafccc83b1 100644 --- a/examples/cpp/xtypes/PublisherApp.cpp +++ b/examples/cpp/xtypes/PublisherApp.cpp @@ -52,9 +52,17 @@ PublisherApp::PublisherApp( , samples_(config.samples) , stop_(false) { - // Create the type - DynamicType::_ref_type dynamic_type = create_type(); + // Create the participant + auto factory = DomainParticipantFactory::get_instance(); + participant_ = factory->create_participant_with_default_profile(nullptr, StatusMask::none()); + + if (participant_ == nullptr) + { + throw std::runtime_error("Participant initialization failed"); + } + // Create the type + DynamicType::_ref_type dynamic_type = create_type(config.use_xml); if (!dynamic_type) { throw std::runtime_error("Error creating dynamic type"); @@ -71,15 +79,6 @@ PublisherApp::PublisherApp( hello_->set_uint32_value(hello_->get_member_id_by_name("index"), 0); hello_->set_string_value(hello_->get_member_id_by_name("message"), "Hello xtypes world"); - // Create the participant - auto factory = DomainParticipantFactory::get_instance(); - participant_ = factory->create_participant_with_default_profile(nullptr, StatusMask::none()); - - if (participant_ == nullptr) - { - throw std::runtime_error("Participant initialization failed"); - } - // Register the type TypeSupport type(new DynamicPubSubType(dynamic_type)); @@ -227,43 +226,59 @@ void PublisherApp::stop() cv_.notify_one(); } -DynamicType::_ref_type PublisherApp::create_type() +DynamicType::_ref_type PublisherApp::create_type( + bool use_xml_type) { - // Define a struct type with various primitive members - TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; - type_descriptor->kind(TK_STRUCTURE); - type_descriptor->name("HelloWorld"); - DynamicTypeBuilder::_ref_type struct_builder {DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor)}; - - if (!struct_builder) + DynamicTypeBuilder::_ref_type struct_builder; + if (use_xml_type) { - throw std::runtime_error("Error creating type builder"); + // Retrieve the type builder from xml + if (RETCODE_OK != + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("HelloWorld", + struct_builder)) + { + std::cout << + "Error getting dynamic type \"HelloWorld\"." << std::endl; + } } + else + { + TypeDescriptor::_ref_type type_descriptor {traits::make_shared()}; + type_descriptor->kind(TK_STRUCTURE); + type_descriptor->name("HelloWorld"); + struct_builder = DynamicTypeBuilderFactory::get_instance()->create_type(type_descriptor); - // Add index member - MemberDescriptor::_ref_type index_member_descriptor {traits::make_shared()}; - index_member_descriptor->name("index"); - index_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_UINT32)); + if (!struct_builder) + { + throw std::runtime_error("Error creating type builder"); + } - if (RETCODE_OK != struct_builder->add_member(index_member_descriptor)) - { - throw std::runtime_error("Error adding index member"); - } + // Add index member + MemberDescriptor::_ref_type index_member_descriptor {traits::make_shared()}; + index_member_descriptor->name("index"); + index_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->get_primitive_type(TK_UINT32)); - // Add message member - MemberDescriptor::_ref_type message_member_descriptor {traits::make_shared()}; - message_member_descriptor->name("message"); - message_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_string_type(static_cast( - LENGTH_UNLIMITED))->build()); + if (RETCODE_OK != struct_builder->add_member(index_member_descriptor)) + { + throw std::runtime_error("Error adding index member"); + } - if (!message_member_descriptor) - { - throw std::runtime_error("Error creating string type"); - } + // Add message member + MemberDescriptor::_ref_type message_member_descriptor {traits::make_shared()}; + message_member_descriptor->name("message"); + message_member_descriptor->type(DynamicTypeBuilderFactory::get_instance()->create_string_type(static_cast< + uint32_t>( + LENGTH_UNLIMITED))->build()); - if (RETCODE_OK != struct_builder->add_member(message_member_descriptor)) - { - throw std::runtime_error("Error adding message member"); + if (!message_member_descriptor) + { + throw std::runtime_error("Error creating string type"); + } + + if (RETCODE_OK != struct_builder->add_member(message_member_descriptor)) + { + throw std::runtime_error("Error adding message member"); + } } // Build the type diff --git a/examples/cpp/xtypes/PublisherApp.hpp b/examples/cpp/xtypes/PublisherApp.hpp index 01d5485f707..37bf8ca4563 100644 --- a/examples/cpp/xtypes/PublisherApp.hpp +++ b/examples/cpp/xtypes/PublisherApp.hpp @@ -68,7 +68,8 @@ class PublisherApp : public Application, public DataWriterListener bool publish(); //! Create the dynamic type used by the PublisherApp - static DynamicType::_ref_type create_type(); + static DynamicType::_ref_type create_type( + bool use_xml_type); //! Auxilary function to get a uint32_t value from a DynamicData object static uint32_t get_uint32_value( diff --git a/examples/cpp/xtypes/README.md b/examples/cpp/xtypes/README.md index abb9e062146..4ae6c8dd764 100644 --- a/examples/cpp/xtypes/README.md +++ b/examples/cpp/xtypes/README.md @@ -21,7 +21,9 @@ For further information regarding the configuration environment, please refer to The particularity of this example resides in the use of X-Types, which allows the definition of types at runtime. In this case: -1. The publisher application defines a type at runtime using the Fast DDS Dynamic Types API. +1. The publisher application creates a type at runtime using the Fast DDS Dynamic Types API. +The types can be configured through C++ API or [XML file](https://fast-dds.docs.eprosima.com/en/latest/fastdds/xml_configuration/dynamic_types.html). +The flag `--xml-types` allows to use the types defined in the XML file. The profile must be uploaded setting the environment variable ``FASTDDS_DEFAULT_PROFILES_FILE`` to the XML file path, see [XML profile playground](#xml-profile-playground). 2. The subscriber application discovers the type defined by the publisher and uses it to create a data reader, introspect the type, and print the received data. It is important to note that this example is fully type compatible with the [Hello world](../hello_world/README.md) example, meaning that the publisher and subscriber applications can be run interchangeably with the *hello world* example applications. diff --git a/examples/cpp/xtypes/SubscriberApp.cpp b/examples/cpp/xtypes/SubscriberApp.cpp index 7c1b1b0f050..a27894b9b2b 100644 --- a/examples/cpp/xtypes/SubscriberApp.cpp +++ b/examples/cpp/xtypes/SubscriberApp.cpp @@ -55,6 +55,7 @@ SubscriberApp::SubscriberApp( , reader_(nullptr) , samples_(config.samples) , received_samples_(0) + , type_discovered_(false) , stop_(false) { // Create the participant diff --git a/examples/cpp/xtypes/xtypes_profile.xml b/examples/cpp/xtypes/xtypes_profile.xml index 62ae0364a04..66542e1a40a 100644 --- a/examples/cpp/xtypes/xtypes_profile.xml +++ b/examples/cpp/xtypes/xtypes_profile.xml @@ -1,52 +1,63 @@ - - - 0 - - xtypes_participant - - - - - - TRANSIENT_LOCAL - - - RELIABLE - - - - - KEEP_LAST - 100 - - - 100 - 1 - 100 - - - + + + + 0 + + xtypes_participant + + + + + + TRANSIENT_LOCAL + + + RELIABLE + + + + + KEEP_LAST + 100 + + + 100 + 1 + 100 + + + - - - - TRANSIENT_LOCAL - - - RELIABLE - - - - - KEEP_LAST - 100 - - - 100 - 1 - 100 - - - - + + + + TRANSIENT_LOCAL + + + RELIABLE + + + + + KEEP_LAST + 100 + + + 100 + 1 + 100 + + + + + + + + + + + + + + diff --git a/include/fastdds/dds/domain/DomainParticipantFactory.hpp b/include/fastdds/dds/domain/DomainParticipantFactory.hpp index 721d622dcf1..29bca773014 100644 --- a/include/fastdds/dds/domain/DomainParticipantFactory.hpp +++ b/include/fastdds/dds/domain/DomainParticipantFactory.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -344,7 +345,7 @@ class DomainParticipantFactory */ FASTDDS_EXPORTED_API ReturnCode_t get_dynamic_type_builder_from_xml_by_name( const std::string& type_name, - DynamicType::_ref_type& type); + DynamicTypeBuilder::_ref_type& type); /** * @brief Return the TypeObjectRegistry member to access the public API. diff --git a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp index b1fa449bc76..4d59024d6a7 100644 --- a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp @@ -542,13 +542,13 @@ ReturnCode_t DomainParticipantFactory::set_library_settings( ReturnCode_t DomainParticipantFactory::get_dynamic_type_builder_from_xml_by_name( const std::string& type_name, - DynamicType::_ref_type& type) + DynamicTypeBuilder::_ref_type& type_builder) { if (type_name.empty()) { return RETCODE_BAD_PARAMETER; } - if (XMLP_ret::XML_OK != XMLProfileManager::getDynamicTypeByName(type, type_name)) + if (XMLP_ret::XML_OK != XMLProfileManager::getDynamicTypeBuilderByName(type_builder, type_name)) { return RETCODE_NO_DATA; } diff --git a/src/cpp/xmlparser/XMLDynamicParser.cpp b/src/cpp/xmlparser/XMLDynamicParser.cpp index c995c0757a7..00860220743 100644 --- a/src/cpp/xmlparser/XMLDynamicParser.cpp +++ b/src/cpp/xmlparser/XMLDynamicParser.cpp @@ -379,9 +379,17 @@ static DynamicType::_ref_type getDiscriminatorTypeBuilder( return factory->create_wstring_type(0 == bound ? static_cast(LENGTH_UNLIMITED) : bound)->build(); } - DynamicType::_ref_type ret; - XMLProfileManager::getDynamicTypeByName(ret, disc); - return ret; + DynamicTypeBuilder::_ref_type ret; + XMLProfileManager::getDynamicTypeBuilderByName(ret, disc); + if (nullptr != ret) + { + return ret->build(); + } + else + { + return nullptr; + } + } XMLP_ret XMLParser::parseXMLAliasDynamicType( @@ -453,8 +461,8 @@ XMLP_ret XMLParser::parseXMLAliasDynamicType( const char* name = p_root->Attribute(NAME); if (name != nullptr && name[0] != '\0') { - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, name); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, name); if (!aux_type) { TypeDescriptor::_ref_type alias_descriptor {traits::make_shared()}; @@ -464,7 +472,7 @@ XMLP_ret XMLParser::parseXMLAliasDynamicType( DynamicTypeBuilder::_ref_type builder {DynamicTypeBuilderFactory::get_instance()->create_type( alias_descriptor)}; if (nullptr == builder - || false == XMLProfileManager::insertDynamicTypeByName(name, builder->build())) + || false == XMLProfileManager::insertDynamicTypeBuilderByName(name, builder)) { ret = XMLP_ret::XML_ERROR; } @@ -526,8 +534,8 @@ XMLP_ret XMLParser::parseXMLBitsetDynamicType( return XMLP_ret::XML_ERROR; } - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, name); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, name); if (aux_type) { EPROSIMA_LOG_ERROR(XMLPARSER, "Error parsing 'bitsetDcl' type: Type '" << name << "' already defined."); @@ -569,8 +577,9 @@ XMLP_ret XMLParser::parseXMLBitsetDynamicType( const char* baseType = p_root->Attribute(BASE_TYPE); if (baseType != nullptr) { - DynamicType::_ref_type parent_type; - XMLProfileManager::getDynamicTypeByName(parent_type, baseType); + DynamicTypeBuilder::_ref_type parent_type_builder; + XMLProfileManager::getDynamicTypeBuilderByName(parent_type_builder, baseType); + DynamicType::_ref_type parent_type = parent_type_builder->build(); if (parent_type && (TK_BITSET == parent_type->get_kind() || TK_BITSET == traits::narrow(parent_type)->resolve_alias_enclosed_type()->get_kind())) @@ -608,7 +617,7 @@ XMLP_ret XMLParser::parseXMLBitsetDynamicType( if (XMLP_ret::XML_OK == ret) { - if (false == XMLProfileManager::insertDynamicTypeByName(name, type_builder->build())) + if (false == XMLProfileManager::insertDynamicTypeBuilderByName(name, type_builder)) { ret = XMLP_ret::XML_ERROR; } @@ -801,8 +810,8 @@ XMLP_ret XMLParser::parseXMLBitmaskDynamicType( { return XMLP_ret::XML_ERROR; } - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, name); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, name); if (aux_type) { EPROSIMA_LOG_ERROR(XMLPARSER, "Error parsing 'bitmaskDcl' type: Type '" << name << "' already defined."); @@ -839,7 +848,7 @@ XMLP_ret XMLParser::parseXMLBitmaskDynamicType( } } - if (false == XMLProfileManager::insertDynamicTypeByName(name, type_builder->build())) + if (false == XMLProfileManager::insertDynamicTypeBuilderByName(name, type_builder)) { ret = XMLP_ret::XML_ERROR; } @@ -880,8 +889,8 @@ XMLP_ret XMLParser::parseXMLEnumDynamicType( return XMLP_ret::XML_ERROR; } - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, enumName); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, enumName); if (aux_type) { EPROSIMA_LOG_ERROR(XMLPARSER, "Error parsing 'enum' type: Type '" << enumName << "' already defined."); @@ -920,7 +929,7 @@ XMLP_ret XMLParser::parseXMLEnumDynamicType( type_builder->add_member(md); } - if (false == XMLProfileManager::insertDynamicTypeByName(enumName, type_builder->build())) + if (false == XMLProfileManager::insertDynamicTypeBuilderByName(enumName, type_builder)) { ret = XMLP_ret::XML_ERROR; } @@ -958,8 +967,8 @@ XMLP_ret XMLParser::parseXMLStructDynamicType( return XMLP_ret::XML_ERROR; } - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, name); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, name); if (aux_type) { EPROSIMA_LOG_ERROR(XMLPARSER, "Error parsing 'structDcl' type: Type '" << name << "' already defined."); @@ -973,9 +982,9 @@ XMLP_ret XMLParser::parseXMLStructDynamicType( const char* baseType = p_root->Attribute(BASE_TYPE); if (baseType != nullptr) { - DynamicType::_ref_type parent_type; - XMLProfileManager::getDynamicTypeByName(parent_type, baseType); - + DynamicTypeBuilder::_ref_type parent_type_builder; + XMLProfileManager::getDynamicTypeBuilderByName(parent_type_builder, baseType); + DynamicType::_ref_type parent_type = parent_type_builder->build(); if (parent_type && (TK_STRUCTURE == parent_type->get_kind() || TK_STRUCTURE == traits::narrow(parent_type)->resolve_alias_enclosed_type()->get_kind())) @@ -1013,7 +1022,7 @@ XMLP_ret XMLParser::parseXMLStructDynamicType( } } - if (false == XMLProfileManager::insertDynamicTypeByName(name, type_builder->build())) + if (false == XMLProfileManager::insertDynamicTypeBuilderByName(name, type_builder)) { ret = XMLP_ret::XML_ERROR; } @@ -1059,8 +1068,8 @@ XMLP_ret XMLParser::parseXMLUnionDynamicType( return XMLP_ret::XML_ERROR; } - DynamicType::_ref_type aux_type; - XMLProfileManager::getDynamicTypeByName(aux_type, name); + DynamicTypeBuilder::_ref_type aux_type; + XMLProfileManager::getDynamicTypeBuilderByName(aux_type, name); if (aux_type) { EPROSIMA_LOG_ERROR(XMLPARSER, "Error parsing 'unionDcl' type: Type '" << name << "' already defined."); @@ -1134,7 +1143,7 @@ XMLP_ret XMLParser::parseXMLUnionDynamicType( } } - if (false == XMLProfileManager::insertDynamicTypeByName(name, type_builder->build())) + if (false == XMLProfileManager::insertDynamicTypeBuilderByName(name, type_builder)) { ret = XMLP_ret::XML_ERROR; } @@ -1682,8 +1691,18 @@ DynamicType::_ref_type XMLParser:: parseXMLMemberDynamicType( } else // Complex type? { + DynamicTypeBuilder::_ref_type type_builder; + XMLProfileManager::getDynamicTypeBuilderByName(type_builder, memberType); DynamicType::_ref_type type; - XMLProfileManager::getDynamicTypeByName(type, memberType); + if (nullptr != type_builder) + { + type = type_builder->build(); + } + else + { + type = nullptr; + } + if (!isArray) { member = type; diff --git a/src/cpp/xmlparser/XMLParser.h b/src/cpp/xmlparser/XMLParser.h index 94cb4295eae..95643010003 100644 --- a/src/cpp/xmlparser/XMLParser.h +++ b/src/cpp/xmlparser/XMLParser.h @@ -58,7 +58,7 @@ typedef node_att_map_t::const_iterator node_att_map_cit_t; typedef std::shared_ptr sp_transport_t; typedef std::map sp_transport_map_t; -typedef std::map p_dynamictype_map_t; +typedef std::map p_dynamictype_map_t; typedef std::unique_ptr up_participantfactory_t; typedef DataNode node_participantfactory_t; diff --git a/src/cpp/xmlparser/XMLProfileManager.cpp b/src/cpp/xmlparser/XMLProfileManager.cpp index 45d99f3c91f..145eeeb0c94 100644 --- a/src/cpp/xmlparser/XMLProfileManager.cpp +++ b/src/cpp/xmlparser/XMLProfileManager.cpp @@ -705,9 +705,9 @@ sp_transport_t XMLProfileManager::getTransportById( return nullptr; } -bool XMLProfileManager::insertDynamicTypeByName( +bool XMLProfileManager::insertDynamicTypeBuilderByName( const std::string& type_name, - const eprosima::fastdds::dds::DynamicType::_ref_type& type) + const eprosima::fastdds::dds::DynamicTypeBuilder::_ref_type& type) { if (dynamic_types_.find(type_name) == dynamic_types_.end()) { @@ -718,8 +718,8 @@ bool XMLProfileManager::insertDynamicTypeByName( return false; } -XMLP_ret XMLProfileManager::getDynamicTypeByName( - eprosima::fastdds::dds::DynamicType::_ref_type& dynamic_type, +XMLP_ret XMLProfileManager::getDynamicTypeBuilderByName( + eprosima::fastdds::dds::DynamicTypeBuilder::_ref_type& dynamic_type, const std::string& type_name) { if (dynamic_types_.find(type_name) != dynamic_types_.end()) diff --git a/src/cpp/xmlparser/XMLProfileManager.h b/src/cpp/xmlparser/XMLProfileManager.h index 9bf7a94368c..6090538e4c0 100644 --- a/src/cpp/xmlparser/XMLProfileManager.h +++ b/src/cpp/xmlparser/XMLProfileManager.h @@ -226,12 +226,12 @@ class XMLProfileManager TopicAttributes& topic_attributes); //!Add a new dynamic type instance along with its name. - static bool insertDynamicTypeByName( + static bool insertDynamicTypeBuilderByName( const std::string& type_name, - const fastdds::dds::DynamicType::_ref_type& type); + const fastdds::dds::DynamicTypeBuilder::_ref_type& type); - static XMLP_ret getDynamicTypeByName( - fastdds::dds::DynamicType::_ref_type& dynamic_type, + static XMLP_ret getDynamicTypeBuilderByName( + fastdds::dds::DynamicTypeBuilder::_ref_type& dynamic_type, const std::string& type_name); /** diff --git a/test/examples/xtypes.compose.yml b/test/examples/xtypes.compose.yml index d321cf98c2f..3b8da7dea71 100644 --- a/test/examples/xtypes.compose.yml +++ b/test/examples/xtypes.compose.yml @@ -25,7 +25,7 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_profile.xml - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 20" + command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30" xtypes-subscriber-publisher: image: @DOCKER_IMAGE_NAME@ @@ -38,7 +38,7 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_profile.xml - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 20 & $${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10" + command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ subscriber --samples 30 & $${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10" depends_on: - xtypes-subscriber - helloworld-subscriber @@ -54,7 +54,7 @@ services: LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@ FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml - command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 20" + command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 30" helloworld-publisher: image: @DOCKER_IMAGE_NAME@ @@ -71,3 +71,19 @@ services: depends_on: - xtypes-subscriber - helloworld-subscriber + + xtypes-publisher: + image: @DOCKER_IMAGE_NAME@ + volumes: + - @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@ + - @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@ + @TINYXML2_LIB_DIR_COMPOSE_VOLUME@ + environment: + # TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows + LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@ + EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/xtypes@FILE_EXTENSION@ + FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/xtypes/xtypes_profile.xml + command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/xtypes@FILE_EXTENSION@ publisher --samples 10 --xml-type" + depends_on: + - xtypes-subscriber + - helloworld-subscriber diff --git a/test/feature/dynamic_types/DynamicTypesTests.cpp b/test/feature/dynamic_types/DynamicTypesTests.cpp index 7af21d07ae0..f758dd0cec4 100644 --- a/test/feature/dynamic_types/DynamicTypesTests.cpp +++ b/test/feature/dynamic_types/DynamicTypesTests.cpp @@ -12939,10 +12939,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_enum) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("EnumStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -12975,7 +12975,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_enum) member_descriptor->name("my_enum"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } @@ -12984,10 +12984,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("AliasStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13026,7 +13026,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias) member_descriptor->name("my_alias"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_with_alias) @@ -13034,10 +13034,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_with_alias) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("AliasAliasStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13082,7 +13082,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_with_alias) member_descriptor->name("my_alias_alias"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_boolean) @@ -13090,10 +13090,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_boolean) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("BoolStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13107,7 +13107,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_boolean) member_descriptor->name("my_bool"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_octet) @@ -13115,10 +13115,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_octet) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("OctetStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13132,7 +13132,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_octet) member_descriptor->name("my_octet"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short) @@ -13140,10 +13140,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ShortStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13157,7 +13157,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short) member_descriptor->name("my_int16"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_long) @@ -13165,10 +13165,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_long) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("LongStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13182,7 +13182,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_long) member_descriptor->name("my_int32"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longlong) @@ -13190,10 +13190,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longlong) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("LongLongStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13207,7 +13207,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longlong) member_descriptor->name("my_int64"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ushort) @@ -13215,10 +13215,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ushort) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("UShortStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13232,7 +13232,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ushort) member_descriptor->name("my_uint16"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulong) @@ -13240,10 +13240,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulong) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ULongStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13257,7 +13257,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulong) member_descriptor->name("my_uint32"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulonglong) @@ -13265,10 +13265,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulonglong) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ULongLongStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13282,7 +13282,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_ulonglong) member_descriptor->name("my_uint64"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_float) @@ -13290,10 +13290,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_float) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("FloatStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13307,7 +13307,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_float) member_descriptor->name("my_float32"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_double) @@ -13315,10 +13315,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_double) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("DoubleStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13332,7 +13332,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_double) member_descriptor->name("my_float64"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longdouble) @@ -13340,10 +13340,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longdouble) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("LongDoubleStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13357,7 +13357,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_longdouble) member_descriptor->name("my_float128"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_char) @@ -13365,10 +13365,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_char) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("CharStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13382,7 +13382,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_char) member_descriptor->name("my_char"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wchar) @@ -13390,10 +13390,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wchar) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("WCharStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13407,7 +13407,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wchar) member_descriptor->name("my_wchar"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_string) @@ -13415,10 +13415,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_string) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("StringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13432,7 +13432,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_string) member_descriptor->name("my_string"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wstring) @@ -13440,10 +13440,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wstring) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("WStringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13457,7 +13457,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_wstring) member_descriptor->name("my_wstring"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } @@ -13466,10 +13466,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_large_string) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("LargeStringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13483,7 +13483,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_large_string) member_descriptor->name("my_large_string"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_large_wstring) @@ -13491,10 +13491,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_large_wstring) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("LargeWStringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13508,7 +13508,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_large_wstring) member_descriptor->name("my_large_wstring"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_string) @@ -13516,10 +13516,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_string) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ShortStringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13533,7 +13533,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_string) member_descriptor->name("my_short_string"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_wstring) @@ -13541,10 +13541,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_wstring) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ShortWStringStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13558,7 +13558,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_short_wstring) member_descriptor->name("my_short_wstring"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_string) @@ -13566,10 +13566,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_string) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("StructAliasString", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13590,7 +13590,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_string) member_descriptor->name("my_alias_string"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_wstring) @@ -13598,10 +13598,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_wstring) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("StructAliasWString", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13622,7 +13622,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_alias_of_wstring) member_descriptor->name("my_alias_wstring"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array) @@ -13630,10 +13630,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ArrayStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13651,7 +13651,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array) member_descriptor->name("my_array"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_of_arrays) @@ -13659,10 +13659,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_of_arrays) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ArrayArrayStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13687,7 +13687,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_of_arrays) member_descriptor->name("my_array_array"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_struct_with_array_of_arrays) @@ -13695,10 +13695,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_struct_with_array_of ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("ArrayArrayArrayStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13736,7 +13736,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_array_struct_with_array_of member_descriptor->name("my_array_array_array"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_sequence) @@ -13744,10 +13744,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_sequence) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("SequenceStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13762,7 +13762,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_sequence) member_descriptor->name("my_sequence"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } @@ -13771,10 +13771,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_sequence_of_sequences) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("SequenceSequenceStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13798,7 +13798,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_sequence_of_sequences) member_descriptor->name("my_sequence_sequence"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map) @@ -13806,9 +13806,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MapStruct", xml_type)); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MapStruct", + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13824,7 +13825,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map) member_descriptor->name("my_map"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map_of_maps) @@ -13832,10 +13833,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map_of_maps) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MapMapStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13859,7 +13860,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_map_of_maps) member_descriptor->name("my_map_map"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_two_members) @@ -13867,10 +13868,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_two_members) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("StructStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13887,7 +13888,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_two_members) member_descriptor->name("b"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_struct) @@ -13895,10 +13896,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_struct) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("StructStructStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13928,7 +13929,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_struct) member_descriptor->name("child_int64"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union) @@ -13936,10 +13937,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("SimpleUnionStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -13969,7 +13970,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union) member_descriptor->name("my_union"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union_with_union) @@ -13977,10 +13978,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union_with_union) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("UnionUnionStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -14027,7 +14028,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_struct_with_union_with_union) member_descriptor->name("my_union"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_WCharUnionStruct_test) @@ -14035,10 +14036,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_WCharUnionStruct_test) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("WCharUnionStruct", - xml_type)); + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -14068,7 +14069,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_WCharUnionStruct_test) member_descriptor->name("my_union"); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_Bitset_test) @@ -14076,9 +14077,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitset_test) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MyBitSet", xml_type)); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MyBitSet", + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -14135,7 +14137,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitset_test) member_descriptor->type(factory->get_primitive_type(TK_INT16)); ASSERT_EQ(RETCODE_OK, builder->add_member(member_descriptor)); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, DynamicType_XML_Bitmask_test) @@ -14143,9 +14145,10 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitmask_test) ASSERT_EQ(RETCODE_OK, DomainParticipantFactory::get_instance()->load_XML_profiles_file(DynamicTypesTests::config_file())); - DynamicType::_ref_type xml_type; + DynamicTypeBuilder::_ref_type xml_type_builder; ASSERT_EQ(RETCODE_OK, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MyBitMask", xml_type)); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name("MyBitMask", + xml_type_builder)); DynamicTypeBuilderFactory::_ref_type factory {DynamicTypeBuilderFactory::get_instance()}; @@ -14174,7 +14177,7 @@ TEST_F(DynamicTypesTests, DynamicType_XML_Bitmask_test) member_descriptor->id(5); builder->add_member(member_descriptor); - ASSERT_TRUE(xml_type->equals(builder->build())); + ASSERT_TRUE(xml_type_builder->build()->equals(builder->build())); } TEST_F(DynamicTypesTests, TypeDescriptorFullyQualifiedName) diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index 6e3461fdb4b..45b36bf7377 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -427,15 +427,17 @@ TEST(ParticipantTests, DomainParticipantFactoryLibrarySettings) TEST(ParticipantTests, DomainParticipantFactoryGetDynamicTypeBuilder) { - traits::ref_type type; + traits::ref_type type_builder; std::string type_name("MyAloneEnumType"); // Trying to get a Dynamic Type with empty name returns RETCODE_BAD_PARAMETER EXPECT_EQ(RETCODE_BAD_PARAMETER, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(std::string(), type)); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(std::string(), + type_builder)); // Trying to get an unknown Dynamic Type return RETCODE_NO_DATA EXPECT_EQ(RETCODE_NO_DATA, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(type_name, type)); - EXPECT_EQ(nullptr, type); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(type_name, + type_builder)); + EXPECT_EQ(nullptr, type_builder); // Load XML file std::string xml = "\ @@ -451,8 +453,9 @@ TEST(ParticipantTests, DomainParticipantFactoryGetDynamicTypeBuilder) DomainParticipantFactory::get_instance()->load_XML_profiles_string(xml.c_str(), xml.length()); // Getting a known dynamic type returns RETCODE_OK EXPECT_EQ(RETCODE_OK, - DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(type_name, type)); - EXPECT_NE(nullptr, type); + DomainParticipantFactory::get_instance()->get_dynamic_type_builder_from_xml_by_name(type_name, + type_builder)); + EXPECT_NE(nullptr, type_builder); } TEST(ParticipantTests, CreateDomainParticipant) diff --git a/test/unittest/xmlparser/XMLProfileParserTests.cpp b/test/unittest/xmlparser/XMLProfileParserTests.cpp index ccff32761f3..9d656c59ba8 100644 --- a/test/unittest/xmlparser/XMLProfileParserTests.cpp +++ b/test/unittest/xmlparser/XMLProfileParserTests.cpp @@ -1784,13 +1784,14 @@ TEST_F(XMLProfileParserBasicTests, insertTransportByIdNegativeClauses) } /* - * Test return code of the getDynamicTypeByName method when trying to retrieve a type which has not been parsed + * Test return code of the getDynamicTypeBuilderByName method when trying to retrieve a type which has not been parsed */ -TEST_F(XMLProfileParserBasicTests, getDynamicTypeByNameNegativeClausesNegativeClauses) +TEST_F(XMLProfileParserBasicTests, getDynamicTypeBuilderByNameNegativeClausesNegativeClauses) { - eprosima::fastdds::dds::traits::ref_type type; - EXPECT_EQ(xmlparser::XMLP_ret::XML_ERROR, xmlparser::XMLProfileManager::getDynamicTypeByName(type, "wrong_type")); - ASSERT_FALSE(type); + eprosima::fastdds::dds::traits::ref_type type_builder; + EXPECT_EQ(xmlparser::XMLP_ret::XML_ERROR, + xmlparser::XMLProfileManager::getDynamicTypeBuilderByName(type_builder, "wrong_type")); + ASSERT_FALSE(type_builder); } /* diff --git a/versions.md b/versions.md index 9e749ca7a2e..53415be40a0 100644 --- a/versions.md +++ b/versions.md @@ -76,6 +76,7 @@ Forthcoming * Servers only redirect discovery information of their direct clients. * Remote Discovery servers connection list can now be updated and modified at runtime without restrictions. * Fast DDS CLI has been updated to allow the creation of servers without GUID. +* Refactor in XML Parser to return DynamicTypeBuilder instead of DynamicType Version 2.14.0 --------------