/** * @RDE_HEADER@ * Handler for all situation replay objects * $Id$ * $HeadURL$ * $Author$ * Created by Hanna E. Rathje, SLSE, 2016-01-13 */ #pragma once #include #include #include #include #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, const std::shared_ptr &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 m_ddsHandler; const std::shared_ptr m_dbReader; int m_exerciseId; int m_partitionId; qint64 m_beginTime; qint64 m_endTime; NGL::INGLLogger &m_logger; }; }