From 93020295ad1db71fa55fd0f1cdd6ff5ab66bac98 Mon Sep 17 00:00:00 2001 From: twi-devel Date: Sat, 22 Aug 2026 11:55:44 +0200 Subject: [PATCH] Add BUILD_RTI guards to InfrastructureManagement and AudioVideoManagement DDS handlers - ism_dtc_impl_custom.h/cpp: Wrap all DDS-dependent method declarations and implementations with BUILD_RTI guards - dds_handler.cpp (InfrastructureManagement): Guard RTI DDS initialization code - dds_handler.h/cpp (AudioVideoManagement): Guard DomainParticipant types and methods - Enables building without RTI Connext DDS dependencies (BUILD_RTI=OFF) - Stub types used when guards are disabled Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../AudioVideoManagement/dds_handler.cpp | 12 +++++ .../AudioVideoManagement/dds_handler.h | 6 +++ .../InfrastructureManagement/dds_handler.cpp | 6 +++ .../ism_dtc_impl_custom.cpp | 53 ++++++++++++++++--- .../ism_dtc_impl_custom.h | 14 +++-- 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.cpp index b5bf1937c..c6cf89c34 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.cpp @@ -18,7 +18,9 @@ #include #include +#if BUILD_RTI #include +#endif namespace AudioVideoManagement @@ -38,6 +40,7 @@ bool DdsHandler::init(const QStringList &qosFileList) return false; } +#if BUILD_RTI // default initialize Publisher and Subscriber m_ddsConnector->initPublisherSubscriber(); // no batched writer possible until frequency set data is no longer that big (currently 1800rows) @@ -57,6 +60,9 @@ bool DdsHandler::init(const QStringList &qosFileList) bRet &= m_fts->enableAll(); return bRet; +#else + return true; +#endif } bool DdsHandler::enableDtcClients() @@ -64,6 +70,7 @@ bool DdsHandler::enableDtcClients() Q_ASSERT(m_exmDtc); Q_ASSERT(m_ismDtc); Q_ASSERT(m_asmDtc); +#if BUILD_RTI bool status = m_exmDtc->enableExercise() && m_ismDtc->enableInstrumentationAsset() && m_ismDtc->enableMainStructureElement() && @@ -72,11 +79,16 @@ bool DdsHandler::enableDtcClients() Q_ASSERT(status); return status; +#else + return true; +#endif } +#if BUILD_RTI dds::domain::DomainParticipant DdsHandler::domainParticipant() const { return m_ddsConnector->getDomainParticipant(); } +#endif } // Namespace AudioVideoManagement diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.h b/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.h index c7e3c8b8e..30b60f81c 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/AudioVideoManagement/dds_handler.h @@ -8,7 +8,9 @@ #pragma once #include "logger.h" +#if BUILD_RTI #include +#endif #include #include @@ -73,7 +75,11 @@ public: */ bool enableDtcClients(); +#if BUILD_RTI dds::domain::DomainParticipant domainParticipant() const; +#else + void* domainParticipant() const { return nullptr; } +#endif std::shared_ptr pacemaker() const { return m_pacemaker; } std::shared_ptr topicLockMaster() const { return m_topicLockMaster; } diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/dds_handler.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/dds_handler.cpp index 07ffb8410..ca17f3e7e 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/dds_handler.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/dds_handler.cpp @@ -9,7 +9,9 @@ #include "dds_handler.h" +#if BUILD_RTI #include +#endif namespace InfrastructureManagement { @@ -28,6 +30,7 @@ bool DdsHandler::init(const QStringList &qosFileList) return false; } +#if BUILD_RTI // default initialize Publisher and Subscriber m_ddsConnector->initPublisherSubscriber(); @@ -57,6 +60,9 @@ bool DdsHandler::init(const QStringList &qosFileList) } return bRet; +#else + return true; +#endif } } // Namespace PDM diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.cpp b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.cpp index 2d5680097..0ac3a8952 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.cpp +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.cpp @@ -285,6 +285,7 @@ int DtcImplCustom::getOpticalCodeFromAssetId(int assetId) const } +#if BUILD_RTI int DtcImplCustom::getAssetIdFromOpticalCode(int opticalCode) const { DEBUG_LOG(m_logger) << "getAssetIdFromOpticalCode: opticalCode=" << opticalCode; @@ -330,6 +331,7 @@ int DtcImplCustom::getAssetIdFromMountingPointId(int mainStructureElementId, in return -1; } +#endif //--------------------------------------------------------------------------------------------------------------------------------------------- @@ -474,6 +476,7 @@ bool DtcImplCustom::getStructureElementByBuildingIdAndMountingPointId(int mainSt } //--------------------------------------------------------------------------------------------------------------------------------------------- +#if BUILD_RTI bool DtcImplCustom::getAllAssetsPerRoom(const std::function &predicate, QMap > &allAssets) { @@ -523,7 +526,6 @@ bool DtcImplCustom::getAllAssetsPerRoom(const std::function &predicate, QMap > &allAssets) const { @@ -562,7 +564,6 @@ bool DtcImplCustom::getAllAssetsPerBuilding(const std::functionreadAlive()) @@ -579,8 +580,11 @@ bool DtcImplCustom::getBuildingId(int structureElementId, int &buildingId) const buildingId = 0; return false; } +#endif +} //--------------------------------------------------------------------------------------------------------------------------------------------- +#if BUILD_RTI QList DtcImplCustom::getSections() { QList sections; @@ -591,6 +595,7 @@ QList DtcImplCustom::getSections() } return sections; } +#endif //--------------------------------------------------------------------------------------------------------------------------------------------- QString DtcImplCustom::getBuildingDisplayName(int buildingId) @@ -614,6 +619,7 @@ QString DtcImplCustom::getBuildingDisplayName(const MainStructureElement &mse) c } +#if BUILD_RTI MountingPointPlan DtcImplCustom::getMountingPointPlan(int scheduleId, int structureElementId) const { for (const auto &sample : m_dtcMainSchedule->readAlive()) @@ -629,6 +635,7 @@ MountingPointPlan DtcImplCustom::getMountingPointPlan(int scheduleId, int struct } return MountingPointPlan(); } +#endif //--------------------------------------------------------------------------------------------------------------------------------------------- int DtcImplCustom::getBuildingRoomsCount(int buildingId) @@ -666,6 +673,7 @@ BridgeStatus DtcImplCustom::getBridgeStatus(int buildingId) // this is just a quicker method to determine if a plan is complete or not //--------------------------------------------------------------------------------------------------------------------------------------------- +#if BUILD_RTI bool DtcImplCustom::checkSchedule(int scheduleId) { const MainSchedule schedule = mainSchedule(scheduleId); @@ -699,8 +707,10 @@ bool DtcImplCustom::getScheduleDifferences(int scheduleId, QList DtcImplCustom::getFootprintsByExerciseId(int exerciseId) { QMap footprints; @@ -755,7 +766,10 @@ QMap DtcImplCustom::getFootprintsByExerciseId(int exerciseId return footprints; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI QMap DtcImplCustom::getUtmFootprintsByExerciseId(int exerciseId, int &zone, bool isGroundLevel) { QMap footprints; @@ -796,6 +810,7 @@ QMap DtcImplCustom::getUtmFootprintsByExerciseId(int exerciseId, DEBUG_LOG(m_logger) << "getUtmFootprintsByExerciseId footprints.size=" << footprints.size(); return footprints; } +#endif // returns absolut utm positions of the footprint QPolygonF DtcImplCustom::getUtmFootprintById(int mseId, int &zoneOut, bool isGroundLevel) @@ -867,8 +882,10 @@ QPolygonF DtcImplCustom::getUtmFootprintById(int mseId, int &zoneOut, bool isGro // return retPolyUtm; } +#endif - +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI // returns all building IDs that have an intersection with the area under the polygon and are assigned to the specified exercise. // Parameter: completeEnclosed true = Only buildings that are completely enclosed by the polygon are taken into account. // false = All buildings that are completely enclosed by the polygon and that have an overlap with the polygon are taken into account. @@ -936,7 +953,10 @@ QVector DtcImplCustom::getBuildingByPolygon(int exerciseId, const QPolygon return result; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI // returns building ID surrounds the polygon and is assigned to the specified exercise. // returns -1 if no building found int DtcImplCustom::getSurroundingBuildingByPolygon(int exerciseId, const QPolygonF &polygon, bool isGroundLevel) @@ -1000,7 +1020,10 @@ int DtcImplCustom::getSurroundingBuildingByPolygon(int exerciseId, const QPolygo return -1; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI /*! * \brief DtcImplCustom::getBuildingIdAtPosition * \param exerciseId @@ -1024,7 +1047,12 @@ int DtcImplCustom::getBuildingIdAtPosition(int exerciseId, const QPointF &utmPos } return bldId; } +#endif +#endif + +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI // The floors list is sorted according to height. QVector DtcImplCustom::getFloorIdsFromBuilding(int buildingId) { @@ -1064,7 +1092,10 @@ QList DtcImplCustom::getFloorsFromBuilding(int buildingId) std::sort(floors.begin(), floors.end(), structureElementHeightComparator); return floors; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI double DtcImplCustom::getHalfFloorHeight(int buildingId, int floorId) { QList floorHeights = getFloorsFromBuilding(buildingId); @@ -1090,7 +1121,10 @@ double DtcImplCustom::getHalfFloorHeight(int buildingId, int floorId) return 0.0; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI QVector DtcImplCustom::getRoomIdsFromFloorId(int buildingId, int floorId) { DEBUG_LOG(m_logger) << "getRoomIdsFromFloorId " @@ -1117,7 +1151,10 @@ QVector DtcImplCustom::getRoomIdsFromFloorId(int buildingId, int floorId) } return rooms; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI QVector DtcImplCustom::getBuildingIdsByExercise ( int exerciseId) { QVector result; @@ -1132,7 +1169,10 @@ QVector DtcImplCustom::getBuildingIdsByExercise ( int exerciseId) return result; } +#endif +//--------------------------------------------------------------------------------------------------------- +#if BUILD_RTI QByteArray DtcImplCustom::getVulnerabilityModelData( int buildingId) { const MainStructureElement &mse = mainStructureElement(buildingId); @@ -1148,12 +1188,13 @@ QByteArray DtcImplCustom::getVulnerabilityModelData( int buildingId) QFile f(vulnerabilityModelFilename); if (!f.open(QIODevice::ReadOnly)) { - WARNING_LOG(m_logger) << "Could not open file '" << vulnerabilityModelFilename << "' for reading: " << f.errorString(); + WARNING_LOG(m_logger) << "Could not open file '" << vulnerabilityModelModelFilename << "' for reading: " << f.errorString(); } QByteArray dataBa = f.readAll(); return dataBa; } +#endif } // namespace Interface diff --git a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.h b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.h index c0bd8420d..3be27faf6 100755 --- a/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.h +++ b/qt6-after/qt6-migrated-legatus/Lts/Services/InfrastructureManagement/ism_dtc_impl_custom.h @@ -36,27 +36,31 @@ public: bool getAssetIdFromMountingPoint(int structureElementId, int mountingPointAssetId, int &assetId) const override; int getOpsCodeFromJSon(const std::string &s) const; int getOpticalCodeFromAssetId(int assetId) const override; +#if BUILD_RTI int getAssetIdFromOpticalCode(int opticalCode) const override; int getAssetIdFromMountingPointId(int mainStructureElementId, int mountingPointId) const override; - bool getOpsDataFromMseIdAndSeId(int mainStructureElementId, int structureElementId, int &roomId, Core::GeoPosition &geoPosition) const override; - bool getStructureElementById(int structureElementId, StructureElement &structureElement) const override; - bool getStructureElementInMntPointAssetByAssetId(int assetId, StructureElement &structureElement) const override; - bool getStructureElementByBuildingIdAndMountingPointId(int mainStructureElementId, int mountingPointId, StructureElement &structureElement) override; bool getAllAssetsPerRoom(const std::function &predicate, QMap > &allAssets) override; bool getAllAssetsPerBuilding(const std::function &predicate, QMap > &allAssets) const override; + int getStructueElementIdFromAssetId(int assetId) const override; +#endif + bool getOpsDataFromMseIdAndSeId(int mainStructureElementId, int structureElementId, int &roomId, Core::GeoPosition &geoPosition) const override; + bool getStructureElementById(int structureElementId, StructureElement &structureElement) const override; + bool getStructureElementInMntPointAssetByAssetId(int assetId, StructureElement &structureElement) const override; + bool getStructureElementByBuildingIdAndMountingPointId(int mainStructureElementId, int mountingPointId, StructureElement &structureElement) override; bool getBuildingId(int structureElementId, int &buildingId) const override; QString getBuildingDisplayName(int buildingId) override; QString getBuildingDisplayName(const MainStructureElement &mse) const override; MountingPointPlan getMountingPointPlan(int scheduleId, int structureElementId) const override; int getBuildingRoomsCount(int buildingId) override; BridgeStatus getBridgeStatus(int buildingId) override; +#if BUILD_RTI bool checkSchedule(int scheduleId) override; bool getScheduleDifferences(int scheduleId, QList &diffList) override; int getMountedAssetId(int structureElementId) const override; - int getStructueElementIdFromAssetId(int assetId) const override; QList getSections() override; +#endif QMap getFootprintsByExerciseId(int exerciseId) override; QMap getUtmFootprintsByExerciseId(int exerciseId, int &zone, bool isGroundLevel) override; QPolygonF getUtmFootprintById(int mseId, int &zoneOut, bool isGroundLevel) override;