88 lines
2.7 KiB
C++
Executable File
88 lines
2.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Data Plugin for SituationReplayManagement
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Patric Karwat, SLSE, 2016-07-19
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Plugins/SituationReplayManagement/srm_data_plugin_interface.h>
|
|
#include <Core/core_dts_types.h>
|
|
#include <SituationReplayManagement/logger.h>
|
|
|
|
#include <QPointer>
|
|
#include <QSet>
|
|
|
|
class QProcess;
|
|
namespace SituationReplayManagement
|
|
{
|
|
class ReplayHandler;
|
|
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
|
{
|
|
Q_PLUGIN_METADATA(IID "data:3:srm")
|
|
Q_INTERFACES(DataPluginBase::Plugin)
|
|
|
|
Q_OBJECT
|
|
public:
|
|
DataPlugin();
|
|
~DataPlugin();
|
|
|
|
QString pluginName() const override { return QStringLiteral("SituationReplayManagement"); }
|
|
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
|
bool availableInPartition(IDL::PartitionType partition) const override
|
|
{
|
|
return partition == IDL::PartitionType::Exercise ||
|
|
partition == IDL::PartitionType::Replay ||
|
|
partition == IDL::PartitionType::Global; // due to Logout/clear Replay session
|
|
}
|
|
|
|
std::shared_ptr<ReplayHandler> m_replayHandler;
|
|
};
|
|
|
|
|
|
class DataInterfaceImpl final : public DataInterface
|
|
{
|
|
public:
|
|
explicit DataInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
|
LtsSession::LtsSessionDataDds *session,
|
|
const std::shared_ptr<Core::Interface::Dtc> &dtc);
|
|
|
|
std::shared_ptr<Core::Interface::Dtc> getDtc() override { return m_dtc; }
|
|
std::shared_ptr<ForeignDataInterface> getForeignDataInterface() override { return m_foreignInterface; }
|
|
|
|
private:
|
|
std::shared_ptr<Core::Interface::Dtc> m_dtc;
|
|
std::shared_ptr<ForeignDataInterface> m_foreignInterface;
|
|
};
|
|
|
|
|
|
class ForeignInterfaceImpl final : public ForeignDataInterface
|
|
{
|
|
public:
|
|
ForeignInterfaceImpl(const std::shared_ptr<ReplayHandler> &replayHandler,
|
|
LtsSession::LtsSessionDataDds *session);
|
|
~ForeignInterfaceImpl();
|
|
|
|
// ForeignInterface
|
|
void removeReplayPartitionsWorkstation(const int workstationId) noexcept(false) override;
|
|
void removeReplayPartitionsOperator(const int operatorId) noexcept(false) override;
|
|
void replayPartitionRemoveRequest(int partitionId, int workstationId, int operatorId) noexcept(false) override;
|
|
int replayPartitionCreateRequest(int exerciseId, int workstationId, int operatorId, Core::ReplayType replayType) noexcept(false) override;
|
|
|
|
private:
|
|
void write(const Core::ReplayPartition &repl);
|
|
void remove(const Core::ReplayPartition &repl);
|
|
|
|
private:
|
|
std::shared_ptr<ReplayHandler> m_replayHandler;
|
|
QPointer<LtsSession::LtsSessionDataDds> m_session;
|
|
NGL::INGLLogger &m_logger;
|
|
|
|
friend class ReplayHandler;
|
|
};
|
|
|
|
} // namespace SituationReplayManagement
|