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); }