Adds immediate migration results in progress

This commit is contained in:
torsten committed 2026-08-19 11:18:24 +02:00
1 parent 8453e104c5
commit 3bb6e89496
2102 files changed
+17482 -15071

No files matched your search

@@ -53,19 +53,19 @@ public:
const std::string &specialTopicName,
const StructType &structType)
{
DEBUG_LOG() << "IN DynamicDataReader::create ("
DEBUG_LOG(m_logger) << "IN DynamicDataReader::create ("
<< m_structType->name()
<< ")";
if (domainParticipant == nullptr)
{
ERROR_LOG() << "DomainParticipant does not exist ";
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< m_structType->name()
<< "' already created";
return false;
@@ -84,7 +84,7 @@ public:
DDS::Helper::getShortTopicName(m_structType->name()) :
specialTopicName;
DEBUG_LOG() << "Creating topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating topic " << topicName << " with type: "
<< m_structType->name();
m_ddsTopic = dds::topic::find<dds::topic::Topic<DynamicData>>(domainParticipant, topicName);
@@ -97,16 +97,16 @@ public:
m_ddsTopic = dds::topic::Topic<DynamicData>(domainParticipant, topicName, structType);
}
DEBUG_LOG() << "m_ddsTopic created: " << m_ddsTopic.name();
DEBUG_LOG(m_logger) << "m_ddsTopic created: " << m_ddsTopic.name();
if (m_logger.isDebugEnabled())
{
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
dds::core::StringSeq parititionNames = partition.name();
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
for (const std::string &name : parititionNames)
DEBUG_LOG() << "SubscriberQoS: partition name = " << name;
DEBUG_LOG(m_logger) << "SubscriberQoS: partition name = " << name;
}
dds::sub::qos::DataReaderQos dataReaderQos = ddsSubscriber.default_datareader_qos();
@@ -129,7 +129,7 @@ public:
if (m_dataReader == nullptr)
{
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
<< m_structType->name()
<< "' failed";
return false;
@@ -138,11 +138,11 @@ public:
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataReader created ("
DEBUG_LOG(m_logger) << "dataReader created ("
<< m_structType->name()
<< ")";
@@ -153,7 +153,7 @@ public:
bool hasSamples() const
{
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
DEBUG_LOG() << "sampleSize = " << sampleSize;
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
return sampleSize > 0;
}
@@ -162,7 +162,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -175,7 +175,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -187,7 +187,7 @@ public:
{
dds::sub::LoanedSamples<DynamicData> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
return samples;
@@ -196,18 +196,18 @@ public:
template<typename C>
bool read(C callbackFunc)
{
DEBUG_LOG() << "IN read ("
DEBUG_LOG(m_logger) << "IN read ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
if (m_dataReader == nullptr || m_ddsTopic == nullptr)
{
ERROR_LOG() << "No dataReader initialised ";
ERROR_LOG(m_logger) << "No dataReader initialised ";
return false;
}
if (!isValid(callbackFunc))
{
ERROR_LOG() << "No subscriber set for "
ERROR_LOG(m_logger) << "No subscriber set for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
@@ -216,7 +216,7 @@ public:
dds::sub::LoanedSamples<DynamicData> samples = m_dataReader.select().state(dds::sub::status::DataState::new_data()).read();
DEBUG_LOG() << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() + m_newSamplesDuringRead.size() << " samples from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const auto &sample : samples)
@@ -297,7 +297,7 @@ private:
if (samples.length() == 0)
return false;
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
<< m_ddsTopic.name();
for (const auto &sample : samples)
@@ -47,19 +47,19 @@ public:
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()),
bool bCreateDataReader = true)
{
DEBUG_LOG() << "IN GenericDataReader::create ("
DEBUG_LOG(m_logger) << "IN GenericDataReader::create ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this;
if (domainParticipant == nullptr)
{
ERROR_LOG() << "DomainParticipant does not exist ";
ERROR_LOG(m_logger) << "DomainParticipant does not exist ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< DDS::topic_type_name<TopicType>::value()
<< "' already created";
return false;
@@ -67,7 +67,7 @@ public:
try
{
DEBUG_LOG() << "Creating read topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating read topic " << topicName << " with type: "
<< DDS::topic_type_name<TopicType>::value();
m_ddsTopic = dds::topic::find<DataTopic>(domainParticipant, topicName);
@@ -79,9 +79,9 @@ public:
dds::sub::qos::SubscriberQos subscriberQoS = ddsSubscriber.qos();
dds::core::policy::Partition partition = subscriberQoS.policy<dds::core::policy::Partition>();
dds::core::StringSeq parititionNames = partition.name();
DEBUG_LOG() << "Subscribing partitions: " << parititionNames.size();
DEBUG_LOG(m_logger) << "Subscribing partitions: " << parititionNames.size();
for (const std::string &name : parititionNames)
DEBUG_LOG() << " partition name = " << name;
DEBUG_LOG(m_logger) << " partition name = " << name;
}
if (bCreateDataReader)
@@ -90,7 +90,7 @@ public:
m_dataReader = DataReader(ddsSubscriber, m_ddsTopic, drQos);
if (m_dataReader == nullptr)
{
ERROR_LOG() << "Creating dataReader for '" << topicName << "' with type: '"
ERROR_LOG(m_logger) << "Creating dataReader for '" << topicName << "' with type: '"
<< DDS::topic_type_name<TopicType>::value()
<< "' failed";
return false;
@@ -99,11 +99,11 @@ public:
}
catch (const dds::core::Exception &ex)
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataReader created ("
DEBUG_LOG(m_logger) << "dataReader created ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -114,7 +114,7 @@ public:
bool hasSamples() const
{
qint64 sampleSize = m_dataReader->datareader_cache_status().sample_count();
DEBUG_LOG() << "sampleSize = " << sampleSize;
DEBUG_LOG(m_logger) << "sampleSize = " << sampleSize;
return sampleSize > 0;
}
@@ -124,7 +124,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).read();
TRACE_LOG() << "readAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "readAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -138,7 +138,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::alive()).take();
TRACE_LOG() << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeAlive for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
@@ -150,7 +150,7 @@ public:
{
dds::sub::LoanedSamples<TopicTypeRead> samples =
m_dataReader.select().state(dds::sub::status::InstanceState::not_alive_disposed()).take();
TRACE_LOG() << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
TRACE_LOG(m_logger) << "takeDisposed for " << DDS::topic_type_name<TopicType>::value()
<< ", count: " << samples.length()
<< ", this: " << this << ", instance handle " << m_dataReader.instance_handle();
return samples;
@@ -159,18 +159,18 @@ public:
template<typename C>
bool read(C callbackFunc)
{
DEBUG_LOG() << "IN read ("
DEBUG_LOG(m_logger) << "IN read ("
<< DDS::topic_type_name<TopicType>::value()
<< "), this: " << this << ", instance handle " << m_dataReader.instance_handle();
if (m_dataReader == nullptr)
{
ERROR_LOG() << "No dataReader initialised ";
ERROR_LOG(m_logger) << "No dataReader initialised ";
return false;
}
if (!isValid(callbackFunc))
{
ERROR_LOG() << "No subscriber set for "
ERROR_LOG(m_logger) << "No subscriber set for "
<< DDS::topic_type_name<TopicType>::value();
return false;
}
@@ -189,7 +189,7 @@ public:
}
}
DEBUG_LOG() << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
DEBUG_LOG(m_logger) << "got " << samples.size() + m_newSamplesDuringRead.size() << " samples from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const SampleStruct &ss : samples)
@@ -265,7 +265,7 @@ private:
if (samples.length() == 0)
return false;
DEBUG_LOG() << "got " << samples.length() << " disposed instances from reader for "
DEBUG_LOG(m_logger) << "got " << samples.length() << " disposed instances from reader for "
<< DDS::topic_type_name<TopicType>::value();
for (const auto &sample : samples)
@@ -32,19 +32,19 @@ public:
const dds::pub::Publisher &ddsPublisher,
const std::string &topicName = DDS::Helper::getShortTopicName(DDS::topic_type_name<TopicType>::value()))
{
DEBUG_LOG() << "IN GenericDataWriter::create ("
DEBUG_LOG(m_logger) << "IN GenericDataWriter::create ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
if (participant == nullptr)
{
ERROR_LOG() << "Participant not available, aborting. ";
ERROR_LOG(m_logger) << "Participant not available, aborting. ";
return false;
}
if (m_ddsTopic != nullptr)
{
ERROR_LOG() << "Type '"
ERROR_LOG(m_logger) << "Type '"
<< DDS::topic_type_name<TopicType>::value()
<< "' already created";
return false;
@@ -52,7 +52,7 @@ public:
try {
DEBUG_LOG() << "Creating write topic " << topicName << " with type: "
DEBUG_LOG(m_logger) << "Creating write topic " << topicName << " with type: "
<< DDS::topic_type_name<TopicType>::value();
m_ddsTopic = dds::topic::find<DataTopic>(participant, topicName);
@@ -65,7 +65,7 @@ public:
if (m_dataWriter == nullptr)
{
ERROR_LOG() << "Initialisation of "
ERROR_LOG(m_logger) << "Initialisation of "
<< DDS::topic_type_name<TopicType>::value()
<< " failed ";
return false;
@@ -74,11 +74,11 @@ public:
}
catch ( const dds::core::Exception &ex )
{
ERROR_LOG() << ex.what();
ERROR_LOG(m_logger) << ex.what();
return false;
}
DEBUG_LOG() << "dataWriter created ("
DEBUG_LOG(m_logger) << "dataWriter created ("
<< DDS::topic_type_name<TopicType>::value()
<< ")";
@@ -88,12 +88,12 @@ public:
bool write(const TopicType &data,
const dds::core::optional<dds::sub::SampleInfo> &si = dds::core::optional<dds::sub::SampleInfo>())
{
DEBUG_LOG() << "IN write ("
DEBUG_LOG(m_logger) << "IN write ("
<< DDS::topic_type_name<TopicType>::value()
<< ") ";
if (m_dataWriter == nullptr) {
ERROR_LOG() << "No dataWriter initialised ";
ERROR_LOG(m_logger) << "No dataWriter initialised ";
return false;
}
@@ -112,18 +112,18 @@ public:
bool remove(const TopicType &data, bool errorMsgIfNotExists = true)
{
DEBUG_LOG() << "IN remove ("
DEBUG_LOG(m_logger) << "IN remove ("
<< DDS::topic_type_name<TopicType>::value()
<< ") ";
if (m_dataWriter == nullptr) {
ERROR_LOG() << "No dataWriter initialised ";
ERROR_LOG(m_logger) << "No dataWriter initialised ";
return false;
}
const dds::core::InstanceHandle ih = m_dataWriter.lookup_instance(data);
if (ih.is_nil()) {
if (errorMsgIfNotExists)
ERROR_LOG() << "Could not find instance for topic "
ERROR_LOG(m_logger) << "Could not find instance for topic "
<< DDS::topic_type_name<TopicType>::value()
<< " for unregistering!";
return false;
@@ -13,7 +13,7 @@ SubscriberListener::SubscriberListener()
, m_logger(DDS::getLogger("SubscriberListener", DDS::DataType::DATA_TOPIC_CLIENT))
{
qRegisterMetaType<std::string>("std::string");
DEBUG_LOG() << "SubscriberListener initialized, this " << this;
DEBUG_LOG(m_logger) << "SubscriberListener initialized, this " << this;
}
void SubscriberListener::addCallback(const std::string &topicName,
@@ -21,7 +21,7 @@ void SubscriberListener::addCallback(const std::string &topicName,
const dds::sub::AnyDataReader &dataReader,
SubscriberListenerCallback *cb)
{
DEBUG_LOG() << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
DEBUG_LOG(m_logger) << "addSubscriberCallback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this;
QWriteLocker l(&m_accessLock);
if (m_bPrepareForShutdown)
@@ -34,7 +34,7 @@ void SubscriberListener::removeCallback(const std::string &topicName,
const dds::sub::AnyDataReader &dataReader,
SubscriberListenerCallback *cb)
{
DEBUG_LOG() << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
DEBUG_LOG(m_logger) << "IN removeSubscriberCallback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this;
QWriteLocker l(&m_accessLock);
m_droCallbacks.remove(std::make_pair(topicName, topicTypeName), fillData(dataReader, cb));
@@ -68,7 +68,7 @@ void SubscriberListener::enaDisaCallback(const std::string &topicName,
}
if (!bFound)
WARNING_LOG() << "Can not " << (bEnable ? "enable" : "disable")
WARNING_LOG(m_logger) << "Can not " << (bEnable ? "enable" : "disable")
<< " callback for " << topicName << ", type " << topicTypeName
<< ", cb " << cb << ", this " << this << " - not found!";
}
@@ -91,7 +91,7 @@ void SubscriberListener::on_data_available(dds::sub::AnyDataReader &reader)
QReadLocker l(&m_accessLock);
if (m_droCallbacks.isEmpty() || m_bPrepareForShutdown)
return;
DEBUG_LOG() << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
DEBUG_LOG(m_logger) << "Data available for " << topicName << ", type " << topicTypeName << ", this " << this;
QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbIt = m_droCallbacks.find(key);
const QMultiMap<std::pair<std::string, std::string>, cbData>::iterator cbEnd = m_droCallbacks.end();
for( ; cbIt != cbEnd && cbIt.key() == key; ++cbIt)
@@ -122,7 +122,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
const std::string &topicName = reader.topic_name();
const std::string &topicTypeName = reader.type_name();
DEBUG_LOG() << "on_liveliness_changed: " << livelinessStatus.alive_count()
DEBUG_LOG(m_logger) << "on_liveliness_changed: " << livelinessStatus.alive_count()
<< ", " << livelinessStatus.not_alive_count()
<< ", " << livelinessStatus.alive_count_change()
<< ", " << livelinessStatus.not_alive_count_change()
@@ -154,7 +154,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
if (bNoWritersAnymore)
{
DEBUG_LOG() << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
DEBUG_LOG(m_logger) << "bNoWritersAnymore for " << topicName << ", type " << topicTypeName;
data.cb->noWriterAnymore(topicTypeName, topicName);
}
else if (bNewWriters)
@@ -164,7 +164,7 @@ void SubscriberListener::on_liveliness_changed(dds::sub::AnyDataReader &reader,
continue;
if (data.methodToCall.isValid())
{
DEBUG_LOG() << "methodcall is valid for " << topicName << ", type " << topicTypeName;
DEBUG_LOG(m_logger) << "methodcall is valid for " << topicName << ", type " << topicTypeName;
data.methodToCall.invoke(data.cb, Qt::QueuedConnection,
Q_ARG(std::string, topicTypeName),
Q_ARG(std::string, topicName));
@@ -71,6 +71,7 @@ public:
void prepareShutdown();
protected:
NGL::INGLLogger &m_logger;
void addCallback(const std::string &topicName,
const std::string &topicTypeName,
const dds::sub::AnyDataReader &dataReader,
@@ -24,7 +24,7 @@ WaitSetHandler::~WaitSetHandler()
bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "AttachWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "AttachWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -33,7 +33,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it != m_waitSetData.end())
{
WARNING_LOG() << "Waitset " << cb << " already registered";
WARNING_LOG(m_logger) << "Waitset " << cb << " already registered";
return false;
}
@@ -47,7 +47,7 @@ bool WaitSetHandler::attachWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "DetachWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "DetachWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -56,7 +56,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
WARNING_LOG() << "Waitset for " << cb << " not registered";
WARNING_LOG(m_logger) << "Waitset for " << cb << " not registered";
return false;
}
@@ -67,7 +67,7 @@ bool WaitSetHandler::detachWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "EnableWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "EnableWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -75,7 +75,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
ERROR_LOG() << "Could not find WaitSetData - cannot enable waitSet for " << cb;
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot enable waitSet for " << cb;
return false;
}
@@ -88,7 +88,7 @@ bool WaitSetHandler::enableWaitSet(const dds::core::cond::Condition &cond, Callb
bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, CallbackInterface *cb)
{
DEBUG_LOG() << "DisableWaitSet with callback " << cb;
DEBUG_LOG(m_logger) << "DisableWaitSet with callback " << cb;
WaitSetData wsd(cond, cb);
@@ -96,7 +96,7 @@ bool WaitSetHandler::disableWaitSet(const dds::core::cond::Condition &cond, Call
auto it = m_waitSetData.find(wsd.condition->native_condition());
if (it == m_waitSetData.end())
{
ERROR_LOG() << "Could not find WaitSetData - cannot disable waitSet for " << cb;
ERROR_LOG(m_logger) << "Could not find WaitSetData - cannot disable waitSet for " << cb;
return false;
}
@@ -133,7 +133,7 @@ void WaitSetHandler::waitSetTask()
WaitSetData &wsd = it->second;
if (wsd.enabled)
{
DEBUG_LOG() << "Condition triggered for " << wsd.callback;
DEBUG_LOG(m_logger) << "Condition triggered for " << wsd.callback;
wsd.callback->dataAvailable();
}
++it;
@@ -39,6 +39,7 @@ public:
int attachedConditionCount() const;
private:
NGL::INGLLogger &m_logger;
struct WaitSetData final
{
dds::core::cond::Condition condition;
@@ -52,9 +53,11 @@ private:
{}
};
private:
NGL::INGLLogger &m_logger;
void waitSetTask();
private:
NGL::INGLLogger &m_logger;
dds::core::cond::WaitSet m_waitSet;
dds::core::cond::GuardCondition m_abortCondition;
std::future<void> m_task;