From 4d5e24d383f009c06cf767f7ad7dfbb0c75e139b Mon Sep 17 00:00:00 2001 From: Irene Bandera Date: Tue, 20 Aug 2024 14:58:29 +0200 Subject: [PATCH] Refactor participants destructors to use delete_contained_entities() Signed-off-by: Irene Bandera --- .../dds/types/test_participants.hpp | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp index e2d806b79..7a1dba444 100644 --- a/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp +++ b/ddsrouter_core/test/blackbox/ddsrouter_core/dds/types/test_participants.hpp @@ -77,18 +77,7 @@ class TestPublisher { if (participant_ != nullptr) { - if (publisher_ != nullptr) - { - if (writer_ != nullptr) - { - publisher_->delete_datawriter(writer_); - } - participant_->delete_publisher(publisher_); - } - if (topic_ != nullptr) - { - participant_->delete_topic(topic_); - } + participant_->delete_contained_entities(); eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); } } @@ -281,18 +270,7 @@ class TestSubscriber { if (participant_ != nullptr) { - if (topic_ != nullptr) - { - participant_->delete_topic(topic_); - } - if (subscriber_ != nullptr) - { - if (reader_ != nullptr) - { - subscriber_->delete_datareader(reader_); - } - participant_->delete_subscriber(subscriber_); - } + participant_->delete_contained_entities(); eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); } }