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>
137 lines
4.1 KiB
C++
137 lines
4.1 KiB
C++
/**
|
|
* 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)
|
|
, m_logger(getLogger("DbReader"))
|
|
{}
|
|
|
|
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(m_logger) << "Cannot load RecordReplayPlugin " << pi.fileName;
|
|
return false;
|
|
}
|
|
|
|
if (!recPlugin->initDts(m_ddsConnector, m_exerciseId, m_bCanHandleSchemas, *m_query))
|
|
{
|
|
ERROR_LOG(m_logger) << "Initialisation for RecordReplayPlugin " << pi.fileName << " failed ";
|
|
return false;
|
|
}
|
|
|
|
INFO_LOG(m_logger) << "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(m_logger) << "IN setReplayStartTime " << startTime;
|
|
if (!m_query)
|
|
{
|
|
WARNING_LOG(m_logger) << "Internal error - no query!";
|
|
return false;
|
|
}
|
|
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
|
|
{
|
|
INFO_LOG(m_logger) << "IN setReplayStartTime, current Plugin: " << recPlugin->pluginName()
|
|
<< " typename=" << typeid(*recPlugin).name();
|
|
if (!recPlugin->setReplayStartTime(*m_query, startTime))
|
|
{
|
|
WARNING_LOG(m_logger) << "setReplayStartTime for plugin " << recPlugin->svcShortName() << " failed!";
|
|
return false;
|
|
}
|
|
}
|
|
INFO_LOG(m_logger) << "IN setReplayStartTime " << startTime << " DONE";
|
|
return true;
|
|
}
|
|
|
|
bool DbReader::readData(qint64 fromTime, qint64 toTime)
|
|
{
|
|
INFO_LOG(m_logger) << "IN readData " << fromTime << " to " << toTime;
|
|
if (!m_query)
|
|
{
|
|
WARNING_LOG(m_logger) << "Internal error - no query!";
|
|
return false;
|
|
}
|
|
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
|
|
{
|
|
if (!recPlugin->ddsTopicsFromDatabase(*m_query, fromTime, toTime))
|
|
{
|
|
WARNING_LOG(m_logger) << "ddsTopicsFromDatabase for plugin " << recPlugin->svcShortName() << " failed!";
|
|
return false;
|
|
}
|
|
}
|
|
INFO_LOG(m_logger) << "IN readData " << fromTime << " to " << toTime << " DONE";
|
|
return true;
|
|
}
|
|
|
|
void DbReader::publish(qint64 desiredTime)
|
|
{
|
|
INFO_LOG(m_logger) << "IN publish " << desiredTime;
|
|
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
|
|
if (!recPlugin->publishData(desiredTime))
|
|
WARNING_LOG(m_logger) << "publishData for plugin " << recPlugin->svcShortName() << " failed!";
|
|
INFO_LOG(m_logger) << "IN publish " << desiredTime << " DONE";
|
|
}
|
|
|
|
void DbReader::waitForAsyncOperations(qint64 desiredTime)
|
|
{
|
|
INFO_LOG(m_logger) << "IN waitForAsyncOperations " << desiredTime;
|
|
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
|
|
if (!recPlugin->waitForAsyncOperations(desiredTime))
|
|
WARNING_LOG(m_logger) << "waitForAsyncOperations for plugin " << recPlugin->svcShortName() << " failed!";
|
|
}
|
|
|
|
|
|
void DbReader::clearData()
|
|
{
|
|
INFO_LOG(m_logger) << "IN clearData";
|
|
for (RecordReplay::RecordReplayPlugin *recPlugin : m_plugins)
|
|
recPlugin->clearData();
|
|
}
|
|
|
|
} // RecordingManagement
|