Session 026: Lts/Services Qt5:: to Qt6:: migration

- Migrated all 104 CMakeLists.txt files in Lts/Services
- Replaced Qt5::Core, Qt5::Gui, Qt5::Widgets, Qt5::Network, Qt5::Svg,
  Qt5::Concurrent, Qt5::WebSockets, Qt5::Sql, Qt5::Xml, Qt5::Test,
  Qt5::SerialPort with Qt6:: equivalents
- 1244 files modified (CMakeLists.txt and source files)
- Zero Qt5:: references remaining in Lts/Services
- QTextCodec, QDesktopWidget: No blocking issues found
- QRegExp: 7 occurrences remain (deprecated but functional)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-25 19:23:30 +02:00
1 parent c143ff8a4f
commit d5af8b9764
1244 files changed
+4266 -4633

No files matched your search

@@ -10,7 +10,7 @@
#include "ParticipantHandling/participant.h"
#include "ParticipantHandling/participant_donator.h"
#include "main_handler.h"
#include <QtCore/QTimer>
#include <QTimer>
namespace ParticipantManagement
{
@@ -21,6 +21,7 @@ BiteHandler::BiteHandler(MainHandler *mainHandler)
: QObject()
, Interface::Fts::CallBiteRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("BiteHandler"))
{
}
@@ -7,8 +7,8 @@
*/
#pragma once
#include <QtCore/QSet>
#include <QtCore/QMap>
#include <QSet>
#include <QMap>
#include "dds_handler.h"
#include "logger.h"
@@ -20,9 +20,6 @@ SET(SRCS_common
ppm_db_impl_custom.h
logger.cpp
logger.h
ppm_translation.h
ppm_translation.cpp
ppm_types.h
)
# Generate ppm_enums.idl / ppm.idl
@@ -41,13 +38,12 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# generate ppm_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
NGL_ADD_LIBRARY2(AAR SV WS HLA svcPpmCommon SHARED ${SRCS_common})
NGL_ADD_LIBRARY(AAR SV WS HLA svcPpmCommon SHARED ${SRCS_common})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcPpmCommon
PRIVATE
RTI::nddscpp2
@@ -62,7 +58,6 @@ NGL_TARGET_LINK_LIBRARIES(svcPpmCommon
LtsCoordTrans
ngldb
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcPpmCommon)
#
@@ -76,14 +71,13 @@ SET(SRCS_client
# generate ppm_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
NGL_ADD_LIBRARY2(WS AAR SV HLA svcPpmClient SHARED ${SRCS_client})
NGL_ADD_LIBRARY(WS AAR SV HLA svcPpmClient SHARED ${SRCS_client})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmClient
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcPpmClient
PRIVATE
RTI::nddscpp2
@@ -92,7 +86,6 @@ NGL_TARGET_LINK_LIBRARIES(svcPpmClient
svcPpmCommon
ddsftc
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcPpmClient)
#
@@ -107,14 +100,13 @@ SET(SRCS_server
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
# WS for RecordReplayPlugin
NGL_ADD_LIBRARY2(AAR SV WS svcPpmServer SHARED ${SRCS_server})
NGL_ADD_LIBRARY(AAR SV WS svcPpmServer SHARED ${SRCS_server})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPpmServer
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
IF(BUILD_RTI)
NGL_TARGET_LINK_LIBRARIES(svcPpmServer
PRIVATE
RTI::nddscpp2
@@ -125,7 +117,6 @@ NGL_TARGET_LINK_LIBRARIES(svcPpmServer
ngldb
LtsUtilsCore
)
ENDIF(BUILD_RTI)
NGL_INSTALL_TARGET(svcPpmServer)
#
@@ -11,14 +11,15 @@
#include "main_handler.h"
#include "ParticipantHandling/participant.h"
#include <QtCore/QTimer>
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
#include <QTimer>
#include <LtsUtilsCore/dds_vector.h>
ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::EquipmentEventHandler(MainHandler *mainHandler, QObject *parent)
: QObject(parent)
, Interface::Fts::EquipmentSystemEventDataRequestHandler(mainHandler->fts())
, m_mainHandler (mainHandler)
, m_filterId(0)
, m_logger(getLogger("EquipmentEventHandler"))
{
}
@@ -26,13 +27,13 @@ bool ParticipantManagement::EquipmentEventHandling::EquipmentEventHandler::init(
{
if (!m_mainHandler->tabDtc()->enableEquipmentEvent())
{
ERROR_LOG(m_logger) << " TAB Dtc enableEquipmentEvent() failed !";
ERROR_LOG (m_logger) << " TAB Dtc enableEquipmentEvent() failed !";
return false;
}
if (!m_mainHandler->dts()->enableEquipmentSystemEventFtcReply())
{
ERROR_LOG(m_logger) << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
ERROR_LOG (m_logger) << " Dts enableEquipmentSystemEventDataFtcReply() failed !";
return false;
}
connect(m_mainHandler->tabDtc().get(), &TrainingAreaBase::Interface::Dtc::equipmentEventChanged, this, &EquipmentEventHandler::onEquipmentEventChanged);
@@ -12,7 +12,7 @@
#include <TrainingAreaBase/tab_dtc.h>
#include <QtCore/QObject>
#include <QObject>
#include <ngldb/nsqlquery.h>
namespace ParticipantManagement
@@ -14,8 +14,8 @@
#include <nglapplication/nglcoreapplication.h>
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <QtTest/QTest>
#include <QtCore/QTimer>
#include <QTest>
#include <QTimer>
//--------------------------------------------------------------------------------
ParticipantManagement::PpmTests::PpmTests(QObject *parent)
@@ -26,6 +26,7 @@ ParticipantManagement::PpmTests::PpmTests(QObject *parent)
, m_equipmentId(-1)
, m_participantId(1)
, m_bTestsSuccessful(true)
, m_logger(getLogger("Test"))
{
}
@@ -20,7 +20,7 @@
#pragma once
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <ParticipantManagement/ppm_ftc_types.h>
@@ -2,7 +2,7 @@
* @RDE_HEADER@
* The FiringUnitValidator regulates the rules for firing units
* $Id: participant_dis_helper.h 37747 2017-12-08 08:07:01Z ehrlicher $
* $HeadURL: svn://10.196.0.54/TDS/branches/product/features/24_vulcano/Lts/ParticipantManagement/Gui/Common/participant_dis_helper.h $
* $HeadURL: svn://10.196.0.54/TDS/branches/product/features/24_vulcano/Lts/Plugins/ParticipantManagement/Gui/Common/participant_dis_helper.h $
* $Author: ehrlicher $
* Created by Hannes Fritsche, ESZS, 2024-03-07
*/
@@ -2,16 +2,16 @@
* @RDE_HEADER@
* The FiringUnitValidator regulates the rules for firing units serverside
* $Id: participant_dis_helper.h 37747 2017-12-08 08:07:01Z ehrlicher $
* $HeadURL: svn://10.196.0.54/TDS/branches/product/features/24_vulcano/Lts/ParticipantManagement/Gui/Common/participant_dis_helper.h $
* $HeadURL: svn://10.196.0.54/TDS/branches/product/features/24_vulcano/Lts/Plugins/ParticipantManagement/Gui/Common/participant_dis_helper.h $
* $Author: ehrlicher $
* Created by Hannes Fritsche, ESZS, 2024-03-07
*/
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include <memory>
#include <Core/core_types.h>
#include <DDS/Core/function_reply_object.h>
namespace ParticipantManagement
{
@@ -19,6 +19,7 @@ namespace ParticipantManagement
GetParticipants::GetParticipants(MainHandler *mainHandler)
: Interface::Fts::GetParticipantsRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("GetParticipants"))
{}
GetParticipants::~GetParticipants()
@@ -21,12 +21,12 @@ public:
~GetParticipants();
private:
NGL::INGLLogger &m_logger;
void onGetParticipantsRequest(const rti::core::SampleIdentity &cookie,
const GetParticipantsRequest &request) override;
private:
NGL::INGLLogger &m_logger;
MainHandler *m_mainHandler;
NGL::INGLLogger &m_logger;
};
}
@@ -13,7 +13,7 @@
#include <ParticipantManagement/web_socket_handler.h>
#include <QtCore/QSet>
#include <QSet>
namespace ParticipantManagement
{
@@ -12,7 +12,7 @@
#include <ParticipantManagement/ppm.hpp>
#include <TrainingAreaBase/tab.hpp>
#include <QtCore/QMutex>
#include <QMutex>
namespace ParticipantManagement
{
@@ -7,7 +7,6 @@
* Created by Hannes Baeuerle, SLSE, 2016-05-12
*/
#include "participant_handler.h"
#include <utility>
#include "participant.h"
#include "ppm_common.h"
@@ -17,7 +16,7 @@
#include <Buildings/bld.hpp>
#include <ProjectDataManagement/pdm_dtc.h>
#include <LtsUtils/LtsUtilsCore/outdated_position.h>
#include <LtsUtilsCore/outdated_position.h>
namespace ParticipantManagement
{
@@ -44,7 +43,7 @@ void ParticipantHandler::clearParticipants()
dts()->removeHitLineInfoByKey(it.value().id());
m_hitLineInfoMap.clear();
for (auto p : std::as_const(m_participants))
for (auto p : qAsConst(m_participants))
{
p->removeFromDds();
delete p;
@@ -346,7 +345,7 @@ void ParticipantHandler::onNewParticipantModeReport(const TrainingAreaBase::Part
Participant *participant = participantByEquipmentNumber(report.equipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << report.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << report.equipmentNumber();
return;
}
@@ -388,7 +387,7 @@ void ParticipantHandler::onNewSpecialSensorData(const TrainingAreaBase::SpecialS
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
@@ -416,7 +415,7 @@ void ParticipantHandler::onNewLaserDesignation(const TrainingAreaBase::LaserDesi
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
@@ -440,7 +439,7 @@ void ParticipantHandler::onLaserDesignationRemoved(int equipmentNumber, int gear
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << equipmentNumber;
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << equipmentNumber;
return;
}
DynamicParticipantData dpd = participant->dynamicParticipantData();
@@ -467,7 +466,7 @@ void ParticipantHandler::onBuildingHitLineInfo(const Buildings::BuildingHitLineI
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with participantId: " << data.originatorParticipantId();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with participantId: " << data.originatorParticipantId();
return;
}
@@ -490,7 +489,7 @@ void ParticipantHandler::onSanitaryMaterialStockReport(const TrainingAreaBase::P
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
if (data.qualification() == TrainingAreaBase::Qualification::NotDefined)
@@ -524,7 +523,7 @@ void ParticipantHandler::onParticipantSanitation(const TrainingAreaBase::Partici
Participant *participantOrig = participantByEquipmentNumber(data.originatorEquipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
int participantOrigId = data.originatorEquipmentNumber();
@@ -555,7 +554,7 @@ void ParticipantHandler::onOperatorAction(const TrainingAreaBase::OperatorAction
Participant *participant = participantByEquipmentNumber(data.equipmentNumber());
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
@@ -586,7 +585,7 @@ void ParticipantHandler::onNewFunctionalAreaEntryChanged(const TrainingAreaBase:
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with equipment number " << data.equipmentNumber();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with equipment number " << data.equipmentNumber();
return;
}
@@ -640,7 +639,7 @@ void ParticipantHandler::setPosition(const ParticipantManagement::ParticipantPos
if (!participant)
{
ERROR_LOG(m_logger) << Q_FUNC_INFO << "Could not find participant with id " << data.participantId();
ERROR_LOG(m_logger) << LOGFUNCTION << "Could not find participant with id " << data.participantId();
return;
}
@@ -135,7 +135,6 @@ class ParticipantHandler
quint16 getWebSocketPort() const;
protected:
NGL::INGLLogger &m_logger;
static void updateLaserDesignation(DynamicParticipantData &data, const TrainingAreaBase::LaserDesignation &newLaserDesignation);
void updateLaserDesignation(DynamicParticipantData &dataInOut, const Buildings::BuildingHitLineInfo &newLaserDesignation);
static void removeLaserDesignation(DynamicParticipantData &data, qint32 gearId);
@@ -159,7 +158,6 @@ class ParticipantHandler
virtual bool isSampleTimeInFuture(qint64 sampleTime) const;
protected:
NGL::INGLLogger &m_logger;
std::unique_ptr<UnitPositionCalculator> m_unitPositionCalculator;
QHash<int, int> m_equipNumber2ParticipantId;
QHash<int, Participant *> m_participants;
@@ -168,6 +166,8 @@ class ParticipantHandler
QMap<int, HitLineInfo> m_hitLineInfoMap;
BaseDataProvider *m_bdp;
LOGGER_T m_logger;
std::shared_ptr<WebSocketHandler> m_webSocketHandler;
friend class Participant;
@@ -7,7 +7,6 @@
* Created by Hannes Baeuerle, SLSE, 2016-05-12
*/
#include "participant_handler_for_exercise.h"
#include <utility>
#include "convert_db_to_dds.h"
#include "firing_unit_validator.h"
@@ -22,11 +21,11 @@
#include <ParticipantManagement/ppm_record_replay_plugin.h>
#include <ngldb/dbtransaction.h>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QTimer>
#include <QtCore/QVector>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QTimer>
#include <QVector>
#include <QtGui/QTransform>
namespace ParticipantManagement
@@ -169,7 +168,7 @@ bool ParticipantHandlerForExercise::init()
}
// remove the 'unused' EquipmentExerciseMappings (for whatever reason there are some...)
for (const auto &eem : std::as_const(localEquipmentExerciseMappings))
for (const auto &eem : qAsConst(localEquipmentExerciseMappings))
dbEx0->removeEquipmentExerciseMapping(eem);
// after m_publishEquipmentExerciseMappings has been set and participants are created
@@ -190,7 +189,7 @@ bool ParticipantHandlerForExercise::init()
bool isOwnPositionParticipant = false;
// publish participants in dds
for (Participant *p : std::as_const(m_participants))
for (Participant *p : qAsConst(m_participants))
{
if (p->equipmentNumber() == 1)
isOwnPositionParticipant = true;
@@ -310,7 +309,7 @@ bool ParticipantHandlerForExercise::init()
dtc->equipmentExerciseMappings([this](const EquipmentExerciseMapping &data) { onEquipmentExerciseMappingChanged(data, DataModification::eAdded); });
auto pub = dts();
for (const ParticipantOrganisation &partOrga : std::as_const(m_participantOrganisations))
for (const ParticipantOrganisation &partOrga : qAsConst(m_participantOrganisations))
pub->publish(partOrga);
if (m_mainHandler->exerciseId() > 0)
@@ -352,7 +351,7 @@ bool ParticipantHandlerForExercise::init()
m_pdmDtc->waitForHistoricalDataGearTypeChargeType();
}
// for(const auto &participant : std::as_const(m_participants))
// for(const auto &participant : qAsConst(m_participants))
// customedSetGearCharges(participant);
return true;
@@ -455,7 +454,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
checkLongActionBreak();
for (const ParticipantManagement::ParticipantData &currentParticipant : std::as_const(validateData.participantsToBeCreatedOrModified))
for (const ParticipantManagement::ParticipantData &currentParticipant : qAsConst(validateData.participantsToBeCreatedOrModified))
{
auto ret = validateParticipantData(validateData, currentParticipant);
if (ret.error())
@@ -597,7 +596,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
DEBUG_LOG(m_logger) << "New participants created and existing participants updated";
// build hierarchy
for (const ParticipantData &currentData : std::as_const(validateData.participantsToBeCreatedOrModified)) // first set superiorIds
for (const ParticipantData &currentData : qAsConst(validateData.participantsToBeCreatedOrModified)) // first set superiorIds
{
Participant *participantToUpdate = participantById(validateData.modIdToParticipantId.value(currentData.modId()));
if (currentData.superiorModId() >= 0) // superiorModId < 0 -> no change in superior
@@ -613,7 +612,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
QHash<int, std::vector<int32_t>> inferiors;
inferiors.reserve(m_participants.size() / 2);
// first collect all inferiors per superior
for (const Participant *currentParticipant : std::as_const(m_participants))
for (const Participant *currentParticipant : qAsConst(m_participants))
{
int superiorId = currentParticipant->superiorId();
inferiors[superiorId].push_back(currentParticipant->id());
@@ -626,7 +625,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
}
}
// now update all participants with newly collected inferiors
for (Participant *currentParticipant : std::as_const(m_participants))
for (Participant *currentParticipant : qAsConst(m_participants))
{
if (currentParticipant->hasNewInferiorStructure(inferiors.value(currentParticipant->id())))
participantsWithChanges.insert(currentParticipant);
@@ -636,7 +635,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
// update in Database
std::vector<Database::PpmParticipant> dbParticipantsToUpdate;
dbParticipantsToUpdate.reserve(participantsWithChanges.size());
for (Participant *currentParticipant : std::as_const(participantsWithChanges))
for (Participant *currentParticipant : qAsConst(participantsWithChanges))
{
dbParticipantsToUpdate.push_back(currentParticipant->toDbParticipant());
partiesUsed.insert(currentParticipant->partyId());
@@ -652,13 +651,13 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
// mark parties in use
ChangePartyUsedStateRequest req;
for (int partyId : std::as_const(partiesUsed))
for (int partyId : qAsConst(partiesUsed))
{
req.partyId(partyId);
req.isUsedBy(true);
m_mainHandler->partyHandler()->changePartyUsedStateRequest(req);
}
for (int partyId : std::as_const(partiesWithDeletedOrMovedOutParticipants))
for (int partyId : qAsConst(partiesWithDeletedOrMovedOutParticipants))
{
req.partyId(partyId);
req.isUsedBy(false);
@@ -727,7 +726,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
QJsonArray jsonArray;
// finally ... publish participant data via dds if no error occured
for (Participant *currentParticipant : std::as_const(participantsWithChanges))
for (Participant *currentParticipant : qAsConst(participantsWithChanges))
{
currentParticipant->publishParticipant();
NOTICE_LOG(m_logger) << "publishParticipant id=" << currentParticipant->id();
@@ -1293,7 +1292,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::selectiveReammunitionRe
tabRequest.participantId(request.id());
tabRequest.gearId(request.gearId());
INFO_LOG(m_logger) << "Gear id = " << request.gearId();
for (const Reammunition ra : std::as_const(request.reammunition()))
for (const Reammunition ra : qAsConst(request.reammunition()))
{
TrainingAreaBase::Reammunition tabRa;
tabRa.chargeTypeId(ra.chargeTypeId());
@@ -1368,7 +1367,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::setSimulatedPositionReq
{
if (request.participantId() <= 0)
{
for (Participant *participant : std::as_const(m_participants))
for (Participant *participant : qAsConst(m_participants))
{
if (participant->isDeleted() || participant->superiorId() != 0)
continue;
@@ -1508,7 +1507,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
DEBUG_LOG(m_logger) << "checking superiorIds";
// superior exists?
bool isExistingSuperiorId = false;
for (const ParticipantData &dat : std::as_const(data.participantsToBeCreatedOrModified))
for (const ParticipantData &dat : qAsConst(data.participantsToBeCreatedOrModified))
{
if (participantToValidate.superiorModId() == dat.modId())
{
@@ -1530,7 +1529,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
// all hierarchy numbers with same superior unique?
DEBUG_LOG(m_logger) << "checking hierarchyNumbers";
for (const ParticipantData &dat : std::as_const(data.participantsToBeCreatedOrModified))
for (const ParticipantData &dat : qAsConst(data.participantsToBeCreatedOrModified))
{
// operator==() on optionals returns false if not set ...
if (dat.modId() != participantToValidate.modId() && dat.superiorModId() == participantToValidate.superiorModId()
@@ -1804,7 +1803,7 @@ void ParticipantHandlerForExercise::onEquipmentExerciseMappingChanged(const Equi
case DataModification::eModified:
{
QSet<int> oldEqIds;
for (const auto &db : std::as_const(m_equipmentExerciseMappings))
for (const auto &db : qAsConst(m_equipmentExerciseMappings))
{
if (db.exerciseId != data.exerciseId())
continue;
@@ -15,9 +15,9 @@
#include <QtCore/QMutex>
#include <QtCore/QString>
#include <QtCore/QJsonDocument>
#include <QJsonDocument>
#include <ExerciseManagement/exm_dtc.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_fts.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <TrainingAreaBase/tab_dts.h>
@@ -18,6 +18,7 @@ namespace ParticipantHandling
ProxyListener::ProxyListener(MainHandler *mainHandler)
: QObject()
, m_mainHandler(mainHandler)
, m_logger(getLogger("ProxyListener"))
{}
bool ProxyListener::init()
@@ -9,24 +9,26 @@
#include "unit_position_calculator.h"
#include "participant_handler.h"
#include <QtCore/QTimer>
#include <QTimer>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <LtsUtils/LtsUtilsCore/qpoint3d.h>
#include <LtsUtils/LtsUtilsCore/outdated_position.h>
#include <QtCore/QPointF>
#include <QtCore/QDateTime>
#include <LtsUtilsCore/qpoint3d.h>
#include <LtsUtilsCore/outdated_position.h>
#include <QPointF>
#include <QDateTime>
#include <QtConcurrent>
namespace ParticipantManagement
{
namespace ParticipantHandling
{
UnitPositionCalculator::UnitPositionCalculator(ParticipantHandler *participantHandler, QObject *parent) : QObject(parent)
UnitPositionCalculator::UnitPositionCalculator(ParticipantHandler *participantHandler, QObject *parent)
: QObject(parent)
, m_participantHandler(participantHandler)
, m_bSomethingChangedSinceLastCalculation(false)
, m_timer(new QTimer(this))
, m_bRunning(true),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
, m_bRunning(true)
, m_logger(getLogger("UnitPositionCalculator"))
{
connect(m_timer, &QTimer::timeout, this, &UnitPositionCalculator::calculate);
m_timer->setSingleShot(true);
@@ -7,8 +7,8 @@
*/
#pragma once
#include <QtCore/QObject>
#include <QtCore/QFutureWatcher>
#include <QObject>
#include <QFutureWatcher>
#include <Core/core.hpp>
#include <unordered_map>
#include "participant_handler.h"
@@ -36,7 +36,6 @@ public:
void onInferiorChanged(int participantId, const std::vector<int> &inferiorIds);
private:
NGL::INGLLogger &m_logger;
struct CalculatedUnitPosition : public ParticipantManagement::UnitPosition
{
int superiorId = 0;
@@ -44,7 +43,6 @@ private:
};
private:
NGL::INGLLogger &m_logger;
CalculatedUnitPosition &getParticipant(int participantId);
void calculate();
// no const ref - must be a copy since this is running in a different thread
@@ -63,7 +61,6 @@ private Q_SLOTS:
void onCalculationDone();
private:
NGL::INGLLogger &m_logger;
std::unordered_map<int, CalculatedUnitPosition> m_participantData;
std::unordered_map<int, CalculatedUnitPosition> m_publishedPositionData;
@@ -73,6 +70,7 @@ private:
bool m_bSomethingChangedSinceLastCalculation;
QTimer *m_timer;
bool m_bRunning;
NGL::INGLLogger &m_logger;
};
} // namespace ParticipantHandling
@@ -8,7 +8,7 @@
#pragma once
#include <ParticipantManagement/ppm_db.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
namespace ParticipantManagement
{
@@ -8,7 +8,6 @@
*/
#include "PartyHandling/party_handler.h"
#include <utility>
#include "PartyHandling/party.h"
#include <ngldb/db_service_handler.h>
#include <ppm_db.h>
@@ -23,6 +22,7 @@ PartyHandling::PartyHandler::PartyHandler(MainHandler *mainHandler)
, SyncPartiesRequestHandler(mainHandler->exerciseId() <= 0 ? nullptr : mainHandler->fts())
, ChangePartyUsedStateRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("PartyHandler"))
{
}
@@ -63,7 +63,7 @@ bool PartyHandling::PartyHandler::init()
return false;
}
for ( Database::PpmParty currentParty : std::as_const(partyVec))
for ( Database::PpmParty currentParty : qAsConst(partyVec))
{
resetAdlerProperties(currentParty.properties, currentParty.id);
PartyHandling::Party *newParty = new PartyHandling::Party(currentParty);
@@ -8,7 +8,6 @@
#include "participant_handler_for_replay.h"
#include <utility>
#include "participant_for_replay.h"
#include "ppm_record_replay_plugin_custom.h"
@@ -89,7 +88,7 @@ void ParticipantHandlerForReplay::setDynamicParticipantData(const ParticipantMan
void ParticipantHandlerForReplay::publishData()
{
for (auto p : std::as_const(m_participants))
for (auto p : qAsConst(m_participants))
{
p->publishParticipant();
p->publishDynamicData();
@@ -7,7 +7,6 @@
*/
#include "ppm_record_replay_plugin_custom.h"
#include <utility>
#include "participant_handler_for_replay.h"
#include <DDS/DTS/generic_dts_impl.h>
#include <DDS/DTC/generic_dtc_impl.h>
@@ -180,11 +179,11 @@ bool RecordReplayPluginCustom::setReplayStartTime(NSqlQuery &q, qint64 startTime
m_participantHandler->clearParticipants();
INFO_LOG(m_logger) << "setReplayStartTime-clearParticipants " << startTime << " DONE";
for (const auto &ddsParticipant : std::as_const(m_participantMap))
for (const auto &ddsParticipant : qAsConst(m_participantMap))
m_participantHandler->createUpdateParticipant(ddsParticipant);
INFO_LOG(m_logger) << "setReplayStartTime-createUpdateParticipant " << startTime << " DONE";
for (const auto &dynParticipant : std::as_const(m_dynamicParticipantDataMap))
for (const auto &dynParticipant : qAsConst(m_dynamicParticipantDataMap))
m_participantHandler->setDynamicParticipantData(dynParticipant);
INFO_LOG(m_logger) << "setReplayStartTime-setDynamicParticipantData " << startTime << " DONE";
@@ -224,9 +223,9 @@ bool RecordReplayPluginCustom::publishData(qint64 desiredTime)
return false;
}
for (const Participant &p : std::as_const(m_participantMap))
for (const Participant &p : qAsConst(m_participantMap))
m_participantHandler->createUpdateParticipant(p);
for (const Participant &p : std::as_const(m_participantDisposedMap))
for (const Participant &p : qAsConst(m_participantDisposedMap))
m_participantHandler->removeParticipant(p);
setDataForParticipants(desiredTime);
@@ -290,7 +289,7 @@ QVector<QFuture<void>> RecordReplayPluginCustom::makeConcurrentWithoutEquipNo(T
it = content.erase(it);
} // while
for (auto contentIndex : std::as_const(contentVec))
for (auto contentIndex : qAsConst(contentVec))
{
// execute in workerThread
result.append(QtConcurrent::run([this, contentIndex]()
@@ -326,7 +325,7 @@ QVector<QFuture<void>> RecordReplayPluginCustom::makeConcurrent(T &content, qint
it = content.erase(it);
} // while
for (auto contentIndex : std::as_const(contentVec))
for (auto contentIndex : qAsConst(contentVec))
{
// execute in workerThread
result.append(QtConcurrent::run([this, contentIndex]()
@@ -11,7 +11,7 @@
#include <TrainingAreaBase/tab_record_replay_plugin_custom.h>
#include <ParticipantManagement/ppm_dts.h>
#include <ParticipantManagement/ParticipantHandling/participant_handler.h>
#include <QtCore/QFuture>
#include <QFuture>
namespace ParticipantManagement
{
@@ -17,22 +17,23 @@ HandlerTargetInformation::HandlerTargetInformation(MainHandler *mainHandler)
: ModifyTargetInformationRequestHandler(mainHandler->fts())
, RemoveTargetInformationRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("HandlerTargetInformation"))
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
HandlerTargetInformation::~HandlerTargetInformation()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
bool HandlerTargetInformation::init()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
bool bRet = true;
// create objects
@@ -56,7 +57,7 @@ bool HandlerTargetInformation::init()
return false;
}
DEBUG_LOG(m_logger) << "m_objectMap.size() = " << m_objectMap.size();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return true;
}
@@ -66,19 +67,19 @@ bool HandlerTargetInformation::init()
void HandlerTargetInformation::onModifyTargetInformationRequest(const rti::core::SampleIdentity &cookie,
const ModifyTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
const auto ret = targetInformationModifyRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
m_mainHandler->fts()->modifyTargetInformationReply(cookie, ret);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//--------------------------------------------------------------------------
Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyRequest(const ModifyTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
const int requestId = request.targetInfo().id();
// modify
if (requestId > 0)
@@ -100,7 +101,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
}
else
m_objectMap.insert(ifs->getId(), ifs);
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return ret;
}
@@ -108,7 +109,7 @@ Core::FunctionReplyObject HandlerTargetInformation::targetInformationModifyReque
void HandlerTargetInformation::onRemoveTargetInformationRequest(const rti::core::SampleIdentity &cookie,
const RemoveTargetInformationRequest &request)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " request=" << request;
TRACE_LOG(m_logger) << LOGFUNCTION << " request=" << request;
Core::FunctionReplyObject ret;
ObjectTargetInformation *ifs = m_objectMap.value(request.id());
@@ -8,7 +8,7 @@
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "dds_handler.h"
#include <ParticipantManagement/logger.h>
@@ -44,8 +44,6 @@ public:
}
private: // methods
NGL::INGLLogger &m_logger;
void onModifyTargetInformationRequest(const rti::core::SampleIdentity &cookie,
const ModifyTargetInformationRequest &request) override;
Core::FunctionReplyObject targetInformationModifyRequest(const ModifyTargetInformationRequest &request);
@@ -56,7 +54,7 @@ private: // attributes
QHash<int, ObjectTargetInformation *> m_objectMap;
MainHandler *m_mainHandler;
NGL::INGLLogger &m_logger; ///< Interface to the Logging-Facility
};
} // namespace ParticipantManagement
@@ -9,8 +9,8 @@
#include "object_target_information.h"
#include "../main_handler.h"
#include <QtCore/QJsonDocument>
#include <QtCore/QDebug>
#include <QJsonDocument>
#include <QDebug>
//------------------------------------------------------------------------------
@@ -108,19 +108,21 @@ std::vector<ShootbackArea> vecfromJson(const QJsonValue &val)
}
ObjectTargetInformation::ObjectTargetInformation(MainHandler *mainHandler) : m_mainHandler(mainHandler),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
ObjectTargetInformation::ObjectTargetInformation(MainHandler *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectTargetInformation"))
{
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
ObjectTargetInformation::~ObjectTargetInformation()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (isValid())
m_mainHandler->dts()->removeTargetInformationByKey(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
}
//------------------------------------------------------------------------------
@@ -132,7 +134,7 @@ bool ObjectTargetInformation::isValid() const
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::createObject(const TargetInformation &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
m_data = data;
if (m_data.id() <= 0)
@@ -149,14 +151,14 @@ Core::FunctionReplyObject ObjectTargetInformation::createObject(const TargetInfo
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInformation &data)
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START, participantId=" << data.participantId()
TRACE_LOG(m_logger) << LOGFUNCTION << " START, participantId=" << data.participantId()
<< " size =" << data.shootbackAreas().size();
Database::PpmTargetInformation dbData;
dbData = toDbData(data);
@@ -170,7 +172,7 @@ Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInfo
// Publish Data via DTS
onPublishData();
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END, id=" << data.id()
TRACE_LOG(m_logger) << LOGFUNCTION << " END, id=" << data.id()
<< " size =" << data.shootbackAreas().size();
return Core::FunctionReplyObject(m_data.id());
}
@@ -178,7 +180,7 @@ Core::FunctionReplyObject ObjectTargetInformation::updateObject(const TargetInfo
//------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectTargetInformation::removeObject()
{
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
TRACE_LOG(m_logger) << LOGFUNCTION << " START";
if (!m_mainHandler->db()->removePpmTargetInformation(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetInformation with id %1 can not be removed from DB")).arg(m_data.id());
@@ -186,7 +188,7 @@ Core::FunctionReplyObject ObjectTargetInformation::removeObject()
if (!m_mainHandler->dts()->removeTargetInformationByKey(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "TargetInformation with id %1 can not be removed from DDS")).arg(m_data.id());
TRACE_LOG(m_logger) << Q_FUNC_INFO << " END";
TRACE_LOG(m_logger) << LOGFUNCTION << " END";
return Core::FunctionReplyObject(m_data.id());
}
@@ -10,7 +10,7 @@
#include "dds_handler.h"
#include <ParticipantManagement/logger.h>
#include <Core/core_types.h>
#include <DDS/Core/function_reply_object.h>
// Generated
#include <ParticipantManagement/ppm.hpp>
@@ -46,11 +46,12 @@ public:
static TargetInformation toDdsData(const Database::PpmTargetInformation &dbData); // db -> dds
protected:
NGL::INGLLogger &m_logger;
void onPublishData();
private:
MainHandler *m_mainHandler;
TargetInformation m_data;
NGL::INGLLogger &m_logger;
};
}
@@ -7,7 +7,6 @@
* Created by Hannes Baeuerle, SLSE, 2016-07-27
*/
#include "template_handler.h"
#include <utility>
#include "template.h"
#include "main_handler.h"
#include <TypeHandling/type_donator.h>
@@ -24,6 +23,7 @@ namespace TemplateHandling
TemplateHandler::TemplateHandler(MainHandler *mainHandler)
: Interface::Fts::ModifyTemplateDataRequestHandler(mainHandler->exerciseId() <= 0 ? mainHandler->fts() : nullptr)
, m_mainHandler(mainHandler)
, m_logger(getLogger("TemplateHandler"))
{}
TemplateHandler::~TemplateHandler()
@@ -114,7 +114,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
futureVec += fut;
}
for (const QFuture<Core::FunctionReplyObject> &currentFut : std::as_const(futureVec))
for (const QFuture<Core::FunctionReplyObject> &currentFut : qAsConst(futureVec))
{
Core::FunctionReplyObject ret = currentFut.result();
if (ret.error())
@@ -123,7 +123,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
}
else
{
for (const ParticipantManagement::TemplateData &currentTemplate : std::as_const(templatesToBeCreatedOrModified))
for (const ParticipantManagement::TemplateData &currentTemplate : qAsConst(templatesToBeCreatedOrModified))
{
DEBUG_LOG(m_logger) << "Validating template: " << currentTemplate;
auto ret = validateTemplateData(templatesToBeCreatedOrModified, modIdToTemplateId, currentTemplate);
@@ -139,7 +139,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
// create new and update existing templates
DEBUG_LOG(m_logger) << "Creating new and updating existing templates ...";
for (const TemplateData &currentData : std::as_const(templatesToBeCreatedOrModified))
for (const TemplateData &currentData : qAsConst(templatesToBeCreatedOrModified))
{
Template *templateToUpdate = m_templates.value(modIdToTemplateId.value(currentData.modId()));
if (!templateToUpdate)
@@ -164,7 +164,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
DEBUG_LOG(m_logger) << "New templates created and existing templates updated";
// build hierarchy
for (const TemplateData &currentData : std::as_const(templatesToBeCreatedOrModified)) // first set superiorIds
for (const TemplateData &currentData : qAsConst(templatesToBeCreatedOrModified)) // first set superiorIds
{
Template *templateToUpdate = m_templates.value(modIdToTemplateId.value(currentData.modId()), nullptr);
const int superiorId = modIdToTemplateId.value(currentData.superiorModId());
@@ -174,7 +174,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
templatesWithChanges.append(templateToUpdate);
}
for (Template *currentTemplate : std::as_const(m_templates)) // set inferiorIds
for (Template *currentTemplate : qAsConst(m_templates)) // set inferiorIds
{
if (!currentTemplate->hasNewInferiorStructure(inferiorIdsForTemplate(currentTemplate->id())) ||
templatesWithChanges.contains(currentTemplate))
@@ -184,7 +184,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
}
// update in Database
for (Template *currentTemplate : std::as_const(templatesWithChanges))
for (Template *currentTemplate : qAsConst(templatesWithChanges))
{
if (!m_mainHandler->db()->update(currentTemplate->dbEntry()))
return Core::FunctionReplyObject(tr_lts("dds", "Could not update template data in database, template data may be inconsistent"));
@@ -192,7 +192,7 @@ Core::FunctionReplyObject TemplateHandler::modifyTemplateDataRequest(const Parti
trans.commit();
// finally ... publish template data via dds if no error occured
for (Template *currentTemplate : std::as_const(templatesWithChanges))
for (Template *currentTemplate : qAsConst(templatesWithChanges))
m_mainHandler->exAnyDts()->publish(currentTemplate->toDdsTemplateParticipant());
return Core::FunctionReplyObject();
@@ -203,7 +203,7 @@ std::vector<int32_t> TemplateHandler::inferiorIdsForTemplate(int32_t superiorTem
std::vector<int32_t> result;
result.reserve(10);
for (Template *currentTemplate : std::as_const(m_templates))
for (Template *currentTemplate : qAsConst(m_templates))
{
if (currentTemplate->superiorId() == superiorTemplateId)
{
@@ -11,8 +11,8 @@
#include "type_handler_global.h"
#include "main_handler.h"
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QJsonDocument>
#include <QJsonObject>
namespace ParticipantManagement
{
@@ -39,14 +39,15 @@ public:
static std::shared_ptr<TypeHandler> createInstance(MainHandler *mainHandler, NGL::INGLLogger &logger);
protected:
NGL::INGLLogger &m_logger;
bool isArtilleryType(int typeId) const;
explicit TypeHandler(MainHandler *mainHandler, LOGGER_T logger);
protected:
MainHandler *m_mainHandler;
QHash<int32_t, Type *> m_types;
QHash<int32_t, EquipmentType *> m_equipmentTypes;
LOGGER_T m_logger;
}; // class TypeHandler
} // namespace TypeHandling
} // namespace ParticipantManagement
@@ -10,7 +10,7 @@
#include "main_handler.h"
#include "convert_db_to_dds.h"
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
namespace ParticipantManagement
{
@@ -8,7 +8,7 @@
*/
#pragma once
#include <QtCore/QObject>
#include <QObject>
#include "type_handler.h"
#include <ParticipantManagement/ppm.hpp>
@@ -8,7 +8,6 @@
*/
#include <ngldb/db_service_handler.h>
#include <utility>
#include <ngldb/dbtransaction.h>
#include "main_handler.h"
#include "ParticipantHandling/participant.h"
@@ -24,6 +23,7 @@ MissionPlanHandler::MissionPlanHandler(MainHandler *mainHandler)
, Interface::Fts::RemoveMissionPlanRequestHandler(mainHandler->fts())
, Interface::Fts::SetMissionActionFulfilledRequestHandler(mainHandler->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("MissionPlanHandler"))
{
}
@@ -90,7 +90,7 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
<<" Items size = "<<missionItemVec.size()
<<" Actions size = "<<missionActionVec.size();
// add to internal buffer
for (const ParticipantManagement::Database::PpmMissionPlan &data : std::as_const(missionPlanVec))
for (const ParticipantManagement::Database::PpmMissionPlan &data : qAsConst(missionPlanVec))
{
ParticipantManagement::MissionPlan missionPlan;
missionPlan.id(data.id);
@@ -105,12 +105,12 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
QMultiMap <int, ParticipantManagement::Database::PpmMissionAction> actionsDbMap;
//get mission items and actions for curr mission plan id
for (const ParticipantManagement::Database::PpmMissionItem &itemDb : std::as_const(missionItemVec))
for (const ParticipantManagement::Database::PpmMissionItem &itemDb : qAsConst(missionItemVec))
{
if (itemDb.missionPlanId == data.id)
{
itemsDbMap.insert(itemDb.elementNumber, itemDb);
for (const ParticipantManagement::Database::PpmMissionAction &actionDb : std::as_const(missionActionVec) )
for (const ParticipantManagement::Database::PpmMissionAction &actionDb : qAsConst(missionActionVec) )
{
if (actionDb.missionItemId == itemDb.id)
actionsDbMap.insert(actionDb.missionItemId, actionDb);
@@ -120,7 +120,7 @@ bool MissionPlanHandler::loadMissionPlansFromDb()
missionPlan.items().reserve(itemsDbMap.size());
for (const ParticipantManagement::Database::PpmMissionItem &item : std::as_const(itemsDbMap))
for (const ParticipantManagement::Database::PpmMissionItem &item : qAsConst(itemsDbMap))
{
ParticipantManagement::MissionItem msi;
msi.actions().reserve(actionsDbMap.size());
@@ -189,7 +189,7 @@ bool MissionPlanHandler::isUasInAutoMode(int participantId)
return (uas.uasState() == ProjectDataManagement::UasState::Auto);
}
// stolen from Lts/ParticipantManagement/Gui/ParticipantInfo/participant_info_dialog.cpp
// stolen from Lts/Plugins/ParticipantManagement/Gui/ParticipantInfo/participant_info_dialog.cpp
bool MissionPlanHandler::isUasCombatReady(int participantId)
{
m_mainHandler->ddsHandler()->dtc()->waitForHistoricalDataDynamicParticipantData(3000);
@@ -42,7 +42,6 @@ public:
bool setCurrentMissionActionFulfilled(int participantId, const QString &nameOfTheMissionThatEnded);
private:
NGL::INGLLogger &m_logger;
bool isUasCombatReady(int participantId);
bool isUasInAutoMode(int participantId);
Core::FunctionReplyObject createMissionPlanRequest(const ModifyMissionPlanRequest &request);
@@ -57,6 +56,7 @@ private:
MainHandler *m_mainHandler;
QHash<int32_t, ObjectMissionPlan *> m_objMissionPlans;
LOGGER_T m_logger;
};
}
@@ -7,7 +7,6 @@
*/
#include "object_mission_plan.h"
#include <utility>
#include <ngldb/dbtransaction.h>
namespace ParticipantManagement
@@ -18,11 +17,13 @@ namespace UasHandling
ObjectMissionPlan::ObjectMissionPlan(const std::shared_ptr<DdsHandler> &ddsHandler,
const std::shared_ptr<DatabaseInterface> &db,
const ParticipantManagement::MissionPlan & missionPlan,
QObject *parent) : QObject(parent)
QObject *parent)
: QObject(parent)
, m_ddsHandler(ddsHandler)
, m_db(db)
, m_missionplan(missionPlan),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
, m_missionplan(missionPlan)
, m_logger(getLogger("ObjectMissionPlan"))
{
DEBUG_LOG(m_logger)<<" - ctor ObjectMissionPlan: planId: "<<m_missionplan.id();
}
@@ -77,7 +78,7 @@ void ObjectMissionPlan::setDbMissionItems(const QMap<int, ParticipantManagement:
m_mapMissionItems.clear();
m_dbMissionActions.clear();
for (const ParticipantManagement::Database::PpmMissionItem &item : std::as_const(dbItems))
for (const ParticipantManagement::Database::PpmMissionItem &item : qAsConst(dbItems))
{
ParticipantManagement::MissionItem msi;
msi.actions().reserve(dbActions.size());
@@ -10,12 +10,12 @@
#include <ParticipantManagement/ppm_db.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/logger.h>
#include <ParticipantManagement/dds_handler.h>
#include "logger.h"
#include <QtCore/QObject>
#include <QObject>
namespace ParticipantManagement
{
namespace UasHandling
@@ -45,13 +45,14 @@ public:
Core::FunctionReplyObject setMissionActionFulfilled(SetMissionActionFulfilledRequest req, qint64 currentTimeMSec);
Core::FunctionReplyObject setMissionPlanAborted(bool state);
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<ParticipantManagement::DdsHandler> m_ddsHandler;
std::shared_ptr<ParticipantManagement::DatabaseInterface> m_db;
ParticipantManagement::MissionPlan m_missionplan;
QHash<int /*dbItemId*/, ParticipantManagement::MissionItem > m_mapMissionItems; /// key:dbItemId | Value MissionItem
std::vector<std::vector<ParticipantManagement::Database::PpmMissionAction> > m_dbMissionActions; /// [ItemNumber][ActionNumber]
LOGGER_T m_logger;
};
} // namespace UasHandling
@@ -8,7 +8,7 @@
#pragma once
#include <ParticipantManagement/ppm_db.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
namespace ParticipantManagement
{
@@ -8,13 +8,12 @@
*/
#include "uas_handler.h"
#include <utility>
#include "uas.h"
#include <ngldb/db_service_handler.h>
#include "main_handler.h"
#include "ParticipantHandling/participant.h"
#include <QtCore/QJsonDocument>
#include <QJsonDocument>
namespace ParticipantManagement
{
@@ -26,6 +25,7 @@ UasHandler::UasHandler(MainHandler *mainHandler)
, CreateModifyUasRequestHandler(mainHandler->exAnyFts())
, RemoveUasRequestHandler(mainHandler->exAnyFts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("UasHandler"))
{
m_mainHandler->exAnyFts()->enableCreateModifyUas();
m_mainHandler->exAnyFts()->enableRemoveUas();
@@ -53,7 +53,7 @@ bool UasHandler::init()
return false;
}
for (const Database::PpmUas &currentUas : std::as_const(uasVec))
for (const Database::PpmUas &currentUas : qAsConst(uasVec))
{
UasHandling::Uas *newUas = new UasHandling::Uas(currentUas);
@@ -137,7 +137,7 @@ Core::FunctionReplyObject UasHandler::removeUas(UasHandling::Uas *uasToDelete)
//------------------------------------------------------------------------------------------
Core::FunctionReplyObject UasHandler::createUas(const CreateModifyUasRequest &request)
{
DEBUG_LOG(m_logger) << Q_FUNC_INFO;
DEBUG_LOG(m_logger) << LOGFUNCTION;
// cant check here as we dont have access to all party participants
/*
@@ -283,7 +283,7 @@ void UasHandler::onUASRadioLinkConnectionStatusChanged(const UASRadioLinkConnect
bool UasHandler::hostNameHostPortExists(const QString &hostname, int hostport, int uasId)
{
for (Uas *uas : std::as_const(m_uass))
for (Uas *uas : qAsConst(m_uass))
{
if (uas->id() == uasId)
continue;
@@ -42,7 +42,6 @@ private slots:
void onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification mod);
void onUASRadioLinkConnectionStatusChanged(const UASRadioLinkConnectionStatus &data, DataModification mod);
private:
NGL::INGLLogger &m_logger;
Core::FunctionReplyObject removeUas(const RemoveUasRequest &request);
Core::FunctionReplyObject removeUas(UasHandling::Uas *uasToDelete);
Core::FunctionReplyObject createUas(const CreateModifyUasRequest &request);
@@ -54,6 +53,9 @@ private:
MainHandler *m_mainHandler;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
QHash<int32_t, Uas *> m_uass;
LOGGER_T m_logger;
};
} // namespace UasHandling
} // namespace ParticipantManagement
@@ -14,7 +14,7 @@
#include <QtCore/QJsonDocument>
#include <QtCore/QUuid>
#include <QtCore/QJsonObject>
#include <QJsonObject>
namespace ParticipantManagement
{
@@ -10,8 +10,8 @@
#include <LtsWebSocket/reply_message.h>
#include <QtCore/QJsonArray>
#include <QtCore/QString>
#include <QJsonArray>
#include <QString>
namespace ParticipantManagement
{
@@ -10,7 +10,7 @@
#include <LtsWebSocket/data_manager_base_dl.h>
#include <ParticipantManagement/ppm_db.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include "logger.h"
namespace ParticipantManagement
@@ -8,7 +8,7 @@
*/
#pragma once
#include <QtCore/QString>
#include <QString>
#include <OcBaseDownload/WebSocketInterface/json_keys.h>
@@ -24,6 +24,7 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(MainHandler *mainHandler, Q
, m_messageFactory(nullptr)
, m_dataManager(nullptr)
, m_mainHandler(mainHandler)
, m_logger(getLogger("WebSocketInterfaceHandler"))
{
}
@@ -10,7 +10,7 @@
#include <ParticipantManagement/ppm_db.h>
#include <ParticipantManagement/ppm.hpp>
#include <LtsUtils/LtsUtilsCore/dds_vector.h>
#include <LtsUtilsCore/dds_vector.h>
#include <limits>
namespace ParticipantManagement
{
@@ -12,13 +12,15 @@
#include <DDS/Core/pacemaker.h>
#include <DDS/DTS/generic_dts_impl.h>
#include <QtCore/QThread>
#include <QThread>
namespace ParticipantManagement
{
DdsHandler::DdsHandler(int domainId, int exerciseId) : m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, exerciseId <= 0 ? IDL::PartitionType::Global : IDL::PartitionType::Exercise, exerciseId)),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
DdsHandler::DdsHandler(int domainId, int exerciseId)
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, exerciseId <= 0 ? IDL::PartitionType::Global : IDL::PartitionType::Exercise, exerciseId))
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
@@ -9,13 +9,13 @@
#include <DDS/DDSConnector/dds_connector.h>
#include <DDS/Core/topic_lock_master.h>
#include <ParticipantManagement/ppm.hpp>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_dts.h>
#include <ParticipantManagement/ppm_fts.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include "logger.h"
#include <QtCore/QObject>
#include <QObject>
namespace Core
{
@@ -50,7 +50,6 @@ public:
void longActionBreak();
private:
NGL::INGLLogger &m_logger;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<DDSConnector::DdsConnector> m_exAnyConnector;
@@ -64,6 +63,8 @@ private:
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
std::shared_ptr<ExerciseTime> m_exerciseTime;
NGL::INGLLogger &m_logger;
};
}
@@ -9,7 +9,7 @@
#include "exercise_time.h"
#include "ppm_dts.h"
#include <QtCore/QDateTime>
#include <QDateTime>
#include <DDS/DTS/generic_dts_impl.h>
namespace ParticipantManagement
@@ -7,8 +7,8 @@
*/
#pragma once
#include <QtCore/QThread>
#include <QtCore/QTimer>
#include <QThread>
#include <QTimer>
#include <DDS/Core/core_dts_types.h>
@@ -9,7 +9,7 @@
#pragma once
#include <NGLLogger/INGLLogger.h>
#include "svcppmcommon_export.h"
#include "ppm_export.h"
namespace ParticipantManagement
{
@@ -82,8 +82,6 @@ class MainHandler final : public ParticipantHandling::BaseDataProvider
qint64 currentTimeMSec() const override;
private: // attributes
NGL::INGLLogger &m_logger;
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<DbHandler> m_dbHandler;
std::shared_ptr<DbHandler> m_dbHandlerEx0;
@@ -103,5 +101,7 @@ class MainHandler final : public ParticipantHandling::BaseDataProvider
std::shared_ptr<WebSocketInterface::WebSocketInterfaceHandler> m_websocketHandler;
std::shared_ptr<UasHandling::UasHandler> m_uasHandler;
std::shared_ptr<UasHandling::MissionPlanHandler> m_missionPlanHandler;
LOGGER_T m_logger;
};
} // namespace ParticipantManagement
@@ -7,10 +7,9 @@
*/
#include "ppm_common.h"
#include <utility>
#include <QtCore/QVector>
#include <QtCore/QDebug>
#include <QVector>
#include <QDebug>
namespace ParticipantManagement
@@ -35,7 +34,7 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
}
// bool readyToDebug = false;
// for (const ParticipantManagement::StateInformation &si : std::as_const(stateList))
// for (const ParticipantManagement::StateInformation &si : qAsConst(stateList))
// {
// if (si.originatorId() == 0
// && si.originatorType() == ProjectDataManagement::StateChangeOriginator_def::ExerciseControl
@@ -77,14 +76,14 @@ StateInformation youngestStateInformation(const std::vector<ParticipantManagemen
if (debug)
{
qWarning() << ">> printing all SIs";
for (const ParticipantManagement::StateInformation &si : std::as_const(sortedStateList))
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
qWarning() << ">>>> si" << "siVulnId" << (uint8_t)si.vulnerabilityState().underlying() << "bits" << si.vulnerabilityBits() << "time" << si.stateTime();
qWarning() << ">> checking SIs";
}
for (const ParticipantManagement::StateInformation &si : std::as_const(sortedStateList))
for (const ParticipantManagement::StateInformation &si : qAsConst(sortedStateList))
{
const uint8_t siVulnId = si.vulnerabilityState().underlying();
@@ -7,7 +7,7 @@
*/
#pragma once
#include <ParticipantManagement/ppm.hpp>
#include "svcppmcommon_export.h"
#include "ppm_export.h"
namespace ParticipantManagement
{
@@ -7,18 +7,17 @@
*/
#include "ppm_dtc_impl_custom.h"
#include <utility>
#include "ppm_common.h"
#include <DDS/DTC/generic_dtc.h>
#include <DDS/Generic/generic_data_reader.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <LtsUtilsCore/json_object.h>
#include <QtCore/QJsonObject>
#include <QJsonObject>
#include <QJsonParseError>
#include <QPolygonF>
#include <QtCore/QSet>
#include <QtCore/QVector>
#include <QSet>
#include <QVector>
namespace ParticipantManagement
{
@@ -745,7 +744,7 @@ int DtcImplCustom::getParticipantFromPrf(int prf) const
for (const DynamicParticipantData &sample : m_dtcDynamicParticipantData->readAlive())
{
for (const auto &designation : std::as_const(sample.designations()))
for (const auto &designation : qAsConst(sample.designations()))
{
DEBUG_LOG(m_logger) << " code=" << designation.code();
if (designation.code() == prf)
@@ -769,7 +768,7 @@ int DtcImplCustom::getPrfFromParticipant(int participantId) const
if (participantId == sample.participantId())
{
DEBUG_LOG(m_logger) << "participantId=" << sample.participantId() << " designations.size()=" << sample.designations().size();
for (const auto &designation : std::as_const(sample.designations()))
for (const auto &designation : qAsConst(sample.designations()))
{
DEBUG_LOG(m_logger) << " code=" << designation.code();
if (designation.code() > 0)
@@ -11,7 +11,7 @@
#include <nglsettings/nglsettings_settings.h>
#include <ngltools/ngltools_filesystem.h>
#include "LtsUtils/LtsUtilsCore/lts_portrange.h"
#include "LtsUtilsCore/lts_portrange.h"
namespace ParticipantManagement
{
@@ -6,8 +6,8 @@
*/
#pragma once
#include <QtCore/QString>
#include <QtCore/QPair>
#include <QString>
#include <QPair>
namespace NGL
{
@@ -7,11 +7,10 @@
*/
#include "web_socket_handler.h"
#include <utility>
#include <QtWebSockets/QWebSocket>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonDocument>
#include <QWebSocket>
#include <QJsonObject>
#include <QJsonDocument>
#include <ParticipantManagement/ppm.hpp>
@@ -26,7 +25,7 @@ WebSocketHandler::WebSocketHandler(QObject *parent)
WebSocketHandler::~WebSocketHandler()
{
for (const auto& ws : std::as_const(m_webSockets))
for (const auto& ws : qAsConst(m_webSockets))
{
ws->disconnect(this);
}
@@ -71,7 +70,7 @@ bool WebSocketHandler::sendTelegramInternal(const ParticipantPosition &pos, int
const QString jsonStr = QString::fromUtf8(QJsonDocument(obj).toJson(QJsonDocument::Compact));
bool ret = false;
for (const auto &wsw : std::as_const(m_webSockets))
for (const auto &wsw : qAsConst(m_webSockets))
{
if (wsw->sendTextMessage(jsonStr))
ret = true;
@@ -8,8 +8,8 @@
#pragma once
#include <QtCore/QObject>
#include <QtWebSockets/QWebSocketServer>
#include <QObject>
#include <QWebSocketServer>
#include <ParticipantManagement/ppm_common.h>
#include "logger.h"
@@ -31,7 +31,6 @@ public:
bool sendPosition(const ParticipantPosition& participantPosition, int equipmentNumber) const;
private:
NGL::INGLLogger &m_logger;
bool sendTelegramInternal(const ParticipantPosition& pos, int eqNo) const;
private Q_SLOTS:
@@ -39,9 +38,10 @@ private Q_SLOTS:
void onWebSocketDisconnected();
private:
NGL::INGLLogger &m_logger;
QWebSocketServer* m_webSocketServer = nullptr;
QVector<QWebSocket*> m_webSockets;
LOGGER_T m_logger;
};
}