Files
qt-migration-legatus/qt5-before/dlbo/Lts/Services/InfrastructureManagement/WebSocketInterface/data_manager.h
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

172 lines
7.1 KiB
C++

/**
* @RDE_HEADER@
* The DataManager class is a convenience class for managing structure data
* $Id$
* $HeadURL$
* $Author$
* Created by Hannes Baeuerle, SLSE, 2016-09-12
*/
#pragma once
#include <LtsWebSocket/data_manager_base_dl.h>
#include <InfrastructureManagement/ism_db.h>
#include "WebSocketInterface/Messages/reply_message.h"
#include "Messages/reply_message.h"
#include "logger.h"
namespace AssetManagement
{
namespace Interface
{
class Dtc;
} // namespace Interface
} // namespace AssetManagement
namespace InfrastructureManagement
{
class MainHandler;
class ObjectInstrumentationAsset;
namespace WebSocketInterface
{
namespace Messages
{
class TrainingAreaMessage;
class AreaMessage;
class ObjectMessage;
class LevelMessage;
class RoomMessage;
class MountingPointMessage;
class AssetTypeMessage;
} // namespace Messages
/**
* @brief The DataManager class is a convenience class for managing structure data
*/
class DataManager final : LtsWebSocket::DataManagerBaseDl<DatabaseInterface>
{
public:
/**
* @brief The EinruestEssentials struct is just there to bundle essentials data
* to a single return value
*/
struct EinruestEssentials
{
QVector<Messages::TrainingAreaMessage> trainingAreas;
QVector<Messages::AreaMessage> areas;
QVector<Messages::ObjectMessage> objects;
QVector<Messages::LevelMessage> levels;
QVector<Messages::RoomMessage> rooms;
QVector<Messages::MountingPointMessage> mountingPoints;
QVector<Messages::AssetTypeMessage> assetTypes;
};
/**
* @brief DataManager Constructor
* @param mainHandler Source for needed handlers
*/
explicit DataManager(MainHandler *mainHandler);
/**
* @brief init Initialises a DataManager object
* @return True on sucess, otherwise false
*/
bool init();
/**
* @brief getEssentials Getter for initial data
* @param uuid Identifier of the message to be responded to
* @return Initial data of type EinruestEssentials
*/
EinruestEssentials getEssentials(const QString &uuid) const;
/**
* @brief getPlannedMounting Getter for data needed in response to a getPlannedMounting Message
* @param uuid Identifier of the message to be responded to
* @return All planned mounting messages
*/
QVector<Messages::PlannedMountingMessage> getPlannedMounting(const QString &uuid) const;
/**
* @brief getObjectMounting Getter for a Messages::ObjectMessage
* @param plannedMountingId Id of the schedule
* @param objectId Id of the object/building
* @param uuid Identifier of the message to be responded to
* @return Messages::ObjectMessage if combination of plannedMountingId and objectId exists,
* otherwise Messages::ErrorMessage
*/
LtsWebSocket::ReplyMessage *getObjectMounting(int plannedMountingId, int objectId, const QString &uuid) const;
LtsWebSocket::ReplyMessage *mountTag(const QString &mountingPointTag,
const QString &assetTag,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *mount(int32_t mountingPointId,
int32_t assetId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *unmountAsset(int32_t assetId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *unmountMountingPoint(int32_t mountingPointId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *unmountObject(int32_t objectId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *unmountArea(int32_t areaId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *objectMountingReady(int32_t plannedMountingId,
int32_t objectId,
const QString &messageType,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *getAssetState(int32_t assetId,
const QString &assetTag,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *getAssets(const QSet<int> &assetTypeIds,
const QString &uuid) const;
LtsWebSocket::ReplyMessage *getBuildingState(int32_t buildingId,
const QString &uuid) const;
// base DL OC
LtsWebSocket::ReplyMessage *assetBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *mainStructureElementBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *structureElementBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *structureElementFootprintBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *mountingPointAssetBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *mountingPointScheduleBaseData(const QString &uuid) const;
LtsWebSocket::ReplyMessage *mountingPointPlanBaseData(const QString &uuid) const;
private: //methods
static QVector<Messages::ReplyMessage::LonLatPoint> relativeToGeographic(const Messages::ReplyMessage::LonLatPoint &pos,
const QVector<Messages::ReplyMessage::XYPoint> &relPoints);
QVector<Messages::ReplyMessage::XYPoint> pathForStructureId(int32_t structureElementId) const;
QVector<Messages::PlannedMountingMessage::MountingEntry> entriesForScheduleId(int32_t scheduleId) const;
int32_t areaIdForScheduleId(int32_t scheduleId) const;
int32_t stateForBuilding(int32_t buildingId) const;
bool isMounted(int32_t mountingPointId) const;
bool isPlannedObject(int32_t objectId) const;
QVector<Messages::ObjectMountingMessage::PlannedEntry> entriesForBuildingInSchedule(int32_t scheduleId, int32_t buildingId) const;
int32_t getMountedAssetId(int32_t mountingPointId) const;
int32_t mountingPointIdFromBarcode(const QString &barcode) const;
int32_t assetIdFromBarcode(const QString &barcode) const;
Messages::AssetData assetData(int32_t assetId) const;
Messages::AssetData assetData(const ObjectInstrumentationAsset *asset) const;
MountingPointState getMountingPointState(int32_t mountingPointId, int32_t scheduleId) const;
private: // attributes
MainHandler *m_mainHandler;
std::shared_ptr<AssetManagement::Interface::Dtc> m_asmDtc;
}; // class DataManager
} // namespace WebSocketInterface
} // namespace InfrastructureManagement