Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/DDS/DDSConnector/subscriber.cpp
T
berrux-dev 156c2dfcdc Restore legacy @RDE_HEADER@ comment blocks stripped by the Qt6 migration
The migration pipeline dropped the leading @RDE_HEADER@ comment blocks
from 243 target source files (and 2 cmake macros). Restore them
byte-for-byte from the legacy Qt5 tree
(qt5-before/qt5-legatus-legacy): the exact legacy header is re-inserted
at the top of each file (block-comment, '#'-style, line-comment '//'
styles, BOM and surrounding blank lines included). File bodies are
untouched.

Scope: all in-scope target code, unit-test directories excluded.
190 files already kept their legacy header through the migration and
were left as-is; legacy files without an RDE header were not given
one. Special cases: 3 headers sitting after a '#pragma once' line,
1 BOM-prefixed file, 4 '//'-style TetraIF headers. *.grantlee template
files were not in scope and remain untouched.

Verified: every restored file is byte-exact (legacy preamble + original
body) and the ctest baseline is unchanged (20/23 passed, 3 Not Run as
before).
2026-11-15 23:22:04 +01:00

83 lines
2.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
*
* Subscriber (DDSConnector)
* Uses DTCs/DDTCs to subscribe to data
*
* $Id$
* $HeadURL$
* $Author$
*/
#include "subscriber.h"
#include "pub_sub_base_p.h"
#include <Lts/DDS/QosProfile/DDS_DefaultQos.h>
#include <NGLLogger/INGLLogger.h>
namespace DDSConnector
{
Subscriber::Subscriber(const dds::domain::DomainParticipant &domainParticipant, const std::string &partition, bool bUseSubscriberListener)
: PubSubBase(domainParticipant, partition, "DDSConnector.Subscriber")
, m_ddsSubscriber(nullptr)
, m_subscriberListener(bUseSubscriberListener ? new DDSGeneric::SubscriberListener : nullptr)
, m_subscriberListenerBinder(nullptr)
{
Q_ASSERT(domainParticipant != nullptr);
initDDS();
}
Subscriber::~Subscriber()
{
try
{
deleteDDS();
} catch (...)
{}
}
void Subscriber::initDDS()
{
if (m_partitions.empty())
return;
if (m_logger.isDebugEnabled()) {
DEBUG_LOG(m_logger) << "Subscriber (DataReader) Qos: ";
dds::core::QosProvider qosProvider = dds::core::QosProvider::Default();
DDS::QosProfile::print(qosProvider.datareader_qos(), m_logger);
}
dds::sub::qos::SubscriberQos subscriberQos = m_domainParticipant.default_subscriber_qos();
rti::core::policy::EntityName entityName;
entityName.name(std::string("Sub ") + m_partitions.front());
subscriberQos << entityName;
DEBUG_LOG(m_logger) << "Subscribe on partition " << m_partitions.front();
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipant,
subscriberQos);
if (m_subscriberListener)
m_subscriberListenerBinder = rti::core::bind_and_manage_listener(m_ddsSubscriber,
m_subscriberListener,
DDSGeneric::SubscriberListener::mask());
updatePartitionQoS(m_ddsSubscriber);
}
void Subscriber::deleteDDS()
{
if (m_subscriberListener)
{
m_subscriberListener->prepareShutdown();
m_subscriberListener = nullptr;
}
m_subscriberListenerBinder = nullptr;
m_ddsSubscriber = nullptr;
}
}