Files
qt5-legatus-legacy/Lts/Services/RecordingManagement/db_writer.h
T
2026-08-13 18:33:10 +02:00

56 lines
1.3 KiB
C++
Executable File

/**
* DbWriter for RecordingManagement
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QObject>
#include <QTimer>
#include <QVector>
#include <PluginInterfaces/record_replay_plugin.h>
#include <ngldb/nsqlquery.h>
#include "logger.h"
namespace LtsPluginManager
{
struct PluginInstance;
}
namespace RecordingManagement
{
class DatabaseInterface;
class DbWriterSnapshot;
class DbWriterSnapshotThread;
class DbWriter : public QObject
{
Q_OBJECT
public:
explicit DbWriter(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
~DbWriter();
bool init(const std::shared_ptr<DatabaseInterface> &db);
protected:
bool initSnapshot();
bool loadPlugin(const LtsPluginManager::PluginInstance &pi);
private Q_SLOTS:
void ddsTopicsToDatabase();
private:
NSqlQuery *m_query{nullptr};
QTimer *m_recordTimer{nullptr};
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
QVector<RecordReplay::RecordReplayPlugin *> m_plugins;
DbWriterSnapshot *m_dbWriterSnapshot{nullptr};
DbWriterSnapshotThread *m_dbWriterSnapshotThread{nullptr};
std::shared_ptr<DatabaseInterface> m_db;
LOGGER_T m_logger;
};
} // namespace RecordingManagement