99 lines
3.4 KiB
C++
Executable File
99 lines
3.4 KiB
C++
Executable File
/**
|
|
* Plugin Explosions
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Gerlinde Rudolphus, SLTE, 2024-01-05
|
|
*/
|
|
|
|
#include "plugin.h"
|
|
#include "settings.h"
|
|
#include <ngldb/db_service_handler.h>
|
|
#include <CentralEffectSimulation/main_handler.h>
|
|
|
|
namespace CesExplosions
|
|
{
|
|
|
|
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulationExplosionsPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
|
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
|
NGL::Settings *settings,
|
|
CentralEffectSimulation::MainHandler *mainHandler)
|
|
{
|
|
return std::make_shared<CesExplosionInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
|
}
|
|
|
|
|
|
CesExplosionInterfaceImpl::CesExplosionInterfaceImpl(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
|
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
|
NGL::Settings *settings,
|
|
CentralEffectSimulation::MainHandler *mainHandler)
|
|
: m_pdp(pdp)
|
|
, m_ddsConnector(dDSConnector)
|
|
, m_mainHandler(mainHandler)
|
|
, m_ddsHandler(m_mainHandler->dds())
|
|
, m_db(m_mainHandler->db())
|
|
, m_handlerParticipant(m_mainHandler->handlerParticipant())
|
|
, m_logger(CentralEffectSimulation::getLogger("Plugin.Explosions.HandlerExplosions"))
|
|
{
|
|
Q_UNUSED(settings)
|
|
DEBUG_LOG(m_logger) << "CesExplosionInterfaceImpl";
|
|
}
|
|
|
|
CesExplosionInterfaceImpl::~CesExplosionInterfaceImpl()
|
|
{
|
|
m_handlerExplosions.reset();
|
|
m_handlerVulcano.reset();
|
|
}
|
|
|
|
|
|
bool CesExplosionInterfaceImpl::init(int domainId, int exerciseId)
|
|
{
|
|
DEBUG_LOG(m_logger) << "CesExplosionInterfaceImpl init";
|
|
|
|
m_domainId = domainId;
|
|
m_exerciseId = exerciseId;
|
|
INFO_LOG(m_logger) << "CesExplosionsInterfaceImpl::init()"
|
|
<< " m_domainId=" << m_domainId
|
|
<< " m_exerciseId=" << m_exerciseId;
|
|
|
|
|
|
|
|
// initialize handlerExplosions
|
|
m_handlerExplosions = std::make_shared<HandlerExplosions>(m_ddsHandler,
|
|
m_handlerParticipant,
|
|
m_mainHandler->proxyBuilding(),
|
|
this);
|
|
|
|
if (!m_handlerExplosions->init())
|
|
{
|
|
ERROR_LOG(m_logger) << "Initialisation m_handlerExplosions failed.";
|
|
return false;
|
|
}
|
|
|
|
INFO_LOG(m_logger) << "CesExplosionsInterfaceImpl::init() return true";
|
|
|
|
// initialize handlerVulcano
|
|
m_handlerVulcano = std::make_shared<HandlerVulcano>(m_ddsHandler, this);
|
|
|
|
if (!m_handlerVulcano->init())
|
|
{
|
|
ERROR_LOG(m_logger) << "Initialisation m_handlerVulcano failed.";
|
|
return false;
|
|
}
|
|
|
|
INFO_LOG(m_logger) << "CesExplosionsInterfaceImpl::init() return true";
|
|
|
|
return true;
|
|
}
|
|
|
|
QString CesExplosionInterfaceImpl::echo(const QString &message)
|
|
{
|
|
|
|
QString ret(QStringLiteral("<<<< %1 >>>> CesExplosionsInterfaceImpl::echo").arg(message));
|
|
INFO_LOG(m_logger) << "CesExplosionsInterfaceImpl::echo return:" << ret;
|
|
DEBUG_LOG(m_logger) << "DEBUG: CesExplosionsInterfaceImpl::echo return:" << ret;
|
|
return ret;
|
|
}
|
|
|
|
} //namespace CesExplosions
|