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

70 lines
1.9 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Handler for all situation replay objects
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2016-01-13
*/
#pragma once
#include <SituationReplay/situationreplaysqlite_export.h>
#include <SituationReplay/srp_enums.hpp>
#include <QObject>
#include <memory>
#include "logger.h"
namespace SituationReplay
{
namespace Database
{
struct SrpSituationReplay;
}
class DbReader;
class DdsHandler;
class ObjectSituationReplay;
class SITUATIONREPLAYSQLITE_EXPORT HandlerSituationReplaySqlite final : public QObject
{
Q_OBJECT
public:
explicit HandlerSituationReplaySqlite(const std::shared_ptr<DdsHandler> &ddsHandler,
const std::shared_ptr<DbReader> &dbReader);
~HandlerSituationReplaySqlite();
bool init(int exerciseId, int partitionId, qint64 beginTime, qint64 endTime);
qint64 beginTime() const { return m_beginTime; }
qint64 endTime() const { return m_endTime; }
Q_SIGNALS:
void replayTimeChanged(qint64 curTime);
void started(qint64 currentReplayTime);
void paused();
void resumed(qint64 currentReplayTime);
void stopped();
public:
bool onStartReplayRequest(double pace) { return onStartReplayRequest(m_beginTime, m_endTime, pace); }
bool onStartReplayRequest(qint64 begin, qint64 end, double pace);
bool onStopReplayRequest();
bool onPauseReplayRequest();
bool onResumeReplayRequest();
bool onChangeReplayStateRequest(const SrpState &newState, double newPace);
bool onPaceChangeRequest(double newPace);
private:
bool createObject(const Database::SrpSituationReplay &newData);
private:
ObjectSituationReplay *m_objSrp; // only one (!) replay per partition possible
const std::shared_ptr<DdsHandler> m_ddsHandler;
const std::shared_ptr<DbReader> m_dbReader;
int m_exerciseId;
int m_partitionId;
qint64 m_beginTime;
qint64 m_endTime;
NGL::INGLLogger &m_logger;
};
}