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>
This commit is contained in:
1 parent
3cc3129de0
commit
93020295ad
5 files changed
+80
-11
No files matched your search
@@ -18,7 +18,9 @@
|
||||
#include <InfrastructureManagement/ism_dtc.h>
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#if BUILD_RTI
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#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
|
||||
@@ -8,7 +8,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "logger.h"
|
||||
#if BUILD_RTI
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
#endif
|
||||
#include <DDS/Core/topic_lock_master.h>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -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<Core::Pacemaker> pacemaker() const { return m_pacemaker; }
|
||||
std::shared_ptr<Core::TopicLockMaster> topicLockMaster() const { return m_topicLockMaster; }
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
|
||||
#include "dds_handler.h"
|
||||
|
||||
#if BUILD_RTI
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#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
|
||||
+47
-6
@@ -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<bool(const InstrumentationAsset &)> &predicate,
|
||||
QMap<int, QVector<InstrumentationAsset> > &allAssets)
|
||||
{
|
||||
@@ -523,7 +526,6 @@ bool DtcImplCustom::getAllAssetsPerRoom(const std::function<bool(const Instrumen
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool DtcImplCustom::getAllAssetsPerBuilding(const std::function<bool(const InstrumentationAsset &)> &predicate,
|
||||
QMap<int, QVector<InstrumentationAsset> > &allAssets) const
|
||||
{
|
||||
@@ -562,7 +564,6 @@ bool DtcImplCustom::getAllAssetsPerBuilding(const std::function<bool(const Instr
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
bool DtcImplCustom::getBuildingId(int structureElementId, int &buildingId) const
|
||||
{
|
||||
for (const auto &sample : m_dtcMainStructureElement->readAlive())
|
||||
@@ -579,8 +580,11 @@ bool DtcImplCustom::getBuildingId(int structureElementId, int &buildingId) const
|
||||
buildingId = 0;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
QList<int> DtcImplCustom::getSections()
|
||||
{
|
||||
QList<int> sections;
|
||||
@@ -591,6 +595,7 @@ QList<int> 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<MountingPointPl
|
||||
}
|
||||
return diffList.isEmpty();
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
int DtcImplCustom::getMountedAssetId(int structureElementId) const
|
||||
{
|
||||
// Norbert Thoden, 12.12.2022:
|
||||
@@ -721,7 +731,6 @@ int DtcImplCustom::getMountedAssetId(int structureElementId) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
int DtcImplCustom::getStructueElementIdFromAssetId(int assetId) const
|
||||
{
|
||||
|
||||
@@ -739,8 +748,10 @@ int DtcImplCustom::getStructueElementIdFromAssetId(int assetId) const
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
QMap<int, MainFootprint> DtcImplCustom::getFootprintsByExerciseId(int exerciseId)
|
||||
{
|
||||
QMap<int, MainFootprint> footprints;
|
||||
@@ -755,7 +766,10 @@ QMap<int, MainFootprint> DtcImplCustom::getFootprintsByExerciseId(int exerciseId
|
||||
|
||||
return footprints;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
QMap<int, QPolygonF> DtcImplCustom::getUtmFootprintsByExerciseId(int exerciseId, int &zone, bool isGroundLevel)
|
||||
{
|
||||
QMap<int, QPolygonF> footprints;
|
||||
@@ -796,6 +810,7 @@ QMap<int, QPolygonF> 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 <int> 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 <int> DtcImplCustom::getFloorIdsFromBuilding(int buildingId)
|
||||
{
|
||||
@@ -1064,7 +1092,10 @@ QList <StructureElement> 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 <StructureElement> floorHeights = getFloorsFromBuilding(buildingId);
|
||||
@@ -1090,7 +1121,10 @@ double DtcImplCustom::getHalfFloorHeight(int buildingId, int floorId)
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
QVector <int> DtcImplCustom::getRoomIdsFromFloorId(int buildingId, int floorId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getRoomIdsFromFloorId "
|
||||
@@ -1117,7 +1151,10 @@ QVector <int> DtcImplCustom::getRoomIdsFromFloorId(int buildingId, int floorId)
|
||||
}
|
||||
return rooms;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
#if BUILD_RTI
|
||||
QVector <int> DtcImplCustom::getBuildingIdsByExercise ( int exerciseId)
|
||||
{
|
||||
QVector <int> result;
|
||||
@@ -1132,7 +1169,10 @@ QVector <int> 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
|
||||
|
||||
+9
-5
@@ -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<bool(const InstrumentationAsset &)> &predicate,
|
||||
QMap<int, QVector<InstrumentationAsset> > &allAssets) override;
|
||||
bool getAllAssetsPerBuilding(const std::function<bool(const InstrumentationAsset &)> &predicate,
|
||||
QMap<int, QVector<InstrumentationAsset> > &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<MountingPointPlan> &diffList) override;
|
||||
int getMountedAssetId(int structureElementId) const override;
|
||||
int getStructueElementIdFromAssetId(int assetId) const override;
|
||||
QList<int> getSections() override;
|
||||
#endif
|
||||
QMap<int, MainFootprint> getFootprintsByExerciseId(int exerciseId) override;
|
||||
QMap<int, QPolygonF> getUtmFootprintsByExerciseId(int exerciseId, int &zone, bool isGroundLevel) override;
|
||||
QPolygonF getUtmFootprintById(int mseId, int &zoneOut, bool isGroundLevel) override;
|
||||
|
||||
Reference in new issue
Block a user