From 20c51f099bf23c6c73999afcf3ed8b26ab127f6e Mon Sep 17 00:00:00 2001 From: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:29:18 +0200 Subject: [PATCH 1/8] Empty XTSAN tests list (#76) Signed-off-by: Juan Lopez Fernandez --- fastddsspy_tool/test/labels/XTSAN.list | 64 -------------------------- 1 file changed, 64 deletions(-) diff --git a/fastddsspy_tool/test/labels/XTSAN.list b/fastddsspy_tool/test/labels/XTSAN.list index 2f1eb11f..e69de29b 100644 --- a/fastddsspy_tool/test/labels/XTSAN.list +++ b/fastddsspy_tool/test/labels/XTSAN.list @@ -1,64 +0,0 @@ -tool.application.fastddsspy.test.test_cases.one_shot_help_dds -tool.application.fastddsspy.test.test_cases.one_shot_datareader_dds -tool.application.fastddsspy.test.test_cases.one_shot_datareader_guid_dds -tool.application.fastddsspy.test.test_cases.one_shot_datareader_verbose_dds -tool.application.fastddsspy.test.test_cases.one_shot_datawriter_dds -tool.application.fastddsspy.test.test_cases.one_shot_datawriter_verbose_dds_qos -tool.application.fastddsspy.test.test_cases.one_shot_datawriter_guid_dds_fail -tool.application.fastddsspy.test.test_cases.one_shot_datawriter_verbose_dds -tool.application.fastddsspy.test.test_cases.one_shot_participants_dds -tool.application.fastddsspy.test.test_cases.one_shot_participants_guid_dds -tool.application.fastddsspy.test.test_cases.one_shot_participants_verbose_dds -tool.application.fastddsspy.test.test_cases.one_shot_quit_dds -tool.application.fastddsspy.test.test_cases.one_shot_topics_dds -tool.application.fastddsspy.test.test_cases.one_shot_topics_dds_no_config -tool.application.fastddsspy.test.test_cases.one_shot_topics_name_dds -tool.application.fastddsspy.test.test_cases.one_shot_topics_verbose_dds -tool.application.fastddsspy.test.test_cases.tool_datareader_dds -tool.application.fastddsspy.test.test_cases.tool_datawriter_dds -tool.application.fastddsspy.test.test_cases.tool_help_dds -tool.application.fastddsspy.test.test_cases.tool_participants_dds -tool.application.fastddsspy.test.test_cases.tool_show_topic_dds -tool.application.fastddsspy.test.test_cases.tool_topics_dds -tool.application.fastddsspy.test.test_cases.tool_topics_dds_no_config -tool.application.fastddsspy.test.test_cases.one_shot__config -tool.application.fastddsspy.test.test_cases.one_shot__config_fail_file -tool.application.fastddsspy.test.test_cases.one_shot__config_fail_type -tool.application.fastddsspy.test.test_cases.one_shot__config_fail_empty_arg -tool.application.fastddsspy.test.test_cases.one_shot__log_filter -tool.application.fastddsspy.test.test_cases.one_shot__log_filter_fail -tool.application.fastddsspy.test.test_cases.one_shot__log_verb_fail -tool.application.fastddsspy.test.test_cases.one_shot__log_verb_info -tool.application.fastddsspy.test.test_cases.one_shot__log_verb_warning -tool.application.fastddsspy.test.test_cases.one_shot__log_verb_error -tool.application.fastddsspy.test.test_cases.one_shot__reload_time -tool.application.fastddsspy.test.test_cases.one_shot__reload_time_fail -tool.application.fastddsspy.test.test_cases.one_shot__debug -tool.application.fastddsspy.test.test_cases.one_shot_help -tool.application.fastddsspy.test.test_cases.one_shot__help -tool.application.fastddsspy.test.test_cases.one_shot_null -tool.application.fastddsspy.test.test_cases.one_shot__null -tool.application.fastddsspy.test.test_cases.one_shot__version -tool.application.fastddsspy.test.test_cases.one_shot_datareader -tool.application.fastddsspy.test.test_cases.one_shot_datareader_verbose -tool.application.fastddsspy.test.test_cases.one_shot_datawriter -tool.application.fastddsspy.test.test_cases.one_shot_datawriter_verbose -tool.application.fastddsspy.test.test_cases.one_shot_participants -tool.application.fastddsspy.test.test_cases.one_shot_participants_verbose -tool.application.fastddsspy.test.test_cases.one_shot_quit -tool.application.fastddsspy.test.test_cases.one_shot_show_all -tool.application.fastddsspy.test.test_cases.one_shot_show_fail -tool.application.fastddsspy.test.test_cases.one_shot_show_topic -tool.application.fastddsspy.test.test_cases.one_shot_show_topic_verbose -tool.application.fastddsspy.test.test_cases.one_shot_topics -tool.application.fastddsspy.test.test_cases.one_shot_topics_name -tool.application.fastddsspy.test.test_cases.one_shot_topics_verbose -tool.application.fastddsspy.test.test_cases.tool_datareader -tool.application.fastddsspy.test.test_cases.tool_datawriter -tool.application.fastddsspy.test.test_cases.tool_help -tool.application.fastddsspy.test.test_cases.tool_null -tool.application.fastddsspy.test.test_cases.tool_participants -tool.application.fastddsspy.test.test_cases.tool_show_all -tool.application.fastddsspy.test.test_cases.tool_show_topic -tool.application.fastddsspy.test.test_cases.tool_topics -tool.application.fastddsspy.test.test_cases.tool_version From 7838506d28e43588cd4f844cd5089245a4c88ec9 Mon Sep 17 00:00:00 2001 From: Irene Bandera Moreno Date: Fri, 13 Sep 2024 07:30:35 +0200 Subject: [PATCH 2/8] Update artifact name and compile on Ubuntu 24 (#91) * Fix ddspipe artifact name Signed-off-by: Irene Bandera * Add Ubuntu 24.04 and remove Ubuntu 20.04 Signed-off-by: Irene Bandera * Update forthcoming_version Signed-off-by: Irene Bandera * Remove yaml-cpp target library in fastddsspy tests package Signed-off-by: Irene Bandera --------- Signed-off-by: Irene Bandera --- .github/actions/project_dependencies/action.yml | 2 +- .github/workflows/reusable-workflow.yml | 4 ++-- docs/rst/notes/forthcoming_version.rst | 5 +++++ fastddsspy_tool/test/application/CMakeLists.txt | 6 ++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/actions/project_dependencies/action.yml b/.github/actions/project_dependencies/action.yml index 50a47d54..dd5f1901 100644 --- a/.github/actions/project_dependencies/action.yml +++ b/.github/actions/project_dependencies/action.yml @@ -55,7 +55,7 @@ runs: - name: Download dependencies artifact uses: eProsima/eProsima-CI/multiplatform/download_dependency@v0 with: - artifact_name: built_ddspipe_${{ inputs.custom_version_build }}_${{ inputs.os }}_${{ inputs.cmake_build_type }}${{ inputs.dependencies_artifact_postfix }} + artifact_name: build_ddspipe_${{ inputs.custom_version_build }}_${{ inputs.os }}_${{ inputs.cmake_build_type }}${{ inputs.dependencies_artifact_postfix }} workflow_source: build_ddspipe.yml workflow_source_repository: eProsima/eProsima-CI target_workspace: ${{ inputs.target_workspace }} diff --git a/.github/workflows/reusable-workflow.yml b/.github/workflows/reusable-workflow.yml index 173138d9..ef99c429 100644 --- a/.github/workflows/reusable-workflow.yml +++ b/.github/workflows/reusable-workflow.yml @@ -1,7 +1,7 @@ # Reusable workflow to run the following jobs: # # - multiplatform-tests -# - [ ubuntu-22.04 | ubuntu-20.04 | windows-2019 | windows-2022 ] +# - [ ubuntu-22.04 | ubuntu-24.04 | windows-2019 | windows-2022 ] # - [ Debug | Release ] # - execute tests in different versions of ubuntu with different build types # @@ -72,8 +72,8 @@ jobs: - Release - Debug os: - - ubuntu-20.04 - ubuntu-22.04 + - ubuntu-24.04 - windows-2019 - windows-2022 diff --git a/docs/rst/notes/forthcoming_version.rst b/docs/rst/notes/forthcoming_version.rst index fce95803..36dced7e 100644 --- a/docs/rst/notes/forthcoming_version.rst +++ b/docs/rst/notes/forthcoming_version.rst @@ -7,6 +7,11 @@ Forthcoming Version ################### +This release includes the following **CI improvements**: + +* Upgrade to Ubuntu Noble (24.04). +* Remove Ubuntu Focal (20.04) from the CI. + This release includes the following **Configuration Features**: * New :ref:`domain argument ` to configure the ``domain`` through the command-line. diff --git a/fastddsspy_tool/test/application/CMakeLists.txt b/fastddsspy_tool/test/application/CMakeLists.txt index b08f0adb..74105e41 100644 --- a/fastddsspy_tool/test/application/CMakeLists.txt +++ b/fastddsspy_tool/test/application/CMakeLists.txt @@ -98,6 +98,12 @@ if(WIN32) string(REPLACE ";" "\\;" TEST_ENVIRONMENT "${TEST_ENVIRONMENT}") +else() + + # yaml-cpp changed its behavior in 0.8.0 (distributed in Ubuntu-24), so that the target changed from yaml-cpp to yaml-cpp::yaml-cpp . + # Instead of using each of these names depending on the OS, we simply remove it since it's actually not required. + string(REPLACE "$;" "" TEST_ENVIRONMENT "${TEST_ENVIRONMENT}") + endif(WIN32) # compile AdvanceConfigurationExample needed for tests From f38df04c3a8950989520be71479cd90660bd5319 Mon Sep 17 00:00:00 2001 From: LuciaEchevarria99 <110391668+LuciaEchevarria99@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:01:38 +0200 Subject: [PATCH 3/8] Update repository for Fast DDS 3.0.0 compatibility (#86) * Update repository for Fast DDS 3.0.0 compatibility Signed-off-by: Lucia Echevarria * Regenerate types and change fastrtps dependency to fastdds Signed-off-by: Lucia Echevarria * Continue updating to Fast DDS 3.x Signed-off-by: Lucia Echevarria * Update to new changes in FastDDS Signed-off-by: Lucia Echevarria * Accept v6 interfaces and interface names in whitelist (#93) Signed-off-by: Juan Lopez Fernandez * Remove tool_show_topic_dds test Signed-off-by: Lucia Echevarria * Apply suggested changes Signed-off-by: Lucia Echevarria * Update log macro and fix XTSAN list Signed-off-by: Lucia Echevarria * Update documentation Signed-off-by: Lucia Echevarria * Uncrustify Signed-off-by: Lucia Echevarria --------- Signed-off-by: Lucia Echevarria Signed-off-by: Juan Lopez Fernandez Co-authored-by: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com> --- .../installation/sources/linux.rst | 4 +- .../installation/sources/windows.rst | 4 +- docs/rst/user_manual/configuration.rst | 4 - .../model/DataStreamer.hpp | 12 +- .../model/NetworkDatabase.hpp | 2 - .../participant/SpyDdsParticipant.hpp | 32 +- fastddsspy_participants/package.xml | 2 +- .../project_settings.cmake | 4 +- .../src/cpp/model/DataStreamer.cpp | 29 +- .../src/cpp/participant/SpyDdsParticipant.cpp | 57 ++-- .../src/cpp/testing/random_values.cpp | 2 +- .../test/blackbox/model/CMakeLists.txt | 4 +- .../test/unittest/model/CMakeLists.txt | 2 +- .../test/unittest/model/DataStreamerTest.cpp | 89 +++--- .../unittest/visualization/CMakeLists.txt | 2 +- fastddsspy_tool/project_settings.cmake | 2 +- fastddsspy_tool/src/cpp/main.cpp | 18 +- fastddsspy_tool/src/cpp/tool/Controller.cpp | 53 ++-- fastddsspy_tool/src/cpp/tool/Controller.hpp | 11 +- .../arguments_configuration.cpp | 19 +- .../AdvancedConfigurationPublisher.cpp | 13 +- .../AdvancedConfigurationPublisher.h | 6 +- .../AdvancedConfigurationSubscriber.cpp | 11 +- .../AdvancedConfigurationSubscriber.h | 6 +- .../CMakeLists.txt | 17 +- .../AdvancedConfigurationExample/README.md | 2 +- .../types/{v2/HelloWorld.h => HelloWorld.hpp} | 125 +++++--- .../types/{v1 => }/HelloWorld.idl | 0 .../types/{v2 => }/HelloWorldCdrAux.hpp | 10 +- .../types/{v2 => }/HelloWorldCdrAux.ipp | 13 +- .../types/{v2 => }/HelloWorldPubSubTypes.cxx | 169 +++++----- ...ubSubTypes.h => HelloWorldPubSubTypes.hpp} | 75 ++--- .../types/HelloWorldTypeObjectSupport.cxx | 164 ++++++++++ .../types/HelloWorldTypeObjectSupport.hpp | 56 ++++ .../types/v1/HelloWorld.cxx | 227 -------------- .../types/v1/HelloWorld.h | 235 -------------- .../types/v1/HelloWorldPubSubTypes.cxx | 170 ----------- .../types/v1/HelloWorldPubSubTypes.h | 145 --------- .../types/v2/HelloWorld.cxx | 168 ---------- .../types/v2/HelloWorld.idl | 5 - .../types/v2/HelloWorldv1.cxx | 288 ------------------ .../types/v2/HelloWorldv1.h | 243 --------------- .../test_cases/one_shot_topics_name_dds.py | 2 +- .../test_cases/one_shot_topics_verbose_dds.py | 2 +- .../test_cases/tool_show_topic_dds.py | 45 --- fastddsspy_yaml/project_settings.cmake | 2 +- .../src/cpp/YamlReaderConfiguration.cpp | 2 +- 47 files changed, 652 insertions(+), 1901 deletions(-) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v2/HelloWorld.h => HelloWorld.hpp} (70%) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v1 => }/HelloWorld.idl (100%) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v2 => }/HelloWorldCdrAux.hpp (86%) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v2 => }/HelloWorldCdrAux.ipp (94%) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v2 => }/HelloWorldPubSubTypes.cxx (50%) rename fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/{v2/HelloWorldPubSubTypes.h => HelloWorldPubSubTypes.hpp} (59%) create mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.cxx create mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.hpp delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.cxx delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.h delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.cxx delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.h delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.cxx delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.idl delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.cxx delete mode 100644 fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.h delete mode 100644 fastddsspy_tool/test/application/test_cases/tool_show_topic_dds.py diff --git a/docs/rst/developer_manual/installation/sources/linux.rst b/docs/rst/developer_manual/installation/sources/linux.rst index 12ed4a0c..25afe9bf 100644 --- a/docs/rst/developer_manual/installation/sources/linux.rst +++ b/docs/rst/developer_manual/installation/sources/linux.rst @@ -25,7 +25,7 @@ The following packages will be installed: - ``foonathan_memory_vendor``, an STL compatible C++ memory allocation library. - ``fastcdr``, a C++ library that serializes according to the standard CDR serialization mechanism. -- ``fastrtps``, the core library of eProsima Fast DDS library. +- ``fastdds``, the core library of eProsima Fast DDS library. - ``cmake_utils``, an eProsima utils library for CMake. - ``cpp_utils``, an eProsima utils library for C++. - ``ddspipe``, an eProsima internal library that enables the communication of DDS interfaces. @@ -93,7 +93,7 @@ Use the following command to download the code: .. code-block:: bash - git clone --branch release-1.11.0 https://github.com/google/googletest src/googletest-distribution + git clone --branch release-1.12.0 https://github.com/google/googletest src/googletest-distribution .. _dependencies: diff --git a/docs/rst/developer_manual/installation/sources/windows.rst b/docs/rst/developer_manual/installation/sources/windows.rst index 20adf52f..bea5ff3a 100644 --- a/docs/rst/developer_manual/installation/sources/windows.rst +++ b/docs/rst/developer_manual/installation/sources/windows.rst @@ -25,7 +25,7 @@ The following packages will be installed: - ``foonathan_memory_vendor``, an STL compatible C++ memory allocation library. - ``fastcdr``, a C++ library that serializes according to the standard CDR serialization mechanism. -- ``fastrtps``, the core library of eProsima Fast DDS library. +- ``fastdds``, the core library of eProsima Fast DDS library. - ``cmake_utils``, an eProsima utils library for CMake. - ``cpp_utils``, an eProsima utils library for C++. - ``ddspipe``, an eProsima internal library that enables the communication of DDS interfaces. @@ -255,7 +255,7 @@ There are two possibilities: However, when running an instance of a |spy| compiled using CMake, it must be linked with its dependencies where the packages have been installed. This can be done by opening the *Edit system environment variables* control panel and adding to the ``PATH`` the |espy|, *Fast DDS*, *Fast CDR*, *DDS Pipe* installation directories: -* *Fast DDS*: ``C:\\Program Files\\fastrtps`` +* *Fast DDS*: ``C:\\Program Files\\fastdds`` * *Fast CDR*: ``C:\\Program Files\\fastcdr`` * *DDS Pipe*: ``C:\\Program Files\\ddspipe`` * |espy|: ``C:\\Program Files\\ddsrecord`` diff --git a/docs/rst/user_manual/configuration.rst b/docs/rst/user_manual/configuration.rst index bf209531..b1135be6 100644 --- a/docs/rst/user_manual/configuration.rst +++ b/docs/rst/user_manual/configuration.rst @@ -364,10 +364,6 @@ The type of the logs published is defined as follows: string timestamp; }; -.. note:: - - The type of the logs can be published by setting ``publish-type: true``. - **Example of usage** .. code-block:: yaml diff --git a/fastddsspy_participants/include/fastddsspy_participants/model/DataStreamer.hpp b/fastddsspy_participants/include/fastddsspy_participants/model/DataStreamer.hpp index 3da7d7b5..312e4339 100644 --- a/fastddsspy_participants/include/fastddsspy_participants/model/DataStreamer.hpp +++ b/fastddsspy_participants/include/fastddsspy_participants/model/DataStreamer.hpp @@ -17,8 +17,11 @@ #include #include #include +#include -#include +#include + +#include #include #include @@ -39,7 +42,7 @@ class DataStreamer : public TopicRateCalculator using CallbackType = std::function; FASTDDSSPY_PARTICIPANTS_DllAPI @@ -56,7 +59,8 @@ class DataStreamer : public TopicRateCalculator FASTDDSSPY_PARTICIPANTS_DllAPI void add_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type) override; + const fastdds::dds::DynamicType::_ref_type& dynamic_type, + const fastdds::dds::xtypes::TypeIdentifier& type_identifier) override; FASTDDSSPY_PARTICIPANTS_DllAPI void add_data( @@ -80,7 +84,7 @@ class DataStreamer : public TopicRateCalculator ddspipe::core::types::DdsTopic activated_topic_; - std::map types_discovered_; + std::map types_discovered_; mutable std::shared_timed_mutex mutex_; }; diff --git a/fastddsspy_participants/include/fastddsspy_participants/model/NetworkDatabase.hpp b/fastddsspy_participants/include/fastddsspy_participants/model/NetworkDatabase.hpp index 185665d3..e0267fbd 100644 --- a/fastddsspy_participants/include/fastddsspy_participants/model/NetworkDatabase.hpp +++ b/fastddsspy_participants/include/fastddsspy_participants/model/NetworkDatabase.hpp @@ -14,8 +14,6 @@ #pragma once -#include - #include #include diff --git a/fastddsspy_participants/include/fastddsspy_participants/participant/SpyDdsParticipant.hpp b/fastddsspy_participants/include/fastddsspy_participants/participant/SpyDdsParticipant.hpp index f7186e20..6effe30b 100644 --- a/fastddsspy_participants/include/fastddsspy_participants/participant/SpyDdsParticipant.hpp +++ b/fastddsspy_participants/include/fastddsspy_participants/participant/SpyDdsParticipant.hpp @@ -14,6 +14,14 @@ #pragma once +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -47,19 +55,25 @@ class SpyDdsParticipant : public ddspipe::participants::DynTypesParticipant const ddspipe::core::ITopic& topic) override; FASTDDSSPY_PARTICIPANTS_DllAPI - virtual void on_participant_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) override; + void on_participant_discovery( + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, + bool& should_be_ignored) override; FASTDDSSPY_PARTICIPANTS_DllAPI - virtual void on_subscriber_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info); + void on_reader_discovery( + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, + bool& should_be_ignored) override; FASTDDSSPY_PARTICIPANTS_DllAPI - virtual void on_publisher_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info); + void on_writer_discovery( + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, + bool& should_be_ignored) override; protected: diff --git a/fastddsspy_participants/package.xml b/fastddsspy_participants/package.xml index dc40f5ff..7c296439 100644 --- a/fastddsspy_participants/package.xml +++ b/fastddsspy_participants/package.xml @@ -21,7 +21,7 @@ cpp_utils ddspipe_core ddspipe_participants - fastrtps + fastdds doxygen diff --git a/fastddsspy_participants/project_settings.cmake b/fastddsspy_participants/project_settings.cmake index aaed7e9e..61c9e459 100644 --- a/fastddsspy_participants/project_settings.cmake +++ b/fastddsspy_participants/project_settings.cmake @@ -24,12 +24,12 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants) -set(fastrtps_MINIMUM_VERSION "2.8") +set(fastdds_MINIMUM_VERSION "3.0.0") set(MODULE_DEPENDENCIES $<$:iphlpapi$Shlwapi> diff --git a/fastddsspy_participants/src/cpp/model/DataStreamer.cpp b/fastddsspy_participants/src/cpp/model/DataStreamer.cpp index 12d82e16..af34a7af 100644 --- a/fastddsspy_participants/src/cpp/model/DataStreamer.cpp +++ b/fastddsspy_participants/src/cpp/model/DataStreamer.cpp @@ -14,11 +14,10 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -48,7 +47,7 @@ bool DataStreamer::activate( { if (!is_topic_type_discovered(topic_to_activate)) { - logWarning(FASTDDSSPY_DATASTREAMER, + EPROSIMA_LOG_WARNING(FASTDDSSPY_DATASTREAMER, "Type <" << topic_to_activate.type_name << "> for topic <" << topic_to_activate.topic_name() << "> is not discovered."); return false; @@ -73,15 +72,19 @@ void DataStreamer::deactivate() } void DataStreamer::add_schema( - const fastrtps::types::DynamicType_ptr& dynamic_type) + const fastdds::dds::DynamicType::_ref_type& dynamic_type, + const fastdds::dds::xtypes::TypeIdentifier& type_identifier) { + static_cast(type_identifier); + std::unique_lock _(mutex_); // Add type to map if not yet // NOTE: it does not matter if it is already in set - types_discovered_[dynamic_type->get_name()] = dynamic_type; + auto const type_name = dynamic_type->get_name().to_string(); + types_discovered_[type_name] = dynamic_type; - logInfo(FASTDDSSPY_DATASTREAMER, "\nAdding schema with name " << dynamic_type->get_name() << "."); + EPROSIMA_LOG_INFO(FASTDDSSPY_DATASTREAMER, "\nAdding schema with name " << type_name << "."); } void DataStreamer::add_data( @@ -90,7 +93,7 @@ void DataStreamer::add_data( { TopicRateCalculator::add_data(topic, data); - fastrtps::types::DynamicType_ptr dyn_type; + fastdds::dds::DynamicType::_ref_type dyn_type; { std::shared_lock _(mutex_); @@ -106,7 +109,7 @@ void DataStreamer::add_data( if (!is_topic_type_discovered_nts_(topic)) { // If all activated, add it only if schema is available, otherwise skip - logWarning( + EPROSIMA_LOG_WARNING( FASTDDSSPY_DATASTREAMER, "All activated but schema not is available."); return; @@ -117,14 +120,14 @@ void DataStreamer::add_data( if (!(activated_topic_ == topic)) { // If not all activated, and this is not the activated topic skip - logWarning( + EPROSIMA_LOG_WARNING( FASTDDSSPY_DATASTREAMER, "Not all activated, and this is not the activated topic."); return; } } - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_DATASTREAMER, "Adding data in topic " << topic); diff --git a/fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp b/fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp index c9c85f04..bc9f77f6 100644 --- a/fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp +++ b/fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include @@ -57,30 +55,37 @@ std::shared_ptr SpyDdsParticipant::create_reader( } void SpyDdsParticipant::on_participant_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& discovery_info) + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::rtps::ParticipantBuiltinTopicData& info, + bool& should_be_ignored) { // If comes from this participant is not interesting - if (come_from_this_participant_(discovery_info.info.m_guid)) + if (come_from_this_participant_(info.guid)) { return; } - ParticipantInfo info; - info.active = (discovery_info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT - || discovery_info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT); - info.name = std::string(discovery_info.info.m_participantName); - info.guid = discovery_info.info.m_guid; + ParticipantInfo participant_info; + participant_info.active = (reason == fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT + || reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT); + participant_info.name = std::string(info.participant_name); + participant_info.guid = info.guid; + + ddspipe::participants::rtps::CommonParticipant::on_participant_discovery(participant, reason, info, + should_be_ignored); - internal_notify_participant_discovered_(info); + internal_notify_participant_discovered_(participant_info); } -void SpyDdsParticipant::on_subscriber_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) +void SpyDdsParticipant::on_reader_discovery( + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, + bool& should_be_ignored) { // If comes from this participant is not interesting - if (come_from_this_participant_(info.info.guid())) + if (come_from_this_participant_(info.guid)) { return; } @@ -88,17 +93,21 @@ void SpyDdsParticipant::on_subscriber_discovery( EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id()); // If participant left or dropped, this notification arrives as well - endpoint_info.active = !(info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::REMOVED_READER); + endpoint_info.active = !(reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER); + + ddspipe::participants::DynTypesParticipant::on_reader_discovery(participant, reason, info, should_be_ignored); internal_notify_endpoint_discovered_(endpoint_info); } -void SpyDdsParticipant::on_publisher_discovery( - fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) +void SpyDdsParticipant::on_writer_discovery( + fastdds::rtps::RTPSParticipant* participant, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, + bool& should_be_ignored) { // If comes from this participant is not interesting - if (come_from_this_participant_(info.info.guid())) + if (come_from_this_participant_(info.guid)) { return; } @@ -106,7 +115,9 @@ void SpyDdsParticipant::on_publisher_discovery( EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id()); // If participant left or dropped, this notification arrives as well - endpoint_info.active = !(info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::REMOVED_WRITER); + endpoint_info.active = !(reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER); + + ddspipe::participants::DynTypesParticipant::on_writer_discovery(participant, reason, info, should_be_ignored); internal_notify_endpoint_discovered_(endpoint_info); } @@ -140,9 +151,7 @@ void SpyDdsParticipant::internal_notify_endpoint_discovered_( bool SpyDdsParticipant::come_from_this_participant_( const ddspipe::core::types::Guid& guid) const noexcept { - return (guid.guid_prefix() == dds_participant_->guid().guidPrefix - || guid.guid_prefix() == rtps_participant_->getGuid().guidPrefix - ); + return (guid.guid_prefix() == rtps_participant_->getGuid().guidPrefix); } } /* namespace participants */ diff --git a/fastddsspy_participants/src/cpp/testing/random_values.cpp b/fastddsspy_participants/src/cpp/testing/random_values.cpp index 13dc7029..81233b61 100644 --- a/fastddsspy_participants/src/cpp/testing/random_values.cpp +++ b/fastddsspy_participants/src/cpp/testing/random_values.cpp @@ -22,7 +22,7 @@ ddspipe::core::types::Guid random_guid_same_prefix( unsigned int seed /* = 1 */) { ddspipe::core::types::Guid guid; - guid.entityId.value[3] = static_cast(seed); + guid.entityId.value[3] = static_cast(seed); guid.guidPrefix.value[0] = 0x01; guid.guidPrefix.value[1] = 0x0f; return guid; diff --git a/fastddsspy_participants/test/blackbox/model/CMakeLists.txt b/fastddsspy_participants/test/blackbox/model/CMakeLists.txt index 4c5a6d1a..ce3c8741 100644 --- a/fastddsspy_participants/test/blackbox/model/CMakeLists.txt +++ b/fastddsspy_participants/test/blackbox/model/CMakeLists.txt @@ -36,7 +36,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants @@ -80,7 +80,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/fastddsspy_participants/test/unittest/model/CMakeLists.txt b/fastddsspy_participants/test/unittest/model/CMakeLists.txt index a8799af1..fc315f77 100644 --- a/fastddsspy_participants/test/unittest/model/CMakeLists.txt +++ b/fastddsspy_participants/test/unittest/model/CMakeLists.txt @@ -31,7 +31,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/fastddsspy_participants/test/unittest/model/DataStreamerTest.cpp b/fastddsspy_participants/test/unittest/model/DataStreamerTest.cpp index 690f7f83..190ac385 100644 --- a/fastddsspy_participants/test/unittest/model/DataStreamerTest.cpp +++ b/fastddsspy_participants/test/unittest/model/DataStreamerTest.cpp @@ -15,24 +15,25 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include using namespace eprosima; -void create_schema( - ddspipe::core::types::DdsTopic& topic, - fastrtps::types::DynamicType_ptr& dynamic_type_topic) +fastdds::dds::DynamicType::_ref_type create_schema( + ddspipe::core::types::DdsTopic& topic) { - fastrtps::types::DynamicTypeBuilder_ptr dynamic_type_topic_builder; - dynamic_type_topic_builder = fastrtps::types::DynamicTypeBuilderFactory::get_instance()->create_struct_builder(); - - dynamic_type_topic_builder->set_name(topic.type_name); - dynamic_type_topic = dynamic_type_topic_builder->build(); + fastdds::dds::TypeDescriptor::_ref_type type_descriptor {fastdds::dds::traits:: + make_shared()}; + type_descriptor->name(topic.type_name); + fastdds::dds::DynamicTypeBuilder::_ref_type struct_builder {fastdds::dds::DynamicTypeBuilderFactory::get_instance() + ->create_type(type_descriptor)}; + fastdds::dds::DynamicType::_ref_type dynamic_type_topic {struct_builder->build()}; + return dynamic_type_topic; } TEST(DataStreamerTest, activate_false) @@ -58,10 +59,11 @@ TEST(DataStreamerTest, activate_true) std::shared_ptr cb = std::make_shared(); - fastrtps::types::DynamicType_ptr dynamic_type_topic; - create_schema(topic, dynamic_type_topic); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic; + dynamic_type_topic = create_schema(topic); - ds.add_schema(dynamic_type_topic); + fastdds::dds::xtypes::TypeIdentifier type_identifier; + ds.add_schema(dynamic_type_topic, type_identifier); ASSERT_TRUE(ds.activate(topic, cb)); } @@ -77,19 +79,21 @@ TEST(DataStreamerTest, activate_twice) std::shared_ptr cb = std::make_shared(); - fastrtps::types::DynamicType_ptr dynamic_type_topic_1; - create_schema(topic_1, dynamic_type_topic_1); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic_1; + dynamic_type_topic_1 = create_schema(topic_1); - ds.add_schema(dynamic_type_topic_1); + fastdds::dds::xtypes::TypeIdentifier type_identifier_1; + ds.add_schema(dynamic_type_topic_1, type_identifier_1); ddspipe::core::types::DdsTopic topic_2; topic_2.m_topic_name = "topic2"; topic_2.type_name = "type2"; - fastrtps::types::DynamicType_ptr dynamic_type_topic_2; - create_schema(topic_2, dynamic_type_topic_2); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic_2; + dynamic_type_topic_2 = create_schema(topic_2); - ds.add_schema(dynamic_type_topic_2); + fastdds::dds::xtypes::TypeIdentifier type_identifier_2; + ds.add_schema(dynamic_type_topic_2, type_identifier_2); // is this the correct behaviour? ASSERT_TRUE(ds.activate(topic_1, cb)); @@ -110,10 +114,11 @@ TEST(DataStreamerTest, topic_type_discovered) topic_2.m_topic_name = "topic2"; topic_2.type_name = "type2"; - fastrtps::types::DynamicType_ptr dynamic_type_topic_2; - create_schema(topic_2, dynamic_type_topic_2); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic_2; + dynamic_type_topic_2 = create_schema(topic_2); - ds.add_schema(dynamic_type_topic_2); + fastdds::dds::xtypes::TypeIdentifier type_identifier; + ds.add_schema(dynamic_type_topic_2, type_identifier); ASSERT_TRUE(ds.is_topic_type_discovered(topic_2)); } @@ -131,16 +136,17 @@ TEST(DataStreamerTest, deactivate) std::make_shared( [&data_sent] (const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const ddspipe::core::types::RtpsPayloadData& data) { data_sent++; }); - fastrtps::types::DynamicType_ptr dynamic_type_topic; - create_schema(topic, dynamic_type_topic); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic; + dynamic_type_topic = create_schema(topic); - ds.add_schema(dynamic_type_topic); + fastdds::dds::xtypes::TypeIdentifier type_identifier; + ds.add_schema(dynamic_type_topic, type_identifier); ds.activate(topic, cb); @@ -178,16 +184,17 @@ TEST(DataStreamerTest, add_data) std::make_shared( [&data_sent] (const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const ddspipe::core::types::RtpsPayloadData& data) { data_sent++; }); - fastrtps::types::DynamicType_ptr dynamic_type_topic; - create_schema(topic, dynamic_type_topic); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic; + dynamic_type_topic = create_schema(topic); - ds.add_schema(dynamic_type_topic); + fastdds::dds::xtypes::TypeIdentifier type_identifier; + ds.add_schema(dynamic_type_topic, type_identifier); ds.activate(topic, cb); @@ -217,16 +224,17 @@ TEST(DataStreamerTest, add_data_two_topics) std::make_shared( [&data_sent_1] (const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const ddspipe::core::types::RtpsPayloadData& data) { data_sent_1++; }); - fastrtps::types::DynamicType_ptr dynamic_type_topic_1; - create_schema(topic_1, dynamic_type_topic_1); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic_1; + dynamic_type_topic_1 = create_schema(topic_1); - ds.add_schema(dynamic_type_topic_1); + fastdds::dds::xtypes::TypeIdentifier type_identifier_1; + ds.add_schema(dynamic_type_topic_1, type_identifier_1); ds.activate(topic_1, cb_1); @@ -240,16 +248,17 @@ TEST(DataStreamerTest, add_data_two_topics) std::make_shared( [&data_sent_2] (const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& type, + const fastdds::dds::DynamicType::_ref_type& type, const ddspipe::core::types::RtpsPayloadData& data) { data_sent_2++; }); - fastrtps::types::DynamicType_ptr dynamic_type_topic_2; - create_schema(topic_2, dynamic_type_topic_2); + fastdds::dds::DynamicType::_ref_type dynamic_type_topic_2; + dynamic_type_topic_2 = create_schema(topic_2); - ds.add_schema(dynamic_type_topic_2); + fastdds::dds::xtypes::TypeIdentifier type_identifier_2; + ds.add_schema(dynamic_type_topic_2, type_identifier_2); ds.activate(topic_2, cb_2); diff --git a/fastddsspy_participants/test/unittest/visualization/CMakeLists.txt b/fastddsspy_participants/test/unittest/visualization/CMakeLists.txt index 438ed18a..c7e985e4 100644 --- a/fastddsspy_participants/test/unittest/visualization/CMakeLists.txt +++ b/fastddsspy_participants/test/unittest/visualization/CMakeLists.txt @@ -72,7 +72,7 @@ set(TEST_LIST set(TEST_EXTRA_LIBRARIES fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/fastddsspy_tool/project_settings.cmake b/fastddsspy_tool/project_settings.cmake index 89b44db8..40cb75d9 100644 --- a/fastddsspy_tool/project_settings.cmake +++ b/fastddsspy_tool/project_settings.cmake @@ -25,7 +25,7 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/fastddsspy_tool/src/cpp/main.cpp b/fastddsspy_tool/src/cpp/main.cpp index 841ca0a2..13054971 100644 --- a/fastddsspy_tool/src/cpp/main.cpp +++ b/fastddsspy_tool/src/cpp/main.cpp @@ -76,7 +76,7 @@ int main( { commandline_args.file_path = eprosima::spy::DEFAULT_CONFIGURATION_FILE_NAME; - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_TOOL, "Not configuration file given, try to use default file " << commandline_args.file_path << "."); } @@ -85,7 +85,7 @@ int main( // NOTE: this check is redundant with option parse arg check if (!is_file_accessible(commandline_args.file_path.c_str(), eprosima::utils::FileAccessMode::read)) { - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_TOOL, "File '" << commandline_args.file_path << "' does not exist or it is not accessible. Using default configuration."); @@ -101,7 +101,7 @@ int main( // Default configuration. Load it from file if file exists if (commandline_args.file_path != "") { - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_TOOL, "Loading configuration from file '" << commandline_args.file_path << "' ."); } @@ -152,7 +152,7 @@ int main( [&spy, commandline_args] (std::string file_name) { - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_TOOL, "FileWatcher notified changes in file " << file_name << ". Reloading configuration"); @@ -163,7 +163,7 @@ int main( } catch (const std::exception& e) { - logWarning(FASTDDSSPY_TOOL, + EPROSIMA_LOG_WARNING(FASTDDSSPY_TOOL, "Error reloading configuration file " << file_name << " with error: " << e.what()); } }; @@ -187,7 +187,7 @@ int main( [&spy, commandline_args] () { - logInfo( + EPROSIMA_LOG_INFO( FASTDDSSPY_TOOL, "Periodic Timer raised. Reloading configuration from file " << commandline_args.file_path << "."); @@ -199,7 +199,7 @@ int main( } catch (const std::exception& e) { - logWarning(FASTDDSSPY_TOOL, + EPROSIMA_LOG_WARNING(FASTDDSSPY_TOOL, "Error reloading configuration file " << commandline_args.file_path << " with error: " << e.what()); } @@ -232,7 +232,7 @@ int main( } catch (const eprosima::utils::ConfigurationException& e) { - logError(FASTDDSSPY_TOOL, + EPROSIMA_LOG_ERROR(FASTDDSSPY_TOOL, "Error Loading Fast DDS Spy Configuration from file " << commandline_args.file_path << ". Error message:\n " << e.what()); @@ -240,7 +240,7 @@ int main( } catch (const eprosima::utils::InitializationException& e) { - logError(FASTDDSSPY_TOOL, + EPROSIMA_LOG_ERROR(FASTDDSSPY_TOOL, "Error Initializing Fast DDS Spy. Error message:\n " << e.what()); return static_cast(eprosima::spy::ProcessReturnCode::execution_failed); diff --git a/fastddsspy_tool/src/cpp/tool/Controller.cpp b/fastddsspy_tool/src/cpp/tool/Controller.cpp index 3397d743..06f9fd58 100644 --- a/fastddsspy_tool/src/cpp/tool/Controller.cpp +++ b/fastddsspy_tool/src/cpp/tool/Controller.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -111,25 +111,26 @@ void Controller::run_command_( } } -fastrtps::types::DynamicData_ptr Controller::get_dynamic_data_( - const fastrtps::types::DynamicType_ptr& dyn_type, +fastdds::dds::DynamicData::_ref_type Controller::get_dynamic_data_( + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data) noexcept { // TODO fast this should not be done, but dyn types API is like it is. auto& data_no_const = const_cast(data); // Create PubSub Type - fastrtps::types::DynamicPubSubType pubsub_type(dyn_type); - fastrtps::types::DynamicData_ptr dyn_data(fastrtps::types::DynamicDataFactory::get_instance()->create_data(dyn_type)); + fastdds::dds::DynamicPubSubType pubsub_type(dyn_type); + fastdds::dds::DynamicData::_ref_type dyn_data(fastdds::dds::DynamicDataFactory::get_instance()->create_data( + dyn_type)); - pubsub_type.deserialize(&data_no_const.payload, dyn_data.get()); + pubsub_type.deserialize(data_no_const.payload, &dyn_data); return dyn_data; } void Controller::data_stream_callback_( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data) { // Block entrance so prints does not collapse @@ -141,13 +142,22 @@ void Controller::data_stream_callback_( // TODO fast this does not make much sense as dynamictypes::print does not allow to choose target // change in dyn types to be able to print it in view view_.show("---"); - fastrtps::types::DynamicDataHelper::print(dyn_data.get()); + std::stringstream ss; + ss << std::setw(4); + if (fastdds::dds::RETCODE_OK != + fastdds::dds::json_serialize(dyn_data, fastdds::dds::DynamicDataJsonFormat::EPROSIMA, ss)) + { + EPROSIMA_LOG_WARNING(FASTDDSSPY_CONTROLLER, + "Not able to serialize data of topic " << topic.topic_name() << " into JSON format."); + return; + } + std::cout << ss.str() << std::endl; view_.show("---\n"); } void Controller::data_stream_callback_verbose_( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data) { // Block entrance so prints does not collapse @@ -170,7 +180,16 @@ void Controller::data_stream_callback_verbose_( // Print data view_.show("data:\n---"); - fastrtps::types::DynamicDataHelper::print(dyn_data.get()); + std::stringstream ss; + ss << std::setw(4); + if (fastdds::dds::RETCODE_OK != + fastdds::dds::json_serialize(dyn_data, fastdds::dds::DynamicDataJsonFormat::EPROSIMA, ss)) + { + EPROSIMA_LOG_WARNING(FASTDDSSPY_CONTROLLER, + "Not able to serialize data of topic " << topic.topic_name() << " into JSON format."); + return; + } + std::cout << ss.str() << std::endl; view_.show("---\n"); } @@ -310,7 +329,7 @@ void Controller::print_command_( std::make_shared( [this]( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data ) { @@ -363,7 +382,7 @@ void Controller::print_command_( callback = std::make_shared( [this]( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data ) { @@ -375,7 +394,7 @@ void Controller::print_command_( callback = std::make_shared( [this]( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data ) { diff --git a/fastddsspy_tool/src/cpp/tool/Controller.hpp b/fastddsspy_tool/src/cpp/tool/Controller.hpp index 7d722861..c5860092 100644 --- a/fastddsspy_tool/src/cpp/tool/Controller.hpp +++ b/fastddsspy_tool/src/cpp/tool/Controller.hpp @@ -17,7 +17,8 @@ #include #include -#include +#include +#include #include @@ -52,18 +53,18 @@ class Controller //////////////////////////// // DATA STREAM CALLBACKS - static fastrtps::types::DynamicData_ptr get_dynamic_data_( - const fastrtps::types::DynamicType_ptr& dyn_type, + static fastdds::dds::DynamicData::_ref_type get_dynamic_data_( + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data) noexcept; void data_stream_callback_( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data); void data_stream_callback_verbose_( const ddspipe::core::types::DdsTopic& topic, - const fastrtps::types::DynamicType_ptr& dyn_type, + const fastdds::dds::DynamicType::_ref_type& dyn_type, const ddspipe::core::types::RtpsPayloadData& data); ///////////////////// diff --git a/fastddsspy_tool/src/cpp/user_interface/arguments_configuration.cpp b/fastddsspy_tool/src/cpp/user_interface/arguments_configuration.cpp index 5b84faf5..d907f9b7 100644 --- a/fastddsspy_tool/src/cpp/user_interface/arguments_configuration.cpp +++ b/fastddsspy_tool/src/cpp/user_interface/arguments_configuration.cpp @@ -264,7 +264,7 @@ ProcessReturnCode parse_arguments( break; case optionIndex::UNKNOWN_OPT: - logError(FASTDDSSPY_ARGS, opt << " is not a valid argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, opt << " is not a valid argument."); option::printUsage(fwrite, stdout, usage, columns); return ProcessReturnCode::incorrect_argument; break; @@ -283,7 +283,7 @@ option::ArgStatus Arg::Unknown( { if (msg) { - logError( + EPROSIMA_LOG_ERROR( FASTDDSSPY_ARGS, "Unknown option '" << option << "'. Use -h to see this executable possible arguments."); } @@ -301,7 +301,7 @@ option::ArgStatus Arg::Required( if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option << "' required."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, "Option '" << option << "' required."); } return option::ARG_ILLEGAL; } @@ -321,7 +321,7 @@ option::ArgStatus Arg::Numeric( if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option << "' requires a numeric argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, "Option '" << option << "' requires a numeric argument."); } return option::ARG_ILLEGAL; } @@ -341,7 +341,7 @@ option::ArgStatus Arg::Float( if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option << "' requires a float argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, "Option '" << option << "' requires a float argument."); } return option::ARG_ILLEGAL; } @@ -356,7 +356,7 @@ option::ArgStatus Arg::String( } if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option << "' requires a text argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, "Option '" << option << "' requires a text argument."); } return option::ARG_ILLEGAL; } @@ -375,7 +375,8 @@ option::ArgStatus Arg::Readable_File( } if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option << "' requires an existing readable file as argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, + "Option '" << option << "' requires an existing readable file as argument."); } return option::ARG_ILLEGAL; } @@ -396,7 +397,7 @@ option::ArgStatus Arg::Valid_Options( { if (msg) { - logError(FASTDDSSPY_ARGS, "Option '" << option.name << "' requires a text argument."); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, "Option '" << option.name << "' requires a text argument."); } return option::ARG_ILLEGAL; } @@ -415,7 +416,7 @@ option::ArgStatus Arg::Valid_Options( } error_msg << "}."; - logError(FASTDDSSPY_ARGS, error_msg); + EPROSIMA_LOG_ERROR(FASTDDSSPY_ARGS, error_msg); } return option::ARG_ILLEGAL; diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.cpp b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.cpp index 9698ed8e..4b11ee8a 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.cpp +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.cpp @@ -26,11 +26,10 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include "AdvancedConfigurationPublisher.h" @@ -235,8 +234,8 @@ bool HelloWorldPublisher::init( wqos.ownership_strength().value = ownership_strength; } - wqos.liveliness().lease_duration = eprosima::fastrtps::Duration_t(2, 0); - wqos.liveliness().announcement_period = eprosima::fastrtps::Duration_t(1, 0); + wqos.liveliness().lease_duration = eprosima::fastdds::dds::Duration_t(2, 0); + wqos.liveliness().announcement_period = eprosima::fastdds::dds::Duration_t(1, 0); writer_ = publisher_->create_datawriter(topic_, wqos, &listener_); diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.h index 9dcd599a..304aa09e 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.h +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationPublisher.h @@ -28,11 +28,7 @@ #include #include -#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - #include "types/v1/HelloWorldPubSubTypes.h" -#else - #include "types/v2/HelloWorldPubSubTypes.h" -#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 +#include "types/HelloWorldPubSubTypes.hpp" #include "types.hpp" diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.cpp b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.cpp index f8d544b1..825d62f8 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.cpp +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.cpp @@ -24,11 +24,10 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include "AdvancedConfigurationSubscriber.h" @@ -282,7 +281,7 @@ void HelloWorldSubscriber::SubListener::on_data_available( DataReader* reader) { SampleInfo info; - while ((reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK) && !is_stopped()) + while ((reader->take_next_sample(&hello_, &info) == RETCODE_OK) && !is_stopped()) { if (info.instance_state == ALIVE_INSTANCE_STATE) { diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.h index b3e0ccc8..efad213f 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.h +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/AdvancedConfigurationSubscriber.h @@ -28,11 +28,7 @@ #include #include -#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 - #include "types/v1/HelloWorldPubSubTypes.h" -#else - #include "types/v2/HelloWorldPubSubTypes.h" -#endif // if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13 +#include "types/HelloWorldPubSubTypes.hpp" #include "types.hpp" diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/CMakeLists.txt b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/CMakeLists.txt index 1129030f..95701442 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/CMakeLists.txt +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/CMakeLists.txt @@ -21,8 +21,8 @@ if(NOT fastcdr_FOUND) find_package(fastcdr REQUIRED) endif() -if(NOT fastrtps_FOUND) - find_package(fastrtps REQUIRED) +if(NOT fastdds_FOUND) + find_package(fastdds REQUIRED) endif() #Check C++11 @@ -35,23 +35,16 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") endif() endif() -# Determine Fast DDS version -if ("${fastrtps_VERSION}" VERSION_LESS 2.13) - set(DDS_TYPES_VERSION "v1") -else() - set(DDS_TYPES_VERSION "v2") -endif() - message(STATUS "Configuring AdvancedConfiguration example...") file( GLOB ADVANCED_CONFIG_EXAMPLE_SOURCES_CXX "*.cxx" - "types/${DDS_TYPES_VERSION}/*.cxx" + "types/*.cxx" ) file( GLOB ADVANCED_CONFIG_EXAMPLE_SOURCES_CPP "*.cpp" - "types/${DDS_TYPES_VERSION}/*.cpp" + "types/*.cpp" ) add_executable(${PROJECT_NAME} ${ADVANCED_CONFIG_EXAMPLE_SOURCES_CXX} ${ADVANCED_CONFIG_EXAMPLE_SOURCES_CPP}) @@ -61,7 +54,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:SHM_TRANSPORT_BUILTIN> # Enable SHM as built-in transport ) -target_link_libraries(${PROJECT_NAME} fastrtps fastcdr fastdds::optionparser) +target_link_libraries(${PROJECT_NAME} fastdds fastcdr fastdds::optionparser) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION examples/cpp/dds/${PROJECT_NAME}/${BIN_INSTALL_DIR}) diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/README.md b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/README.md index d824ad75..8ee4e1d0 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/README.md +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/README.md @@ -96,5 +96,5 @@ This code presents how to run a publisher with this example without Shared Memor ```sh # From AdvancedConfigurationExample installation dir -FASTRTPS_DEFAULT_PROFILES_FILE=shm_off.xml ./AdvancedConfigurationExample publisher --xml-profile no_shm_participant_profile +FASTDDS_DEFAULT_PROFILES_FILE=shm_off.xml ./AdvancedConfigurationExample publisher --xml-profile no_shm_participant_profile ``` diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorld.hpp similarity index 70% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.h rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorld.hpp index aaf09e4b..91c4d338 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.h +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorld.hpp @@ -13,32 +13,18 @@ // limitations under the License. /*! - * @file HelloWorld.h + * @file HelloWorld.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "HelloWorldv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_H_ +#ifndef FAST_DDS_GENERATED__HELLOWORLD_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_HPP #include -#include #include -#include -#include -#include - -#include -#include -#include - - +#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +50,6 @@ #define HELLOWORLD_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure HelloWorld defined by the user in the IDL file. * @ingroup HelloWorld @@ -86,73 +61,117 @@ class HelloWorld /*! * @brief Default constructor. */ - eProsima_user_DllExport HelloWorld(); + eProsima_user_DllExport HelloWorld() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~HelloWorld(); + eProsima_user_DllExport ~HelloWorld() + { + } /*! * @brief Copy constructor. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld( - const HelloWorld& x); + const HelloWorld& x) + { + m_index = x.m_index; + + m_message = x.m_message; + + } /*! * @brief Move constructor. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld( - HelloWorld&& x) noexcept; + HelloWorld&& x) noexcept + { + m_index = x.m_index; + m_message = std::move(x.m_message); + } /*! * @brief Copy assignment. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld& operator =( - const HelloWorld& x); + const HelloWorld& x) + { + + m_index = x.m_index; + + m_message = x.m_message; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld& operator =( - HelloWorld&& x) noexcept; + HelloWorld&& x) noexcept + { + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; + } /*! * @brief Comparison operator. * @param x HelloWorld object to compare. */ eProsima_user_DllExport bool operator ==( - const HelloWorld& x) const; + const HelloWorld& x) const + { + return (m_index == x.m_index && + m_message == x.m_message); + } /*! * @brief Comparison operator. * @param x HelloWorld object to compare. */ eProsima_user_DllExport bool operator !=( - const HelloWorld& x) const; + const HelloWorld& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member index * @param _index New value for member index */ eProsima_user_DllExport void index( - uint32_t _index); + uint32_t _index) + { + m_index = _index; + } /*! * @brief This function returns the value of member index * @return Value of member index */ - eProsima_user_DllExport uint32_t index() const; + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } /*! * @brief This function returns a reference to member index * @return Reference to member index */ - eProsima_user_DllExport uint32_t& index(); + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } /*! @@ -160,26 +179,40 @@ class HelloWorld * @param _message New value to be copied in member message */ eProsima_user_DllExport void message( - const std::array& _message); + const std::array& _message) + { + m_message = _message; + } /*! * @brief This function moves the value in member message * @param _message New value to be moved in member message */ eProsima_user_DllExport void message( - std::array&& _message); + std::array&& _message) + { + m_message = std::move(_message); + } /*! * @brief This function returns a constant reference to member message * @return Constant reference to member message */ - eProsima_user_DllExport const std::array& message() const; + eProsima_user_DllExport const std::array& message() const + { + return m_message; + } /*! * @brief This function returns a reference to member message * @return Reference to member message */ - eProsima_user_DllExport std::array& message(); + eProsima_user_DllExport std::array& message() + { + return m_message; + } + + private: @@ -188,8 +221,6 @@ class HelloWorld }; -#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ - +#endif // _FAST_DDS_GENERATED_HELLOWORLD_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.idl b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorld.idl similarity index 100% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.idl rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorld.idl diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.hpp b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.hpp similarity index 86% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.hpp rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.hpp index 5c8468e7..8a4309ca 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.hpp +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.hpp @@ -19,10 +19,10 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP +#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP -#include "HelloWorld.h" +#include "HelloWorld.hpp" constexpr uint32_t HelloWorld_max_cdr_typesize {28UL}; constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL}; @@ -34,8 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const HelloWorld& data); @@ -44,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.ipp b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.ipp similarity index 94% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.ipp rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.ipp index 42e91f3c..30f135e3 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldCdrAux.ipp +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP +#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP #include "HelloWorldCdrAux.hpp" @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -115,8 +113,13 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const HelloWorld& data) { + static_cast(scdr); static_cast(data); + scdr << data.index(); + + scdr << data.message(); + } @@ -124,5 +127,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.cxx similarity index 50% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.cxx rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.cxx index 0e375416..865410fd 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.cxx +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.cxx @@ -19,63 +19,56 @@ * This file was generated by the tool fastddsgen. */ +#include "HelloWorldPubSubTypes.hpp" +#include #include -#include "HelloWorldPubSubTypes.h" #include "HelloWorldCdrAux.hpp" +#include "HelloWorldTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - HelloWorldPubSubType::HelloWorldPubSubType() { - setName("HelloWorld"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(HelloWorld::getMaxCdrSerializedSize()); -#else - HelloWorld_max_cdr_typesize; -#endif + set_name("HelloWorld"); + uint32_t type_size = HelloWorld_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } HelloWorldPubSubType::~HelloWorldPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool HelloWorldPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - HelloWorld* p_type = static_cast(data); + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; -#if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -90,16 +83,12 @@ bool HelloWorldPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool HelloWorldPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -108,18 +97,14 @@ bool HelloWorldPubSubType::deserialize( HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -132,89 +117,101 @@ bool HelloWorldPubSubType::deserialize( return true; } -std::function HelloWorldPubSubType::getSerializedSizeProvider( - void* data, +uint32_t HelloWorldPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } } -void* HelloWorldPubSubType::createData() +void* HelloWorldPubSubType::create_data() { return reinterpret_cast(new HelloWorld()); } -void HelloWorldPubSubType::deleteData( +void HelloWorldPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool HelloWorldPubSubType::getKey( - void* data, - InstanceHandle_t* handle, +bool HelloWorldPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - HelloWorld* p_type = static_cast(data); + HelloWorld data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool HelloWorldPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), HelloWorld_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || HelloWorld_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } + +void HelloWorldPubSubType::register_type_object_representation() +{ + register_HelloWorld_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "HelloWorldCdrAux.ipp" diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.hpp similarity index 59% rename from fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.h rename to fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.hpp index ddbfbab5..8937b288 100644 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldPubSubTypes.h +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldPubSubTypes.hpp @@ -13,31 +13,29 @@ // limitations under the License. /*! - * @file HelloWorldPubSubTypes.h + * @file HelloWorldPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include -#include "HelloWorld.h" +#include "HelloWorld.hpp" -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) #error \ Generated HelloWorld is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - +#endif // FASTDDS_GEN_API_VER /*! @@ -55,41 +53,36 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~HelloWorldPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -99,13 +92,9 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -123,10 +112,12 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; -#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.cxx new file mode 100644 index 00000000..0b3e6881 --- /dev/null +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.cxx @@ -0,0 +1,164 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldTypeObjectSupport.cxx + * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#include "HelloWorldTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "HelloWorld.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_HelloWorld_type_identifier( + TypeIdentifierPair& type_ids_HelloWorld) +{ + + ReturnCode_t return_code_HelloWorld {eprosima::fastdds::dds::RETCODE_OK}; + return_code_HelloWorld = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "HelloWorld", type_ids_HelloWorld); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_HelloWorld) + { + StructTypeFlag struct_flags_HelloWorld = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_HelloWorld = "HelloWorld"; + eprosima::fastcdr::optional type_ann_builtin_HelloWorld; + eprosima::fastcdr::optional ann_custom_HelloWorld; + CompleteTypeDetail detail_HelloWorld = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_HelloWorld, ann_custom_HelloWorld, type_name_HelloWorld.to_string()); + CompleteStructHeader header_HelloWorld; + header_HelloWorld = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_HelloWorld); + CompleteStructMemberSeq member_seq_HelloWorld; + { + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_index); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_index = 0x00000000; + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_HelloWorld.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_HelloWorld); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_index); + } + { + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_char_20", type_ids_message); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) + { + return_code_message = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_char", type_ids_message); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_char_20_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_char_20 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, element_identifier_anonymous_array_char_20_ec))}; + if (!element_identifier_anonymous_array_char_20_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_char_20 = EK_COMPLETE; + if (TK_NONE == type_ids_message.type_identifier2()._d()) + { + equiv_kind_anonymous_array_char_20 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_char_20 = 0; + PlainCollectionHeader header_anonymous_array_char_20 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_char_20, element_flags_anonymous_array_char_20); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(20)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_char_20, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_char_20)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_char_20", type_ids_message)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_char_20 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_message = 0x00000001; + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_HelloWorld.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_HelloWorld); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_message); + } + CompleteStructType struct_type_HelloWorld = TypeObjectUtils::build_complete_struct_type(struct_flags_HelloWorld, header_HelloWorld, member_seq_HelloWorld); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_HelloWorld, type_name_HelloWorld.to_string(), type_ids_HelloWorld)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "HelloWorld already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.hpp b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.hpp new file mode 100644 index 00000000..ec922163 --- /dev/null +++ b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/HelloWorldTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldTypeObjectSupport.hpp + * Header file containing the API required to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP + +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register HelloWorld related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_HelloWorld_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.cxx deleted file mode 100644 index 42283dee..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.cxx +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.cpp - * This source file contains the definition of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "HelloWorld.h" -#include - -#include -using namespace eprosima::fastcdr::exception; - -#include - -#define HelloWorld_max_cdr_typesize 24ULL; -#define HelloWorld_max_key_cdr_typesize 0ULL; - -HelloWorld::HelloWorld() -{ - // unsigned long m_index - m_index = 0; - // char m_message - memset(&m_message, 0, (20) * 1); - -} - -HelloWorld::~HelloWorld() -{ - - -} - -HelloWorld::HelloWorld( - const HelloWorld& x) -{ - m_index = x.m_index; - m_message = x.m_message; -} - -HelloWorld::HelloWorld( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - m_message = std::move(x.m_message); -} - -HelloWorld& HelloWorld::operator =( - const HelloWorld& x) -{ - - m_index = x.m_index; - m_message = x.m_message; - - return *this; -} - -HelloWorld& HelloWorld::operator =( - HelloWorld&& x) noexcept -{ - - m_index = x.m_index; - m_message = std::move(x.m_message); - - return *this; -} - -bool HelloWorld::operator ==( - const HelloWorld& x) const -{ - - return (m_index == x.m_index && m_message == x.m_message); -} - -bool HelloWorld::operator !=( - const HelloWorld& x) const -{ - return !(*this == x); -} - -size_t HelloWorld::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return HelloWorld_max_cdr_typesize; -} - -size_t HelloWorld::getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += ((20) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - return current_alignment - initial_alignment; -} - -void HelloWorld::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - - scdr << m_index; - scdr << m_message; - - -} - -void HelloWorld::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - - dcdr >> m_index; - dcdr >> m_message; - -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void HelloWorld::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t HelloWorld::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& HelloWorld::index() -{ - return m_index; -} - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void HelloWorld::message( - const std::array& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void HelloWorld::message( - std::array&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::array& HelloWorld::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::array& HelloWorld::message() -{ - return m_message; -} - -size_t HelloWorld::getKeyMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return HelloWorld_max_key_cdr_typesize; -} - -bool HelloWorld::isKeyDefined() -{ - return false; -} - -void HelloWorld::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.h deleted file mode 100644 index 8c2988e5..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorld.h +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool gen. - */ - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(HELLOWORLD_SOURCE) -#define HELLOWORLD_DllAPI __declspec( dllexport ) -#else -#define HELLOWORLD_DllAPI __declspec( dllimport ) -#endif // HELLOWORLD_SOURCE -#else -#define HELLOWORLD_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define HELLOWORLD_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - -/*! - * @brief This class represents the structure HelloWorld defined by the user in the IDL file. - * @ingroup HelloWorld - */ -class HelloWorld -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport HelloWorld(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~HelloWorld(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - const HelloWorld& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - HelloWorld&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - const HelloWorld& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - HelloWorld&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator ==( - const HelloWorld& x) const; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator !=( - const HelloWorld& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::array& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::array&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::array& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::array& message(); - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment = 0); - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - /*! - * @brief This function returns the maximum serialized size of the Key of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - -private: - - uint32_t m_index; - std::array m_message; - -}; - -#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.cxx deleted file mode 100644 index df22dd59..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.cxx +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorldPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#include -#include - -#include "HelloWorldPubSubTypes.h" - -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; - -HelloWorldPubSubType::HelloWorldPubSubType() -{ - setName("HelloWorld"); - auto type_size = HelloWorld::getMaxCdrSerializedSize(); - type_size += eprosima::fastcdr::Cdr::alignment(type_size, 4); /* possible submessage alignment */ - m_typeSize = static_cast(type_size) + 4; /*encapsulation*/ - m_isGetKeyDefined = HelloWorld::isKeyDefined(); - size_t keyLength = HelloWorld::getKeyMaxCdrSerializedSize() > 16 ? - HelloWorld::getKeyMaxCdrSerializedSize() : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); -} - -HelloWorldPubSubType::~HelloWorldPubSubType() -{ - if (m_keyBuffer != nullptr) - { - free(m_keyBuffer); - } -} - -bool HelloWorldPubSubType::serialize( - void* data, - SerializedPayload_t* payload) -{ - HelloWorld* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, eprosima::fastcdr::Cdr::DDS_CDR); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - p_type->serialize(ser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload->length = static_cast(ser.getSerializedDataLength()); - return true; -} - -bool HelloWorldPubSubType::deserialize( - SerializedPayload_t* payload, - void* data) -{ - try - { - // Convert DATA to pointer of your type - HelloWorld* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); - - // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, - eprosima::fastcdr::Cdr::DDS_CDR); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - p_type->deserialize(deser); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; -} - -std::function HelloWorldPubSubType::getSerializedSizeProvider( - void* data) -{ - return [data]() -> uint32_t - { - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - }; -} - -void* HelloWorldPubSubType::createData() -{ - return reinterpret_cast(new HelloWorld()); -} - -void HelloWorldPubSubType::deleteData( - void* data) -{ - delete(reinterpret_cast(data)); -} - -bool HelloWorldPubSubType::getKey( - void* data, - InstanceHandle_t* handle, - bool force_md5) -{ - if (!m_isGetKeyDefined) - { - return false; - } - - HelloWorld* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), - HelloWorld::getKeyMaxCdrSerializedSize()); - - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS); - p_type->serializeKey(ser); - if (force_md5 || HelloWorld::getKeyMaxCdrSerializedSize() > 16) - { - m_md5.init(); - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - m_md5.finalize(); - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_md5.digest[i]; - } - } - else - { - for (uint8_t i = 0; i < 16; ++i) - { - handle->value[i] = m_keyBuffer[i]; - } - } - return true; -} diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.h deleted file mode 100644 index d7b5d31d..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v1/HelloWorldPubSubTypes.h +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorldPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastcdrgen. - */ - - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ - -#include -#include - -#include "HelloWorld.h" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 1) -#error \ - Generated HelloWorld is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - -#ifndef SWIG -namespace detail { - -template -struct HelloWorld_rob -{ - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - -}; - -struct HelloWorld_f -{ - typedef std::array HelloWorld::* type; - friend constexpr type get( - HelloWorld_f); -}; - -template struct HelloWorld_rob; - -template -inline size_t constexpr HelloWorld_offset_of() -{ - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); -} - -} // namespace detail -#endif // ifndef SWIG - -/*! - * @brief This class represents the TopicDataType of the type HelloWorld defined by the user in the IDL file. - * @ingroup HelloWorld - */ -class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - - typedef HelloWorld type; - - eProsima_user_DllExport HelloWorldPubSubType(); - - eProsima_user_DllExport virtual ~HelloWorldPubSubType() override; - - eProsima_user_DllExport virtual bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override; - - eProsima_user_DllExport virtual bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport virtual std::function getSerializedSizeProvider( - void* data) override; - - eProsima_user_DllExport virtual bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport virtual void* createData() override; - - eProsima_user_DllExport virtual void deleteData( - void* data) override; - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - -#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_impl(); - } - -#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - -#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) HelloWorld(); - return true; - } - -#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - -private: - - static constexpr bool is_plain_impl() - { - return 24ULL == - (detail::HelloWorld_offset_of() + sizeof(std::array)); - - } - -}; - -#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.cxx deleted file mode 100644 index 0d9236d0..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.cxx +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "HelloWorld.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -HelloWorld::HelloWorld() -{ -} - -HelloWorld::~HelloWorld() -{ -} - -HelloWorld::HelloWorld( - const HelloWorld& x) -{ - m_index = x.m_index; - m_message = x.m_message; -} - -HelloWorld::HelloWorld( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - m_message = std::move(x.m_message); -} - -HelloWorld& HelloWorld::operator =( - const HelloWorld& x) -{ - - m_index = x.m_index; - m_message = x.m_message; - return *this; -} - -HelloWorld& HelloWorld::operator =( - HelloWorld&& x) noexcept -{ - - m_index = x.m_index; - m_message = std::move(x.m_message); - return *this; -} - -bool HelloWorld::operator ==( - const HelloWorld& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool HelloWorld::operator !=( - const HelloWorld& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void HelloWorld::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t HelloWorld::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& HelloWorld::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void HelloWorld::message( - const std::array& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void HelloWorld::message( - std::array&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::array& HelloWorld::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::array& HelloWorld::message() -{ - return m_message; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "HelloWorldCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.idl b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.idl deleted file mode 100644 index 9750fbe1..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorld.idl +++ /dev/null @@ -1,5 +0,0 @@ -struct HelloWorld -{ - unsigned long index; - char message[20]; -}; diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.cxx b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.cxx deleted file mode 100644 index 3b9a562b..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.cxx +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "HelloWorld.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define HelloWorld_max_cdr_typesize 28ULL; - - - - -HelloWorld::HelloWorld() -{ - // unsigned long m_index - m_index = 0; - // char m_message - memset(&m_message, 0, ((20)) * 1); - -} - -HelloWorld::~HelloWorld() -{ -} - -HelloWorld::HelloWorld( - const HelloWorld& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - -} - -HelloWorld::HelloWorld( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - -} - -HelloWorld& HelloWorld::operator =( - const HelloWorld& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - - return *this; -} - -HelloWorld& HelloWorld::operator =( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - - return *this; -} - -bool HelloWorld::operator ==( - const HelloWorld& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool HelloWorld::operator !=( - const HelloWorld& x) const -{ - return !(*this == x); -} - -size_t HelloWorld::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return HelloWorld_max_cdr_typesize; -} - -size_t HelloWorld::getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += (((20)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void HelloWorld::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << m_message; - - -} - -void HelloWorld::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - dcdr >> m_message; - - -} - - -bool HelloWorld::isKeyDefined() -{ - return false; -} - -void HelloWorld::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void HelloWorld::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t HelloWorld::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& HelloWorld::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void HelloWorld::message( - const std::array& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void HelloWorld::message( - std::array&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::array& HelloWorld::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::array& HelloWorld::message() -{ - return m_message; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.h b/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.h deleted file mode 100644 index 4d6e4158..00000000 --- a/fastddsspy_tool/test/application/dds/AdvancedConfigurationExample/types/v2/HelloWorldv1.h +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_H_ - - -#include - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(HELLOWORLD_SOURCE) -#define HELLOWORLD_DllAPI __declspec( dllexport ) -#else -#define HELLOWORLD_DllAPI __declspec( dllimport ) -#endif // HELLOWORLD_SOURCE -#else -#define HELLOWORLD_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define HELLOWORLD_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure HelloWorld defined by the user in the IDL file. - * @ingroup HelloWorld - */ -class HelloWorld -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport HelloWorld(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~HelloWorld(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - const HelloWorld& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - HelloWorld&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - const HelloWorld& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - HelloWorld&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator ==( - const HelloWorld& x) const; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator !=( - const HelloWorld& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::array& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::array&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::array& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::array& message(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - std::array m_message; - -}; - - -#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/fastddsspy_tool/test/application/test_cases/one_shot_topics_name_dds.py b/fastddsspy_tool/test/application/test_cases/one_shot_topics_name_dds.py index a019c48a..a4a2f557 100644 --- a/fastddsspy_tool/test/application/test_cases/one_shot_topics_name_dds.py +++ b/fastddsspy_tool/test/application/test_cases/one_shot_topics_name_dds.py @@ -44,5 +44,5 @@ def __init__(self): datawriters:\n\ - %%guid%%\n\ rate: %%rate%%\n\ -dynamic_type_discovered: false\n""" +dynamic_type_discovered: true\n""" ) diff --git a/fastddsspy_tool/test/application/test_cases/one_shot_topics_verbose_dds.py b/fastddsspy_tool/test/application/test_cases/one_shot_topics_verbose_dds.py index b3af2276..9837d190 100644 --- a/fastddsspy_tool/test/application/test_cases/one_shot_topics_verbose_dds.py +++ b/fastddsspy_tool/test/application/test_cases/one_shot_topics_verbose_dds.py @@ -44,5 +44,5 @@ def __init__(self): datawriters:\n\ - %%guid%%\n\ rate: %%rate%%\n\ - dynamic_type_discovered: false\n""" + dynamic_type_discovered: true\n""" ) diff --git a/fastddsspy_tool/test/application/test_cases/tool_show_topic_dds.py b/fastddsspy_tool/test/application/test_cases/tool_show_topic_dds.py deleted file mode 100644 index 02b46779..00000000 --- a/fastddsspy_tool/test/application/test_cases/tool_show_topic_dds.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Tests for the fastddsspy executable.""" - -import test_class - - -class TestCase_instance (test_class.TestCase): - """@brief A subclass of `test_class.TestCase` representing a specific test case.""" - - def __init__(self): - """ - @brief Initialize the TestCase_instance object. - - This test launch: - fastddsspy --config-path fastddsspy_tool/test/application/configuration/\ - configuration_discovery_time.yaml - >> show HelloWorldTopic - AdvancedConfigurationExample publisher - """ - super().__init__( - name='ToolShowTopicDDSCommand', - one_shot=False, - command=[], - dds=True, - config='fastddsspy_tool/test/application/configuration/\ -configuration_discovery_time.yaml', - arguments_dds=[], - arguments_spy=['--config-path', 'configuration'], - commands_spy=['show HelloWorldTopic'], - output=""">> \x1b[0m\x1b[1;31mTopic Type has not \ -been discovered, and thus cannot print its data.\x1b[0m\n\n\n""" - ) diff --git a/fastddsspy_yaml/project_settings.cmake b/fastddsspy_yaml/project_settings.cmake index c8540d1d..3b024885 100644 --- a/fastddsspy_yaml/project_settings.cmake +++ b/fastddsspy_yaml/project_settings.cmake @@ -25,7 +25,7 @@ set(MODULE_SUMMARY set(MODULE_FIND_PACKAGES yaml-cpp fastcdr - fastrtps + fastdds cpp_utils ddspipe_core ddspipe_participants diff --git a/fastddsspy_yaml/src/cpp/YamlReaderConfiguration.cpp b/fastddsspy_yaml/src/cpp/YamlReaderConfiguration.cpp index dc13a66c..9ba0a87b 100644 --- a/fastddsspy_yaml/src/cpp/YamlReaderConfiguration.cpp +++ b/fastddsspy_yaml/src/cpp/YamlReaderConfiguration.cpp @@ -177,7 +177,7 @@ void Configuration::load_dds_configuration_( // Get optional whitelist interfaces if (YamlReader::is_tag_present(yml, WHITELIST_INTERFACES_TAG)) { - simple_configuration->whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, + simple_configuration->whitelist = YamlReader::get_set(yml, WHITELIST_INTERFACES_TAG, version); } From a1d7b73db8d91cb269bce37b713058d58c1eec5c Mon Sep 17 00:00:00 2001 From: LuciaEchevarria99 <110391668+LuciaEchevarria99@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:21:23 +0200 Subject: [PATCH 4/8] Enable CI for Fast DDS Spy v3 (#94) Signed-off-by: Lucia Echevarria --- .github/workflows/nightly.yml | 18 +++++++++--------- .github/workflows/reusable-workflow.yml | 13 +++++++++++++ .github/workflows/test.yml | 3 ++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5bff5b40..4b83ef57 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,14 +13,14 @@ jobs: with: custom_version_build: 'v2' dependencies_artifact_postfix: '_nightly' + ref: '2.x' secrets: inherit - # Uncomment this block to run the tests for Fast DDS v3 when Fast DDS Spy is updated - # Also specify here (and above) the workflow version/branch to use (@v0, @main, etc.) - # reusable_tests_v3: - # name: reusable_tests_v3 - # uses: ./.github/workflows/reusable-workflow.yml - # with: - # custom_version_build: 'v3' - # dependencies_artifact_postfix: '_nightly' - # secrets: inherit + reusable_tests_v3: + name: reusable_tests_v3 + uses: ./.github/workflows/reusable-workflow.yml + with: + custom_version_build: 'v3' + dependencies_artifact_postfix: '_nightly' + ref: 'main' + secrets: inherit diff --git a/.github/workflows/reusable-workflow.yml b/.github/workflows/reusable-workflow.yml index ef99c429..ef5a5f55 100644 --- a/.github/workflows/reusable-workflow.yml +++ b/.github/workflows/reusable-workflow.yml @@ -53,6 +53,13 @@ on: default: '_nightly' type: string + ref: + description: > + The branch or tag name to checkout. + required: true + type: string + default: 'main' + env: code_packages_names: 'fastddsspy_participants fastddsspy_yaml fastddsspy_tool' docs_packages_names: 'fastddsspy_docs' @@ -83,6 +90,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies @@ -114,6 +122,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies @@ -142,6 +151,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies @@ -170,6 +180,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies @@ -200,6 +211,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies @@ -230,6 +242,7 @@ jobs: uses: eProsima/eProsima-CI/external/checkout@v0 with: path: src + ref: ${{ inputs.ref }} - name: Download dependencies and install requirements uses: ./src/.github/actions/project_dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec72cf67..c5f00a6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,7 @@ jobs: name: reusable_tests uses: ./.github/workflows/reusable-workflow.yml with: - custom_version_build: ${{ inputs.custom_version_build || 'v2' }} + custom_version_build: ${{ inputs.custom_version_build || 'v3' }} dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix || '_nightly' }} + ref: ${{ github.ref }} secrets: inherit From 6d77cb1572dbb85c6a2b45484962e9699a46311f Mon Sep 17 00:00:00 2001 From: Irene Bandera Moreno Date: Mon, 16 Sep 2024 17:29:06 +0200 Subject: [PATCH 5/8] Bump version to v1.0.0 & add release notes (#96) * Add v1.0.0 release notes Signed-off-by: Irene Bandera * Bump version to v1.0.0 Signed-off-by: Irene Bandera --------- Signed-off-by: Irene Bandera --- VERSION | 4 +- docs/package.xml | 2 +- docs/rst/installation/docker.rst | 2 +- docs/rst/notes/forthcoming_version.rst | 11 +---- docs/rst/notes/notes.rst | 27 ++++++++----- docs/rst/notes/previous_versions/v0.4.0.rst | 40 +++++++++++++++++++ fastddsspy_participants/package.xml | 2 +- fastddsspy_tool/package.xml | 2 +- .../test_cases/one_shot__version.py | 2 +- fastddsspy_yaml/package.xml | 2 +- 10 files changed, 67 insertions(+), 27 deletions(-) create mode 100644 docs/rst/notes/previous_versions/v0.4.0.rst diff --git a/VERSION b/VERSION index 78647b45..8c5090ac 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ -VERSION_MAJOR 0 -VERSION_MINOR 4 +VERSION_MAJOR 1 +VERSION_MINOR 0 VERSION_PATCH 0 diff --git a/docs/package.xml b/docs/package.xml index a747e1e5..f3b2d5e7 100644 --- a/docs/package.xml +++ b/docs/package.xml @@ -2,7 +2,7 @@ fastddsspy_docs - 0.4.0 + 1.0.0 *eprosima Fast DDS Spy* Documentation built with sphinx and deployed in ReadTheDocs. diff --git a/docs/rst/installation/docker.rst b/docs/rst/installation/docker.rst index bb7fbe08..9fa30bc1 100644 --- a/docs/rst/installation/docker.rst +++ b/docs/rst/installation/docker.rst @@ -48,7 +48,7 @@ The steps to run |spy| in a Docker container are explained below. --ipc=host \ --privileged \ -v //FASTDDSSPY_CONFIGURATION.yaml:/root/FASTDDSSPY_CONFIGURATION.yaml \ - ubuntu-fastddsspy:v0.4.0 + ubuntu-fastddsspy:v1.0.0 It is important to mention that both the path to the configuration file hosted in the local machine and the one created in the Docker container must be absolute paths in order to share just one single file as a shared volume. diff --git a/docs/rst/notes/forthcoming_version.rst b/docs/rst/notes/forthcoming_version.rst index 36dced7e..5cd65f07 100644 --- a/docs/rst/notes/forthcoming_version.rst +++ b/docs/rst/notes/forthcoming_version.rst @@ -1,17 +1,8 @@ .. add orphan tag when new info added to this file -.. :orphan: +:orphan: ################### Forthcoming Version ################### - -This release includes the following **CI improvements**: - -* Upgrade to Ubuntu Noble (24.04). -* Remove Ubuntu Focal (20.04) from the CI. - -This release includes the following **Configuration Features**: - -* New :ref:`domain argument ` to configure the ``domain`` through the command-line. diff --git a/docs/rst/notes/notes.rst b/docs/rst/notes/notes.rst index e09a768c..b3b3970d 100644 --- a/docs/rst/notes/notes.rst +++ b/docs/rst/notes/notes.rst @@ -2,19 +2,27 @@ .. _notes: -.. include:: forthcoming_version.rst +.. .. include:: forthcoming_version.rst ############## -Version v0.4.0 +Version v1.0.0 ############## +This release includes the following **Features**: + +* Add support for Fast DDS v3. + This release includes the following **Configuration Features**: -* New configuration option ``logging`` to configure the :ref:`Logs `. +* New :ref:`domain argument ` to configure the ``domain`` through the command-line. +* Change default log filter to ``FASTDDSSPY``. +* Change default log verbosity to ``error``. -This release includes the following **Documentation Updates**: +This release includes the following **CI improvements**: -* Add a new :ref:`Logging ` section to the :ref:`Configuration ` page. +* Upgrade to Ubuntu Noble (24.04). +* Remove Ubuntu Focal (20.04) from the CI. +* Empty XTSAN tests list to run all tests with Thread Sanitizer. This release includes the following **Dependencies Update**: @@ -31,26 +39,27 @@ This release includes the following **Dependencies Update**: - `v1.3.1 `_ * - Fast CDR - `eProsima/Fast-CDR `_ - - `v2.1.3 `_ - `v2.2.0 `_ + - `v2.2.4 `_ * - Fast DDS - `eProsima/Fast-DDS `_ - - `v2.13.1 `_ - `v2.14.0 `_ + - `v3.0.1 `_ * - Dev Utils - `eProsima/dev-utils `_ - - `v0.5.0 `_ - `v0.6.0 `_ + - `v1.0.0 `_ * - DDS Pipe - `eProsima/DDS-Pipe `_ - - `v0.3.0 `_ - `v0.4.0 `_ + - `v1.0.0 `_ ################# Previous Versions ################# +.. include:: ./previous_versions/v0.4.0.rst .. include:: ./previous_versions/v0.3.0.rst .. include:: ./previous_versions/v0.2.0.rst .. include:: ./previous_versions/v0.1.0.rst diff --git a/docs/rst/notes/previous_versions/v0.4.0.rst b/docs/rst/notes/previous_versions/v0.4.0.rst new file mode 100644 index 00000000..aa9b4320 --- /dev/null +++ b/docs/rst/notes/previous_versions/v0.4.0.rst @@ -0,0 +1,40 @@ +Version v0.4.0 +============== + +This release includes the following **Configuration Features**: + +* New configuration option ``logging`` to configure the :ref:`Logs `. + +This release includes the following **Documentation Updates**: + +* Add a new :ref:`Logging ` section to the :ref:`Configuration ` page. + +This release includes the following **Dependencies Update**: + +.. list-table:: + :header-rows: 1 + + * - + - Repository + - Old Version + - New Version + * - Foonathan Memory Vendor + - `eProsima/foonathan_memory_vendor `_ + - `v1.3.1 `_ + - `v1.3.1 `_ + * - Fast CDR + - `eProsima/Fast-CDR `_ + - `v2.1.3 `_ + - `v2.2.0 `_ + * - Fast DDS + - `eProsima/Fast-DDS `_ + - `v2.13.1 `_ + - `v2.14.0 `_ + * - Dev Utils + - `eProsima/dev-utils `_ + - `v0.5.0 `_ + - `v0.6.0 `_ + * - DDS Pipe + - `eProsima/DDS-Pipe `_ + - `v0.3.0 `_ + - `v0.4.0 `_ diff --git a/fastddsspy_participants/package.xml b/fastddsspy_participants/package.xml index 7c296439..8eb67898 100644 --- a/fastddsspy_participants/package.xml +++ b/fastddsspy_participants/package.xml @@ -2,7 +2,7 @@ fastddsspy_participants - 0.4.0 + 1.0.0 *eProsima Fast DDS Spy* core logic. diff --git a/fastddsspy_tool/package.xml b/fastddsspy_tool/package.xml index 09f7d3d0..c7f3ff7f 100644 --- a/fastddsspy_tool/package.xml +++ b/fastddsspy_tool/package.xml @@ -2,7 +2,7 @@ fastddsspy_tool - 0.4.0 + 1.0.0 *eProsima Fast DDS Spy* Application to execute a interactive CLI spy application to introspect data in a DDS network. diff --git a/fastddsspy_tool/test/application/test_cases/one_shot__version.py b/fastddsspy_tool/test/application/test_cases/one_shot__version.py index dd23e9b6..08a798ae 100644 --- a/fastddsspy_tool/test/application/test_cases/one_shot__version.py +++ b/fastddsspy_tool/test/application/test_cases/one_shot__version.py @@ -36,7 +36,7 @@ def __init__(self): arguments_dds=[], arguments_spy=['--version'], commands_spy=[], - output="""Fast DDS Spy v0.4.0\ + output="""Fast DDS Spy v1.0.0\ commit hash: 16ed7e8c93d7481d8b426746af9ec3ffa323f451\n""" ) diff --git a/fastddsspy_yaml/package.xml b/fastddsspy_yaml/package.xml index 4576b20a..5d108a8e 100644 --- a/fastddsspy_yaml/package.xml +++ b/fastddsspy_yaml/package.xml @@ -2,7 +2,7 @@ fastddsspy_yaml - 0.4.0 + 1.0.0 *eprosima Fast DDS Spy* Yaml Module to read and print yaml objects. From 113b03cb08a54a30e1c200d475f862a2959d2c18 Mon Sep 17 00:00:00 2001 From: Raul Sanchez-Mateos Lizano Date: Tue, 17 Sep 2024 08:26:08 +0200 Subject: [PATCH 6/8] Add mirror workflow (#97) * Add mirror workflow Signed-off-by: Raul Sanchez-Mateos * Fix duplicated names Signed-off-by: Raul Sanchez-Mateos --------- Signed-off-by: Raul Sanchez-Mateos --- .github/workflows/mirror.yml | 25 +++++++++++++++++++++++++ .github/workflows/reusable-workflow.yml | 19 +++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/mirror.yml diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 00000000..a7084655 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,25 @@ +name: mirror-branch + +on: + push: + branches: + - 'main' + +jobs: + mirror_job_main: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + name: Mirror main branch to API & ABI compatible minor version branches + strategy: + fail-fast: false + matrix: + dest_branch: + - '1.x' + steps: + - name: Mirror action step + id: mirror + uses: eProsima/eProsima-CI/external/mirror-branch-action@v0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + source: 'main' + dest: ${{ matrix.dest_branch }} diff --git a/.github/workflows/reusable-workflow.yml b/.github/workflows/reusable-workflow.yml index ef5a5f55..ddb67040 100644 --- a/.github/workflows/reusable-workflow.yml +++ b/.github/workflows/reusable-workflow.yml @@ -109,6 +109,7 @@ jobs: workspace_dependencies: './install' ctest_args: --label-exclude "xfail" colcon_meta_file: ./src/.github/workflows/configurations/${{ runner.os }}/colcon.meta + test_report_artifact: test_report${{ inputs.dependencies_artifact_postfix }}_${{ inputs.custom_version_build }}_${{ matrix.os }}_${{ matrix.cmake_build_type }} ##################################################################### @@ -134,10 +135,14 @@ jobs: secret_token: ${{ secrets.GITHUB_TOKEN }} - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/asan_build_test@v0 + uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@v0 with: packages_names: ${{ env.code_packages_names }} + cmake_args: -DBUILD_TESTS=ON -DASAN_BUILD=ON + ctest_args: --label-exclude "xfail|xasan" workspace_dependencies: './install' + cmake_build_type: Debug + test_report_artifact: test_report${{ inputs.dependencies_artifact_postfix }}_${{ inputs.custom_version_build }}_${{ matrix.os }}_${{ matrix.cmake_build_type }} ##################################################################### @@ -163,10 +168,19 @@ jobs: secret_token: ${{ secrets.GITHUB_TOKEN }} - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/tsan_build_test@v0 + uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@v0 + env: + # GCC 11.3 (Ubuntu Jammy default) produces several false positives regarding timed synchronization protocols + # These issues were fixed in GCC 12 so we upgrade to that version. + CC: gcc-12 + CXX: g++-12 with: packages_names: ${{ env.code_packages_names }} + cmake_args: -DBUILD_TESTS=ON -DTSAN_BUILD=ON + ctest_args: --label-exclude "xfail|xtsan" workspace_dependencies: './install' + cmake_build_type: Debug + test_report_artifact: test_report_tsan${{ inputs.dependencies_artifact_postfix }}_${{ inputs.custom_version_build }} ##################################################################### @@ -229,6 +243,7 @@ jobs: workspace_dependencies: './install' codecov_token: ${{ secrets.CODECOV_TOKEN }} codecov_fix_file_path: ./src/codecov.yml + test_report_artifact: test_report_coverage${{ inputs.dependencies_artifact_postfix }}_${{ inputs.custom_version_build }} ##################################################################### From 164850d3ff0a6b12b97529402e728eaaa451e33c Mon Sep 17 00:00:00 2001 From: juanlofer-eprosima <88179026+juanlofer-eprosima@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:39:44 +0200 Subject: [PATCH 7/8] Update branches in .repos (#98) Signed-off-by: Juan Lopez Fernandez --- fastddsspy.repos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastddsspy.repos b/fastddsspy.repos index 131ba3b1..058cebf2 100644 --- a/fastddsspy.repos +++ b/fastddsspy.repos @@ -10,15 +10,15 @@ repositories: fastdds: type: git url: https://github.com/eProsima/Fast-DDS.git - version: bugfix/complex-dynamic-types-2.14 + version: 3.x dev-utils: type: git url: https://github.com/eProsima/dev-utils.git - version: 0.x + version: 1.x ddspipe: type: git url: https://github.com/eProsima/DDS-Pipe.git - version: main + version: 1.x fastddsspy: type: git url: https://github.com/eProsima/Fast-DDS-spy.git From 600a397e424fe37505b3d11c4270ad96e2f9e907 Mon Sep 17 00:00:00 2001 From: Raul Sanchez-Mateos Lizano Date: Thu, 3 Oct 2024 10:17:41 +0200 Subject: [PATCH 8/8] Use right reference for nightly jobs (#100) Signed-off-by: Raul Sanchez-Mateos --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4b83ef57..e2a0da2c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,7 +13,7 @@ jobs: with: custom_version_build: 'v2' dependencies_artifact_postfix: '_nightly' - ref: '2.x' + ref: '0.x' secrets: inherit reusable_tests_v3: