Qt6 migration fixes: RTI DDS alias targets, ErrorMessage namespace, DDS header include path

This commit is contained in:
torsten committed 2026-08-27 09:02:26 +02:00
1 parent 8050bca545
commit bb1447c858
18635 files changed
+2466913 -906310

No files matched your search

@@ -16,6 +16,11 @@ NGL_ADD_LIBRARY(WS IsmDataPlugin MODULE
ism_foreign_data_plugin.h
)
set_target_properties(IsmDataPlugin PROPERTIES AUTOMOC ON)
NGL_TARGET_INCLUDE_DIRECTORIES(IsmDataPlugin
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
NGL_TARGET_LINK_LIBRARIES(IsmDataPlugin
IsmDataPluginInterface
IsmShared
@@ -43,4 +48,5 @@ NGL_TARGET_LINK_LIBRARIES(IsmDataPluginThp
NGL_TARGET_INCLUDE_DIRECTORIES(IsmDataPluginThp
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}/../../..
)
@@ -3,7 +3,7 @@
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
namespace InfrastructureManagement
@@ -3,9 +3,10 @@
#include "ism_foreign_data_plugin.h"
#include <Plugins/InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <Plugins/InfrastructureManagement/Shared/ism_mounting_point.h>
#include <InfrastructureManagement/logger.h>
#include <InfrastructureManagement/ism_resource_management_gui_plugin_interface.h>
#include <InfrastructureManagement/ism_mounting_point.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <LtsUtilsCore/json_object.h>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
@@ -31,8 +32,19 @@
namespace InfrastructureManagement
{
// Helper function to convert InfrastructureManagement::Interface::MainSchedule to ParticipantManagement::MainSchedule
static ParticipantManagement::MainSchedule convertMainSchedule(const Interface::MainSchedule& ismSchedule)
{
ParticipantManagement::MainSchedule ppmSchedule;
ppmSchedule.id = ismSchedule.id();
// Note: Other fields (name, description, startTime, endTime, isActive) have no direct mapping
// from InfrastructureManagement::MainSchedule, so they remain at default values
return ppmSchedule;
}
ForeignInterfaceImpl::ForeignInterfaceImpl(const std::shared_ptr<Interface::Dtc> &dtc, int exerciseId)
: m_dtc(dtc)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_dtc(dtc)
, m_scheduleId(-1)
, m_exerciseId(exerciseId)
{
@@ -109,10 +121,10 @@ MountingPoint ForeignInterfaceImpl::mountingPoint(int32_t mountingPointId) const
return m_mountingPoints.value(mountingPointId);
}
MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
ParticipantManagement::MainSchedule ForeignInterfaceImpl::mainSchedule(int32_t scheduleId)
{
enableIsmForeignInterface();
return m_dtc->mainSchedule(scheduleId);
return convertMainSchedule(m_dtc->mainSchedule(scheduleId));
}
void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
@@ -123,7 +135,7 @@ void ForeignInterfaceImpl::setScheduleId(int32_t scheduleId)
enableIsmForeignInterface();
m_scheduleId = scheduleId;
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), DataModification::eModified);
onMainScheduleChanged(m_dtc->mainSchedule(scheduleId), InfrastructureManagement::Interface::DataModification::eModified);
emit scheduleIdChanged(m_scheduleId);
}
@@ -151,27 +163,27 @@ bool ForeignInterfaceImpl::isBuildingsInCurrentExercise(int buildingId) const
return m_bldgsInExcersise.contains(buildingId);
}
void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElement &data, DataModification modType)
void ForeignInterfaceImpl::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType)
{
const int mseId = data.id();
switch (modType)
{
case DataModification::eRemoved:
case InfrastructureManagement::Interface::DataModification::eRemoved:
{
QMutexLocker locker(&m_mutex);
const auto &structureElements = data.elements();
for (const StructureElement &currentStructEle : structureElements)
{
if (currentStructEle.structureElementTypeId() != StructureElementType::MountingPoint)
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
continue;
m_mountingPoints.remove(currentStructEle.id());
}
break;
}
case DataModification::eAdded:
case DataModification::eModified:
case InfrastructureManagement::Interface::DataModification::eAdded:
case InfrastructureManagement::Interface::DataModification::eModified:
{
QVector<int> exeIds;
@@ -179,17 +191,22 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
if (m_exerciseId > 0)
{
QJsonParseError parserError;
const QByteArray &content = QByteArray::fromStdString(data.properties());
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id() << ", " << data.name();
else
const auto &structureElements = data.elements();
if (!structureElements.empty())
{
const QJsonArray exercises(QJsonObject(doc.object()).value(QStringLiteral("available_in_exercise")).toArray());
exeIds.reserve(exercises.size());
for (const auto &exercise : exercises)
exeIds += exercise.toInt();
const QByteArray &content = QByteArray::fromStdString(structureElements[0].properties());
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
if (parserError.error != QJsonParseError::NoError)
WARNING_LOG(m_logger) << "Invalid properties for MSE " << data.id() << ", " << data.name();
else
{
const QJsonArray exercises(QJsonObject(doc.object()).value(QStringLiteral("available_in_exercise")).toArray());
exeIds.reserve(exercises.size());
for (const auto &exercise : exercises)
exeIds += exercise.toInt();
}
}
}
@@ -237,7 +254,7 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
const auto &structureElements = data.elements();
for (const StructureElement &currentStructEle : structureElements)
{
if (currentStructEle.structureElementTypeId() != StructureElementType::MountingPoint)
if (currentStructEle.mountingPointTypeId() == MountingPointType::Undefined)
continue;
StructureElement seFloor;
@@ -262,24 +279,23 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
{
MountingPoint &mountingPointRef = *it;
if (mountingPointRef.data() == currentStructEle)
if (mountingPointRef.data().id() == currentStructEle.id())
continue;
mountingPointRef.updateData(currentStructEle, floorId);
emit mountingPointChanged(mountingPointRef, DataModification::eModified);
emit mountingPointChanged(mountingPointRef, ParticipantManagement::DataModification::eModified);
} else {
DEBUG_LOG(m_logger) << "New Mounting point with id " << currentStructEle.id()
<< " and type " << currentStructEle.mountingPointTypeId()
<< " (type " << currentStructEle.mountingPointTypeId().underlying() << ")"
<< " and type " << static_cast<int>(currentStructEle.mountingPointTypeId())
<< " subid: " << currentStructEle.mountingPointId() << this;
MountingPoint newMountingPoint(currentStructEle, floorId);
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.id(), -1);
const int assetId = m_mountingPointAssetMap.value(newMountingPoint.data().id(), -1);
newMountingPoint.setAssociatedAssetId(assetId);
m_mountingPoints.insert(newMountingPoint.id(), newMountingPoint);
emit mountingPointChanged(newMountingPoint, DataModification::eAdded);
m_mountingPoints.insert(newMountingPoint.data().id(), newMountingPoint);
emit mountingPointChanged(newMountingPoint, ParticipantManagement::DataModification::eAdded);
}
}
@@ -290,7 +306,7 @@ void ForeignInterfaceImpl::onMainStructureElementChanged(const MainStructureElem
}
}
void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset &data, DataModification modType)
void ForeignInterfaceImpl::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType)
{
const int32_t structureElementId = data.structureElementId();
@@ -305,10 +321,10 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset
MountingPoint &mpRef = m_mountingPoints[structureElementId];
if (modType == DataModification::eRemoved)
if (modType == InfrastructureManagement::Interface::DataModification::eRemoved)
{
m_mountingPointAssetMap.remove(structureElementId);
if (mpRef.id() > 0)
if (mpRef.data().id() > 0)
{
mpRef.setAssociatedAssetId(-1);
mpRef.setHasAssociatedAssetDefect(false);
@@ -317,42 +333,42 @@ void ForeignInterfaceImpl::onMountingPointAssetChanged(const MountingPointAsset
else
{
m_mountingPointAssetMap.insert(structureElementId, data.assetId());
if (mpRef.id() > 0)
if (mpRef.data().id() > 0)
{
mpRef.setAssociatedAssetId(data.assetId());
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId()).assetStateId() == InstrumentationAssetState::Defect);
mpRef.setHasAssociatedAssetDefect(m_dtc->instrumentationAsset(data.assetId()).assetStateId() == Interface::InstrumentationAssetState::Defect);
}
}
if (mpRef.id() > 0)
emit mountingPointChanged(mpRef, DataModification::eModified);
if (mpRef.data().id() > 0)
emit mountingPointChanged(mpRef, ParticipantManagement::DataModification::eModified);
}
void ForeignInterfaceImpl::onMainScheduleChanged(const MainSchedule &data, DataModification modType)
void ForeignInterfaceImpl::onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType)
{
if (m_scheduleId != data.id())
return;
Q_UNUSED(modType);
QHash<int, MountingPointPlan> mppMap;
QHash<int, Interface::MountingPointPlan> mppMap;
for (const auto &elem : data.elements())
mppMap[elem.structureElementId()] = elem;
for (MountingPoint &mp : m_mountingPoints)
{
const MountingPointPlan &mpp = mppMap[mp.id()];
const Interface::MountingPointPlan &mpp = mppMap[mp.data().id()];
const MountingPointState &mps = mpp.mountingPointState();
if(mpp.structureElementId() != mp.id())
if(mpp.structureElementId() != mp.data().id())
{
if (mp.aimState() == MountingPointState_def::Idle)
continue;
mp.setAimState(MountingPointState::Idle);
emit mountingPointChanged(mp, DataModification::eModified);
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
continue;
}
@@ -360,7 +376,7 @@ void ForeignInterfaceImpl::onMainScheduleChanged(const MainSchedule &data, DataM
continue;
mp.setAimState(mps);
emit mountingPointChanged(mp, DataModification::eModified);
emit mountingPointChanged(mp, ParticipantManagement::DataModification::eModified);
}
}
@@ -385,9 +401,9 @@ void ForeignInterfaceImpl::init()
#ifdef PROCESS_MSE_SEQUENTIELL
m_dtc->mainStructureElements([this](const MainStructureElement &data)
m_dtc->mainStructureElements([this](const InfrastructureManagement::MainStructureElement &data)
{
onMainStructureElementChanged(data, DataModification::eAdded);
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
#else
@@ -407,20 +423,22 @@ void ForeignInterfaceImpl::init()
m_mountingPoints.reserve(mseMap.size());
QtConcurrent::blockingMap(mseMap, [this](const MainStructureElement &data) {
onMainStructureElementChanged(data, DataModification::eAdded);
QtConcurrent::blockingMap(mseMap, [this](const InfrastructureManagement::MainStructureElement &data) {
onMainStructureElementChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
#endif
m_dtc->mountingPointAssets([this](const MountingPointAsset &data)
m_dtc->mountingPointAssets([this](const InfrastructureManagement::MountingPointAsset &data)
{
onMountingPointAssetChanged(data, DataModification::eAdded);
onMountingPointAssetChanged(data, InfrastructureManagement::Interface::DataModification::eAdded);
});
m_dtc->mainSchedules([this](const MainSchedule &data)
// mainSchedules() returns QMap, iterate and notify for each schedule
const auto& schedulesMap = m_dtc->mainSchedules();
for (auto it = schedulesMap.begin(); it != schedulesMap.end(); ++it)
{
onMainScheduleChanged(data, DataModification::eAdded);
});
onMainScheduleChanged(it.value(), InfrastructureManagement::Interface::DataModification::eAdded);
}
int firstBldg = -1;
if (!m_bldgsInExcersise.isEmpty())
@@ -3,7 +3,8 @@
#pragma once
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/ism_data_plugin_interface.h>
#include <InfrastructureManagement/logger.h>
#include <QtCore/QHash>
#include <QtCore/QSet>
#include <QtCore/QMutex>
@@ -33,7 +34,7 @@ public:
MainSchedule mainSchedule(int32_t scheduleId) override final;
ParticipantManagement::MainSchedule mainSchedule(int32_t scheduleId) override final;
void setScheduleId(int32_t scheduleId) override final;
int32_t scheduleId() const override final;
@@ -48,13 +49,12 @@ public:
private Q_SLOTS:
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, DataModification modType);
void onMainScheduleChanged(const InfrastructureManagement::MainSchedule &data, DataModification modType);
void onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, InfrastructureManagement::Interface::DataModification modType);
void onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &data, InfrastructureManagement::Interface::DataModification modType);
void onMainScheduleChanged(const InfrastructureManagement::Interface::MainSchedule &data, InfrastructureManagement::Interface::DataModification modType);
private:
NGL::INGLLogger &m_logger;
NGL::INGLLogger &m_logger;
void init();
private: