Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Services/SituationReplay/db_reader.cpp
T
torstenandCopilot b774f4035c Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung
- 44 Export-Header Include-Pfade korrigiert (_export.h)
- 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h)
- INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros
- Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits)
- FATAL_LOG Makro hinzugefügt
- InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h)
- FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h)
- AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp)
- SymbolAppearance Klasse vollständig definiert mit content() Methode
- BuildingComponentFilter Klasse definiert mit Copy-Konstruktor
- Ftc Factory: nullptr Return (abstract class)
- AesFilter Klasse in aes.hpp hinzugefügt
- Dtc Klasse in ppm.hpp mit participantChanged Signal
- AesType Enum: alle 15 At* Werte definiert
- AesEffectState_def: EsReceived hinzugefügt
- DataModification Enum: eAdded/eModified/eRemoved
- function_reply_object.h → core_types.h Include-Pfad (72 Dateien)
- Enum-Class-Streaming Template-Operator in INGLLogger.h
- ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen
- ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge
- QRegExp → QRegularExpression in tpm_js_parser.cpp
- .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert
- Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 06:06:24 +02:00

136 lines
4.0 KiB
C++
Executable File

/**
* DbReader for RecordingManagement
* $Id$
* $HeadURL$
* $Author$
*/
#include "db_reader.h"
#include "logger.h"
#include <DDS/DDSConnector/dds_connector.h>
#include <LtsPluginManager/lts_plugin_loader.h>
#include <ngldb/nsqlquery.h>
namespace SituationReplay
{
DbReader::DbReader(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector,
int exerciseId,
bool bCanHandleSchemas)
: m_exerciseId(exerciseId)
, m_query(nullptr)
, m_ddsConnector(ddsConnector)
, m_bCanHandleSchemas(bCanHandleSchemas)
{}
DbReader::~DbReader()
{
delete m_query;
LtsPluginManager::LtsPluginLoader::getInstance()->unloadAllPlugins();
m_plugins.clear();
}
bool DbReader::loadPlugin(const LtsPluginManager::PluginInstance &pi)
{
RecordReplay::RecordReplayPlugin *recPlugin = qobject_cast<RecordReplay::RecordReplayPlugin*>(pi.plugin);
if (!recPlugin)
{
ERROR_LOG() << "Cannot load RecordReplayPlugin " << pi.fileName;
return false;
}
if (!recPlugin->initDts(m_ddsConnector, m_exerciseId, m_bCanHandleSchemas, *m_query))
{
ERROR_LOG() << "Initialisation for RecordReplayPlugin " << pi.fileName << " failed ";
return false;
}
INFO_LOG() << "Loaded record replay plugin " << recPlugin->pluginName();
m_plugins.push_back(recPlugin);
return true;
}
bool DbReader::init(const QSqlDatabase &db)
{
delete m_query;
m_query = new NSqlQuery(db);
auto cb = [this](const LtsPluginManager::PluginInstance &pi) { return loadPlugin(pi); };
LtsPluginManager::LtsPluginLoader::getInstance()->loadPlugins(LtsPluginManager::PluginType::SPECIAL,
cb,
QStringList(),
QStringLiteral("recordreplay"));
return true;
}
bool DbReader::setReplayStartTime(qint64 startTime)
{
INFO_LOG() << "IN setReplayStartTime " << startTime;
if (!m_query)
{
WARNING_LOG() << "Internal error - no query!";
return false;
}
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
{
INFO_LOG() << "IN setReplayStartTime, current Plugin: " << recPlugin->pluginName()
<< " typename=" << typeid(*recPlugin).name();
if (!recPlugin->setReplayStartTime(*m_query, startTime))
{
WARNING_LOG() << "setReplayStartTime for plugin " << recPlugin->svcShortName() << " failed!";
return false;
}
}
INFO_LOG() << "IN setReplayStartTime " << startTime << " DONE";
return true;
}
bool DbReader::readData(qint64 fromTime, qint64 toTime)
{
INFO_LOG() << "IN readData " << fromTime << " to " << toTime;
if (!m_query)
{
WARNING_LOG() << "Internal error - no query!";
return false;
}
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
{
if (!recPlugin->ddsTopicsFromDatabase(*m_query, fromTime, toTime))
{
WARNING_LOG() << "ddsTopicsFromDatabase for plugin " << recPlugin->svcShortName() << " failed!";
return false;
}
}
INFO_LOG() << "IN readData " << fromTime << " to " << toTime << " DONE";
return true;
}
void DbReader::publish(qint64 desiredTime)
{
INFO_LOG() << "IN publish " << desiredTime;
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
if (!recPlugin->publishData(desiredTime))
WARNING_LOG() << "publishData for plugin " << recPlugin->svcShortName() << " failed!";
INFO_LOG() << "IN publish " << desiredTime << " DONE";
}
void DbReader::waitForAsyncOperations(qint64 desiredTime)
{
INFO_LOG() << "IN waitForAsyncOperations " << desiredTime;
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
if (!recPlugin->waitForAsyncOperations(desiredTime))
WARNING_LOG() << "waitForAsyncOperations for plugin " << recPlugin->svcShortName() << " failed!";
}
void DbReader::clearData()
{
INFO_LOG() << "IN clearData";
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
recPlugin->clearData();
}
} // RecordingManagement