Files
qt5-legatus-legacy/Lts/Services/CentralEffectSimulation/dds_handler.h
T

144 lines
8.2 KiB
C++
Executable File

/**
* DdsHandlerAes for DDS
* $Id$
* $HeadURL$
* $Author$
* Created by gr, SLSE, 2015-09-02
*/
#pragma once
#include <QObject>
#include <DDS/DDSConnector/dds_connector.h>
#include <Core/core_dtc.h>
#include <Core/topic_lock_master.h>
#include <CentralEffectSimulation/ces_dts.h>
#include <CentralEffectSimulation/ces_fts.h>
#include <AreaEffectSimulation/aes_dtc.h>
#include <AreaEffectSimulation/aes_ftc.h>
#include <AssetManagement/asm_dtc.h>
#include <Buildings/bld_dtc.h>
#include <Buildings/bld_ftc.h>
#include <ExerciseManagement/exm_dtc.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <ProjectDataManagement/pdm_dtc.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <ParticipantManagement/ppm_ftc_types.h>
#include <TrainingAreaBase/tab_ftc.h>
#include <TrainingAreaBase/tab_dts.h>
#include <TrainingAreaBase/tab_dtc.h>
#include <MeteoDataManagement/mdm_dtc.h>
#include <LtsCoordTrans/lts_coord_trans.h>
#include <CentralEffectSimulation/svccesddscommon_export.h>
#include "logger.h"
namespace Core
{
class Pacemaker;
}
namespace CentralEffectSimulation
{
class SVCCESDDSCOMMON_EXPORT DdsHandler final : public QObject
{
Q_OBJECT
public:
DdsHandler(int domainId, int exerciseId);
bool init(const QStringList &qosFileList = QStringList());
std::shared_ptr<Core::Pacemaker> pacemaker() const { return m_pacemaker; }
std::shared_ptr<Core::TopicLockMaster> topicLockMaster() const { return m_topicLockMaster; }
std::shared_ptr<DDSConnector::DdsConnector> dds() const { return m_ddsConnector; }
std::shared_ptr<Core::Interface::Dtc> dtcCore() const { return m_dtcCore;}
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> dtcAes() const { return m_dtcAes;} ///< Pointer to DTC AreaEffectSimulation interface object
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> ftcAes() const { return m_ftcAes;} ///< Pointer to FTC AreaEffectSimulation interface object
std::shared_ptr<CentralEffectSimulation::Interface::Dts> dtsCes() const { return m_dtsCes;} ///< Pointer to DTS CentralEffectSimulation interface object
std::shared_ptr<CentralEffectSimulation::Interface::Fts> ftsCes() const { return m_ftsCes;} ///< Pointer to FTS CentralEffectSimulation interface object
std::shared_ptr<InfrastructureManagement::Interface::Dtc> dtcIsm() const { return m_dtcIsm;} ///< Pointer to DTC InfrastructureManagement interface object
std::shared_ptr<ProjectDataManagement::Interface::Dtc> dtcPdm() const { return m_dtcPdm;} ///< Pointer to DTC ProjectDataManagement interface object
std::shared_ptr<Buildings::Interface::Ftc> ftcBld() const { return m_ftcBld;}
std::shared_ptr<ParticipantManagement::Interface::Dtc> dtcPpm() const {return m_dtcPpm;} ///< Pointer to DTC ParticipantManagement interface object
std::shared_ptr<ParticipantManagement::Interface::Ftc> ftcPpm() const {return m_ftcPpm;}
std::shared_ptr<TrainingAreaBase::Interface::Ftc> ftcTab() const { return m_ftcTab;}
std::shared_ptr<TrainingAreaBase::Interface::Dts> dtsTab() const {return m_dtsTab;} ///< Pointer to DTS TrainingAreaBase interface object
std::shared_ptr<TrainingAreaBase::Interface::Dtc> dtcTab() const {return m_dtcTab;} ///< Pointer to DTC TrainingAreaBase interface object
std::shared_ptr<MeteoDataManagement::Interface::Dtc> dtcMdm() const {return m_dtcMdm;} ///< Pointer to DTC TrainingAreaBase interface object
std::shared_ptr<Buildings::Interface::Dtc> dtcBld() const { return m_dtcBld;}
std::shared_ptr<AssetManagement::Interface::Dtc> asmDtc() const { return m_asmDtc; }
std::shared_ptr<ExerciseManagement::Interface::Dtc> exmDtc() const { return m_exmDtc; }
int getParticipantEventId() { return m_participantEventId++;}
int getExerciseId() const { return m_exerciseId;}
qint64 currentPartitionTime() const;
/**
* Get equipment number for the given participant
* @param participantId participant id to get the equipment number for
* @return equipment number or 0 in case of failure
*/
int participantId2EquipNo(const int participantId) const;
int equipNo2ParticipantId(const int equipmentNumber) const;
double chargeTypeRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct);
double chargeHeight ( const AreaEffectSimulation::ChargeStruct &chargeStruct);
ProjectDataManagement::VolatilityType volatilityTypeId(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isSmartChargeType(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isSmoke(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isLaserGuidable(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isJamming(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isDus(const AreaEffectSimulation::ChargeStruct &chargeStruct);
bool isAtMine(const AreaEffectSimulation::ChargeStruct &chargeStruct);
QVector<ProjectDataManagement::CasEffect> getCasEffects(const AreaEffectSimulation::ChargeStruct &chargeStruct);
int32_t getLegacyIdFromChargeTypeId(const AreaEffectSimulation::ChargeStruct &chargeStruct);
ProjectDataManagement::IgniterFunctionBase getIgniterFunctionBaseFromChargeTypeId(const int32_t chargeTypeId, int igniterTypeId, int igniterFunctionId);
int searchRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct);
int remainingTasCode(const AreaEffectSimulation::ChargeStruct &chargeStruct) const;
int secondaryRemainingTasCode(const AreaEffectSimulation::ChargeStruct &chargeStruct) const;
int getLethalRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct) const;
int getNonLethalRadius(const AreaEffectSimulation::ChargeStruct &chargeStruct) const;
int getHazardDistance(const AreaEffectSimulation::ChargeStruct &chargeStruct) const;
private:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::Pacemaker> m_pacemaker;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
std::shared_ptr<CentralEffectSimulation::Interface::Dts> m_dtsCes; ///< Pointer to DTS CentralEffectSimulation interface object
std::shared_ptr<CentralEffectSimulation::Interface::Fts> m_ftsCes; ///< Pointer to FTS CentralEffectSimulation interface object
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes; ///< Pointer to DTC AreaEffectSimulation interface object
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_ftcAes; ///< Pointer to FTC AreaEffectSimulation interface object
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtcIsm; ///< Pointer to DTC InfrastructureManagement interface object
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm; ///< Pointer to DTC ProjectDataManagement interface object
std::shared_ptr<Buildings::Interface::Ftc> m_ftcBld;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm; ///< Pointer to DTC ParticipantManagement interface object
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ftcPpm;
std::shared_ptr<TrainingAreaBase::Interface::Ftc> m_ftcTab;
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_dtsTab; ///< Pointer to DTS TrainingAreaBase interface object
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_dtcTab; ///< Pointer to DTC TrainingAreaBase interface object
std::shared_ptr<Buildings::Interface::Dtc> m_dtcBld; ///< Pointer to DTC Buildings interface object
std::shared_ptr<MeteoDataManagement::Interface::Dtc> m_dtcMdm; ///< Pointer to DTC Buildings interface object
std::shared_ptr<AssetManagement::Interface::Dtc> m_asmDtc;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
//QMap<int, int> m_partId2EquipNoMap; ///< Reference map participant (player) to equipment number (
// AES-Values
QMap<int, ProjectDataManagement::ChargeType> m_chargeTypes;
int m_participantEventId;
int m_exerciseId;
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
};
} // namespace CentralEffectSimulation