Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+1458
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Handler for dynamic participant data
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog, SLSE, 2016-09-21
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include "rep_db.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <AreaEffectSimulation/aes_dtc.h>
|
||||
#ifdef GUEZ_MODE
|
||||
#include <GuezIedManagement/gim_dtc.h>
|
||||
#endif
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <Proxies/Buildings/bld_dtc.h>
|
||||
#include <Proxies/Buildings/bld.hpp>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
|
||||
namespace ReportManagement
|
||||
{
|
||||
class HandlerDynamicParticipantData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HandlerDynamicParticipantData(const std::shared_ptr<DdsHandler> &ddsHandler, const std::shared_ptr<DatabaseInterface> &db);
|
||||
|
||||
~HandlerDynamicParticipantData();
|
||||
|
||||
/**
|
||||
* Initialize the handler to manage information from infrastructure management
|
||||
*/
|
||||
bool init();
|
||||
|
||||
private Q_SLOTS:
|
||||
/**
|
||||
* Handle the signals from 'ParticipantManagement' and 'AreaEffectSimulation'
|
||||
*/
|
||||
void onDynamicParticipantDataChanged(const ParticipantManagement::DynamicParticipantData &data, DataModification modType);
|
||||
void onParticipantGearEventChanged(const ParticipantManagement::ParticipantGearEvent &data, DataModification modType);
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType);
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
||||
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &data, DataModification modType);
|
||||
void onAesEffectsChanged(const AreaEffectSimulation::Effects &data, DataModification modType);
|
||||
|
||||
#ifdef GUEZ_MODE
|
||||
void onIedChanged(const GuezIedManagement::Ied &data, DataModification modType);
|
||||
#endif
|
||||
void onBuildingStateChanged(const Buildings::BuildingState &data, DataModification modType);
|
||||
|
||||
private: // methoden
|
||||
AreaEffectSimulation::AesItemView getAesItemView(int effectSimulationId);
|
||||
QString getAesName(int effectSimulationId);
|
||||
static bool containsGearTypeId(const std::vector<ParticipantManagement::GearInformation> &gi, int gearTypeId, int chargeTypeId);
|
||||
bool checkVulnerabilityStateChange(ProjectDataManagement::VulnerabilityState vulnState, int participantId);
|
||||
qint64 lastVulnerabilityChanged(const std::vector<ParticipantManagement::StateInformation> &stateHistory);
|
||||
qint64 getLastSignificantParticipantPositionChanged(int participantId, qint64 currTime, const Core::GeoPosition &currPos);
|
||||
qint64 getLastSignificantPositionMountedChanged(int participantId, qint64 currTime, const Core::GeoPosition &currPos);
|
||||
Core::GeoPosition getLastPosition(int participantId) const;
|
||||
qint32 lastVitality(int participantId, qint64 currTime);
|
||||
qint32 lastVulnerabilityKind(int participantId, qint64 currTime);
|
||||
QJsonObject areaToJson(int id, const QString &name) const;
|
||||
QJsonObject sanToJson(qint64 procTaken) const;
|
||||
qint64 sinceWhenVitality(int participantId, int vitality, qint64 currTime);
|
||||
qint64 sinceWhenVulnerability(int participantId, int vulnerability, qint64 currTime);
|
||||
|
||||
private: // attributes
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc; ///< Pointer to DTC ParticipantManagement interface object
|
||||
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
||||
#ifdef GUEZ_MODE
|
||||
std::shared_ptr<GuezIedManagement::Interface::Dtc> m_gimDtc;
|
||||
QMap<qint32, GuezIedManagement::Ied> m_iedMap;
|
||||
#endif
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
||||
std::shared_ptr<Buildings::Interface::Dtc> m_bldDtc;
|
||||
|
||||
|
||||
QMap<qint32, ParticipantManagement::Participant> m_partMap;
|
||||
QMap<qint32, ProjectDataManagement::VulnerabilityState> m_vulnStateMap;
|
||||
QMap<qint32, AreaEffectSimulation::AesItemView> m_aesItemViewMap;
|
||||
// aesId, aesName
|
||||
QMap<qint32, QString> m_aesNamesMap;
|
||||
QMap<qint32, ParticipantManagement::ParticipantPosition> m_partPositionMap;
|
||||
QHash<qint32, ParticipantManagement::DynamicParticipantData> m_lastDynData;
|
||||
QVector<qint32> m_isMounted;
|
||||
|
||||
// QMap<ParticipantId, QMap<QPair<gearTypeId,chargeTypeId>, chargeRemain>>
|
||||
QMap<int, QMap<QPair<int, int>, int > > m_chargeGearInfo;
|
||||
LOGGER_T m_logger; ///< Interface to the Logging-Facility
|
||||
|
||||
};
|
||||
} // namespace ReportManagement
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Main for ReportManagement Analyzer
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "logger.h"
|
||||
#include "settings.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
NGLCoreApplication app(argc, argv);
|
||||
|
||||
LtsCommandLineParser::LtsCommandLineParser options;
|
||||
if (!options.init())
|
||||
return -1;
|
||||
app.createLogger("REP", options.exerciseId());
|
||||
|
||||
ReportManagement::Settings::setIniFile(options.iniFile());
|
||||
|
||||
int iRet = -3;
|
||||
{
|
||||
std::unique_ptr<ReportManagement::MainHandler> mainHandler(new ReportManagement::MainHandler);
|
||||
|
||||
if (!mainHandler->init(options.domainId(), options.exerciseId()))
|
||||
return iRet;
|
||||
|
||||
STARTUP_LOG(app.baseLogger());
|
||||
|
||||
iRet = app.exec();
|
||||
|
||||
SHUTDOWN_LOG(app.baseLogger());
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* MainHandler for ReportManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#include "main_handler.h"
|
||||
|
||||
#include "settings.h"
|
||||
#include "logger.h"
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <DDS/Core/pacemaker.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
|
||||
namespace ReportManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
, m_dynPartData(nullptr)
|
||||
, m_logger(getLogger("MainHandlerAnalyzer"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
m_dynPartData = nullptr;
|
||||
m_ddsHandler = nullptr;
|
||||
m_dbHandler = nullptr;
|
||||
}
|
||||
|
||||
bool MainHandler::init(int domainId, int exerciseId)
|
||||
{
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(exerciseId, Settings::settings()))
|
||||
return false;
|
||||
|
||||
// initialize DDS
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId, exerciseId);
|
||||
if (!m_ddsHandler->init(false))
|
||||
return false;
|
||||
|
||||
m_dynPartData = std::make_shared<HandlerDynamicParticipantData>(m_ddsHandler, m_dbHandler->db());
|
||||
|
||||
if (!m_dynPartData->init())
|
||||
return false;
|
||||
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // ReportManagement
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* MainHandler for ReportManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "dds_handler.h"
|
||||
#include "handler_dynamic_participant_data.h"
|
||||
#include "logger.h"
|
||||
#include "rep_db.h"
|
||||
|
||||
namespace NGLDB
|
||||
{
|
||||
template <typename DB> class DbServiceHandler;
|
||||
}
|
||||
|
||||
namespace ReportManagement
|
||||
{
|
||||
using DbHandler = NGLDB::DbServiceHandler<DatabaseInterface>;
|
||||
class MainHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainHandler(QObject *parent = nullptr);
|
||||
~MainHandler();
|
||||
|
||||
bool init(int domainId, int exerciseId);
|
||||
|
||||
private:
|
||||
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<HandlerDynamicParticipantData> m_dynPartData;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} // namespace ReportManagement
|
||||
Reference in new issue
Block a user