85 lines
3.7 KiB
C++
Executable File
85 lines
3.7 KiB
C++
Executable File
/**
|
|
* Handler for player data
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by gr, SLSE, 2017-02-20
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "simulation_movement.h"
|
|
|
|
#include <CentralEffectSimulation/logger.h>
|
|
#include <CentralEffectSimulation/dds_handler.h>
|
|
#include <CentralEffectSimulation/ces_dts.h>
|
|
#include <CentralEffectSimulation/ces_fts.h>
|
|
#include <CentralEffectSimulation/ces_db.h>
|
|
#include <ParticipantManagement/ppm_ftc.h>
|
|
#include <CentralEffectSimulation/handler_participant.h>
|
|
|
|
#include <QHash>
|
|
|
|
|
|
|
|
|
|
// Simulated movement for participants
|
|
namespace CentralEffectSimulationBasic
|
|
{
|
|
|
|
class HandlerSimulatedMovement final
|
|
: public QObject
|
|
, protected CentralEffectSimulation::Interface::Fts::SimulatedMovementModifyRequestHandler
|
|
, protected CentralEffectSimulation::Interface::Fts::SimulatedMovementRemoveRequestHandler
|
|
, protected CentralEffectSimulation::Interface::Fts::SimulatedMovementRemoveByParticipantIdRequestHandler
|
|
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
|
|
, protected ParticipantManagement::Interface::Ftc::SetAsSimulatedReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit HandlerSimulatedMovement(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
|
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
|
|
const std::shared_ptr<CentralEffectSimulation::DatabaseInterface> &db,
|
|
QObject *parent = nullptr);
|
|
|
|
~HandlerSimulatedMovement();
|
|
|
|
/**
|
|
* Initialize the handler to manage information from player management
|
|
*/
|
|
bool init();
|
|
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
void onSetAsSimulatedReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
|
|
private: // methoden
|
|
bool loadSimulatedMovementFromDb();
|
|
void onSimulatedMovementModifyRequest(const rti::core::SampleIdentity &cookie,
|
|
const CentralEffectSimulation::SimulatedMovement &request) override;
|
|
void onSimulatedMovementRemoveRequest(const rti::core::SampleIdentity &cookie,
|
|
const Core::RemoveElementRequest &request) override;
|
|
void onSimulatedMovementRemoveByParticipantIdRequest(const rti::core::SampleIdentity &cookie,
|
|
const CentralEffectSimulation::SimulatedMovementRemoveByParticipantId &request) override;
|
|
Core::FunctionReplyObject insertInDb(const CentralEffectSimulation::SimulatedMovement &request);
|
|
Core::FunctionReplyObject updateDb(const CentralEffectSimulation::SimulatedMovement &request);
|
|
Core::FunctionReplyObject removeFromDb(const int32_t id);
|
|
void publishSimulatedMovement(const CentralEffectSimulation::SimulatedMovement &request);
|
|
void setParticipantAsSimulated(const int &participantId, const bool isSimulated);
|
|
Core::FunctionReplyObject removeSimulatedMovement(int32_t ddsId);
|
|
SimulationMovement *findSimulationMovement(int id, int participantId);
|
|
|
|
private: // attributes
|
|
|
|
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
|
|
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
|
std::shared_ptr<CentralEffectSimulation::DatabaseInterface> m_db;
|
|
|
|
// Input-values for simulation
|
|
QHash<int, SimulationMovement *> m_simulationMovements; // Key = SimulationMovement.id
|
|
|
|
int m_jumpToStart;
|
|
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
|
};
|
|
} // namespace CentralEffectSimulationBasic
|
|
|