Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/recv_from_dds_aes.h
T
torsten 793c9f8b81 BUILD_RTI=OFF: Fix remaining include and build issues
TrainingAreaBase:
- Add BUILD_RTI guards to dds_handler.cpp (entire file)
- Add BUILD_RTI guards to recv_from_dds_aes.h for tab_db.h include
- Add BUILD_RTI guards to main_handler.h for tab_db.h include
- Remove duplicate m_logger declaration in main_handler.h
- Add stub headers for RTI types (tab_db_stub.hpp, tab_enums_stub.hpp, etc.)

VideoOverlayManagement:
- Fix member initialization order in handler_overlays.h
- Fix member initialization order in avs_interface.h
- Fix member initialization order in main_handler.h
- Change logger.cpp include from NGLLogger.h to INGLLogger.h
- Add BUILD_RTI guard to handler_overlays.cpp for RTI signal connection

Plugins:
- Migrate QDesktopWidget → QScreen in Light/Dark style plugins
- Fix CMakeLists.txt for SituationReplayManagement (BUILD_RTI guards)
- Fix CMakeLists.txt for CombatNetRadio (Qt6::Core linking)
- Remove QDesktopWidget includes in multiple plugin files

Infrastructure:
- Remove duplicate INGLLogger.h include directory
- Add stub headers for ProjectDataManagement (pdm.hpp, etc.)
- Add stub headers for RoutingServiceNG

BUILD_RTI=OFF build now compiles successfully (1112 targets).
2026-08-24 14:37:16 +02:00

383 lines
14 KiB
C++
Executable File

#pragma once
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QtCore/QSet>
#include <QtCore/QTimer>
#include <memory>
#include <unordered_map>
#include <AreaEffectSimulation/aes_dtc.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include "pdm_handler.h"
#if BUILD_RTI
#include "tab_db.h"
#endif
#include "logger.h"
#include "send_to_tab.h"
#include "training_area_telegrams.h"
namespace TrainingAreaBase
{
class DatabaseInterface;
class MainHandler;
class PositionHandler;
class SendCesHitRequest;
class AesStateHandler
{
public:
explicit AesStateHandler(MainHandler *mainHandler);
bool init();
int createAesTetraId(int aesDdsId, bool &alreadyExists);
int getAesTetraId(int aesDdsId) const
{
return m_ddsId2TetraId.value(aesDdsId);
}
int getAesDdsId(int aesTetraId) const
{
return m_tetraId2ddsId.value(aesTetraId);
}
bool update(int aesDdsId, int aesTetraId, bool bSentToTetra);
bool isAlreadySentToTetra(int aesDdsId) const
{
return m_aesInTetraAvailable.contains(aesDdsId);
}
private:
QMap<int, int> m_tetraId2ddsId;
QMap<int, int> m_ddsId2TetraId;
QSet<int> m_aesInTetraAvailable;
std::shared_ptr<DatabaseInterface> m_dbInterface;
int m_exerciseId;
};
class RecvFromDdsAes : public QObject
{
Q_OBJECT
public:
RecvFromDdsAes(MainHandler *mainHandler,
const std::shared_ptr<SendToTab> &txCallback,
QObject *parent = nullptr);
~RecvFromDdsAes();
bool init();
std::shared_ptr<const AesStateHandler> aesStateHandler() const
{
return m_aesStateHandler;
}
int ddsIdFromTetraId(int aesTetraId) const
{
return m_aesStateHandler->getAesDdsId(aesTetraId);
}
int tetraIdFromDdsId(int aesId) const
{
return m_aesStateHandler->getAesTetraId(aesId);
}
int aesChargeId(int aesId) const;
TetraIcd::AreaEffectSimulationType aesTypeFromId(int aesId) const;
bool sendSingleFireSMArt(const SendCesHitRequest &request);
const QVector<TetraIcd::TrainingAreaTelegram*> sentAesTelegrams() const
{
return m_sentAesTelegrams;
}
void resetAllDusMines();
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> dtcAes() const { return m_dtcAes;}
private:
template<typename T>
void handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType);
template<typename T>
void fillCentralChangesTable(const T &data);
template <typename T>
void handleSendToTetra(const T &data, TetraIcd::AreaEffectSimulationType aesType);
void onAirSupportImpactChanged(const AreaEffectSimulation::AirSupportImpact &data, DataModification modType);
void onBcContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType);
void onExplosionAreaChanged(const AreaEffectSimulation::ExplosionArea &data, DataModification modType);
void onExplosionSingleChanged(const AreaEffectSimulation::ExplosionSingle &data, DataModification modType);
void onMineAreaChanged(const AreaEffectSimulation::MineArea &data, DataModification modType);
void onNContaminationChanged(const AreaEffectSimulation::NContamination &data, DataModification modType);
void onFunctionalAreaChanged(const AreaEffectSimulation::FunctionalArea &data, DataModification modType);
void onTechnicalAreaChanged(const AreaEffectSimulation::TechnicalArea &data, DataModification modType);
void onTriggeredImpactsChanged(const AreaEffectSimulation::TriggeredImpacts &data, DataModification modType);
void onDusMineStateChanged(const AreaEffectSimulation::DusMineState &data, DataModification modType);
void onDusSingleMineChanged(const AreaEffectSimulation::DusSingleMine &data, DataModification modType);
void onGasPipeChanged(const AreaEffectSimulation::GasPipe &data, DataModification modType);
void onBoobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data, DataModification modType);
void onOffRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data, DataModification modType);
void onExplosionClusterChanged(const AreaEffectSimulation::ExplosionCluster &data, DataModification modType);
void onEffectsChanged(const AreaEffectSimulation::Effects &data, DataModification modType);
void sendCreateEffectSimulation(const AreaEffectSimulation::AirSupportImpact &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::BCContamination &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionArea &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionSingle &aes, int aesTetraId, int equipmentNumber = 0);
void sendCreateEffectSimulation(const AreaEffectSimulation::MineArea &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::NContamination &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::FunctionalArea &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::TechnicalArea &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::DusSingleMine &aes, int aesTetraId);
void sendCreateEffectSimulation(const AreaEffectSimulation::GasPipe &aes, int aesTetraId);
void sendModifyEffectSimulationName(TetraIcd::AreaEffectSimulationType aesType, int aesTetraId, const std::string &name, int aesId);
void sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationType aesType, int aesDdsId);
void sendPauseEffectSimulation(int aesDdsId);
template<typename T>
void sendResumeEffectSimulation(const T &)
{
static_assert(std::is_base_of<AreaEffectSimulation::AesItem, T>::value, "Given type for sendResumeEffectSimulation is not an aes item!");
}
void doSpecialization(const AreaEffectSimulation::ExplosionArea &data, std::unordered_map<int, AreaEffectSimulation::ExplosionArea> &cont)
{
cont[data.id()].remainExplosionNumber(data.remainExplosionNumber());
}
template<typename T>
void doSpecialization(const T &data, std::unordered_map<int, T> &cont)
{
Q_UNUSED(data);
Q_UNUSED(cont);
}
template<typename T>
bool dataChanged(const T &data, std::unordered_map<int, T> &cont, bool &onlyNameChanged)
{
onlyNameChanged = false;
auto it = cont.find(data.id());
T dataTmp(data);
dataTmp.sampleTime(0);
if (it == cont.end())
{
cont.emplace(std::make_pair(data.id(), std::move(dataTmp)));
DEBUG_LOG(m_logger) << "new AES Item: " << data;
return true;
}
it->second.effectStateId(data.effectStateId());
doSpecialization(data, cont);
if (it->second == dataTmp)
{
DEBUG_LOG(m_logger) << "nothing changed for AES Item: " << data;
return false;
}
T tmp(it->second);
tmp.name(data.name());
tmp.sampleTime(data.sampleTime());
onlyNameChanged = (tmp == data);
std::swap(it->second, dataTmp);
DEBUG_LOG(m_logger) << "changed AES Item: " << data;
return true;
}
bool dataChanged(const AreaEffectSimulation::AirSupportImpact &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentAirSupportImpacts, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::BCContamination &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentBCContaminations, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::ExplosionArea &current, bool &onlyNameChanged)
{
AreaEffectSimulation::ExplosionArea copy(current);
copy.remainExplosionNumber(0);
return dataChanged(copy, m_currentExplosionArea, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::ExplosionCluster &current, bool &onlyNameChanged)
{
AreaEffectSimulation::ExplosionCluster copy(current);
copy.remainExplosionNumber(0);
return dataChanged(copy, m_currentExplosionCluster, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::ExplosionSingle &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentExplosionSingle, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::MineArea &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentMineArea, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::NContamination &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentNContamination, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::FunctionalArea &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentFunctionalArea, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::TechnicalArea &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentTechnicalArea, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::DusSingleMine &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentDusSingleMine, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::GasPipe &current, bool &onlyNameChanged)
{
return dataChanged(current, m_currentGasPipes, onlyNameChanged);
}
bool dataChanged(const AreaEffectSimulation::BoobyTrap &current)
{
bool placeholder;
Q_UNUSED(placeholder);
return dataChanged(current, m_currentBoobyTraps, placeholder);
}
bool dataChanged(const AreaEffectSimulation::OffRouteMine &current)
{
bool placeholder;
Q_UNUSED(placeholder);
return dataChanged(current, m_currentOffRouteMines, placeholder);
}
template <typename T>
void resetStartTime(int aesDdsId, T &cont)
{
auto it = cont.find(aesDdsId);
if (it == cont.end())
return;
it->second.effectStart(0);
}
void resetStartTime(const AreaEffectSimulation::AirSupportImpact &current)
{
resetStartTime(current.id(), m_currentBCContaminations);
}
void resetStartTime(const AreaEffectSimulation::BCContamination &current)
{
resetStartTime(current.id(), m_currentBCContaminations);
}
void resetStartTime(const AreaEffectSimulation::ExplosionArea &current)
{
resetStartTime(current.id(), m_currentExplosionArea);
}
void resetStartTime(const AreaEffectSimulation::ExplosionCluster &current)
{
resetStartTime(current.id(), m_currentExplosionCluster);
}
void resetStartTime(const AreaEffectSimulation::ExplosionSingle &current)
{
resetStartTime(current.id(), m_currentExplosionSingle);
}
void resetStartTime(const AreaEffectSimulation::MineArea &current)
{
resetStartTime(current.id(), m_currentMineArea);
}
void resetStartTime(const AreaEffectSimulation::NContamination &current)
{
resetStartTime(current.id(), m_currentNContamination);
}
void resetStartTime(const AreaEffectSimulation::FunctionalArea &current)
{
resetStartTime(current.id(), m_currentFunctionalArea);
}
void resetStartTime(const AreaEffectSimulation::TechnicalArea &current)
{
resetStartTime(current.id(), m_currentTechnicalArea);
}
void resetStartTime(const AreaEffectSimulation::DusSingleMine &current)
{
resetStartTime(current.id(), m_currentDusSingleMine);
}
void resetStartTime(const AreaEffectSimulation::GasPipe &current)
{
resetStartTime(current.id(), m_currentGasPipes);
}
void resetStartTime(const AreaEffectSimulation::BoobyTrap &current)
{
resetStartTime(current.id(), m_currentBoobyTraps);
}
void resetStartTime(const AreaEffectSimulation::OffRouteMine &current)
{
resetStartTime(current.id(), m_currentOffRouteMines);
}
std::shared_ptr<PdmHandler> pdm();
template<typename T>
void txData(const T &tele)
{
m_txCallback->txData(tele);
m_sentAesTelegrams.push_back(new T(tele));
m_sentAesTelegramsAesIds.push_back(tele.aesDdsId);
m_checkOutdatedTelegramsTimer->start();
DEBUG_LOG(m_logger) << "Appending " << tele.type()<< " to m_sentAesTelegrams";
}
void onCheckOutdatedTelegrams();
void onSendDusMineReactivationTimeout();
private:
std::unordered_map<int, AreaEffectSimulation::AirSupportImpact> m_currentAirSupportImpacts;
std::unordered_map<int, AreaEffectSimulation::BCContamination> m_currentBCContaminations;
std::unordered_map<int, AreaEffectSimulation::ExplosionArea> m_currentExplosionArea;
std::unordered_map<int, AreaEffectSimulation::ExplosionCluster> m_currentExplosionCluster;
std::unordered_map<int, AreaEffectSimulation::ExplosionSingle> m_currentExplosionSingle;
std::unordered_map<int, AreaEffectSimulation::MineArea> m_currentMineArea;
std::unordered_map<int, AreaEffectSimulation::TriggeredImpacts> m_temporarySingleMineState;
std::unordered_map<int, AreaEffectSimulation::NContamination> m_currentNContamination;
std::unordered_map<int, AreaEffectSimulation::FunctionalArea> m_currentFunctionalArea;
std::unordered_map<int, AreaEffectSimulation::TechnicalArea> m_currentTechnicalArea;
std::unordered_map<int, AreaEffectSimulation::DusSingleMine> m_currentDusSingleMine;
std::unordered_map<int, AreaEffectSimulation::GasPipe> m_currentGasPipes;
std::unordered_map<int, AreaEffectSimulation::BoobyTrap> m_currentBoobyTraps;
std::unordered_map<int, AreaEffectSimulation::OffRouteMine> m_currentOffRouteMines;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<SendToTab> m_txCallback;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
std::shared_ptr<AesStateHandler> m_aesStateHandler;
QMap<int, AreaEffectSimulation::AesEffectState> m_currentEffectState;
QMap<int, AreaEffectSimulation::DusMine> m_allReactivatableDusMines;
QVector<int> m_minesToSend;
std::shared_ptr<PositionHandler> m_posHandler;
MainHandler *m_mainHandler;
QTimer *m_checkOutdatedTelegramsTimer;
QTimer *m_sendDusMineReactivtionTimer;
QVector<TetraIcd::TrainingAreaTelegram*> m_sentAesTelegrams;
QVector<int> m_sentAesTelegramsAesIds;
};
}