Files
qt5-legatus-legacy/Lts/Services/CentralEffectSimulation/Plugins/Basic/plugin.cpp
T
2026-08-13 18:33:10 +02:00

96 lines
3.5 KiB
C++
Executable File

/**
* Plugin CentralEffectSimulation Basic
* $Id$
* $HeadURL$
* $Author$
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
*/
#include "plugin.h"
#include "logger.h"
namespace CentralEffectSimulationBasic
{
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulationBasicPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
NGL::Settings *settings,
CentralEffectSimulation::MainHandler *mainHandler)
{
return std::make_shared<CesBasicInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
}
CesBasicInterfaceImpl::CesBasicInterfaceImpl(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.Basic.CesBasicInterfaceImpl"))
{
Q_UNUSED(settings)
}
CesBasicInterfaceImpl::~CesBasicInterfaceImpl()
{
m_handlerParticipantBorderline.reset();
m_handlerSimulatedMovement.reset();
}
bool CesBasicInterfaceImpl::init(int domainId, int exerciseId)
{
m_domainId = domainId;
m_exerciseId = exerciseId;
INFO_LOG(m_logger) << "CesBasicInterfaceImpl::init()"
<< " m_domainId=" << m_domainId
<< " m_exerciseId=" << m_exerciseId;
// initialize handlerParticipantBorderline
m_handlerParticipantBorderline = std::make_shared<HandlerParticipantBorderline>(m_ddsHandler,
m_handlerParticipant,
this);
if (!m_handlerParticipantBorderline->init())
{
ERROR_LOG(m_logger) << "Initialisation HandlerParticipantBorderline failed.";
return false;
}
// initialize handlerSimulatedMovement
m_handlerSimulatedMovement = std::make_shared<HandlerSimulatedMovement>(m_ddsHandler,
m_handlerParticipant,
m_db,
this);
if (!m_handlerSimulatedMovement->init())
{
ERROR_LOG(m_logger) << "Initialisation m_handlerSimulatedMovement failed.";
return false;
}
INFO_LOG(m_logger) << "CentralEffectSimulationBasicInterfaceImpl::init() return true";
return true;
}
QString CesBasicInterfaceImpl::echo(const QString &message)
{
QString ret(QStringLiteral("<<<< %1 >>>> CesBasicInterfaceImpl::echo").arg(message));
INFO_LOG(m_logger) << "CesBasicInterfaceImpl::echo return:" << ret;
DEBUG_LOG(m_logger) << "DEBUG: CesBasicInterfaceImpl::echo return:" << ret;
return ret;
}
} //namespace CentralEffectSimulationBasic