82 lines
2.6 KiB
C++
Executable File
82 lines
2.6 KiB
C++
Executable File
/**
|
|
* Plugin NBC
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
|
*/
|
|
|
|
#include "plugin.h"
|
|
#include "settings.h"
|
|
|
|
namespace CES_NBC
|
|
{
|
|
|
|
|
|
std::shared_ptr<CentralEffectSimulation::Plugin::Interface> CentralEffectSimulationNBCPlugin::createInterface(CentralEffectSimulation::Plugin::DataProvider *pdp,
|
|
const std::shared_ptr<DDSConnector::DdsConnector> &dDSConnector,
|
|
NGL::Settings *settings,
|
|
CentralEffectSimulation::MainHandler *mainHandler)
|
|
{
|
|
return std::make_shared<CES_NBCInterfaceImpl>(pdp, dDSConnector, settings, mainHandler);
|
|
}
|
|
|
|
|
|
CES_NBCInterfaceImpl::CES_NBCInterfaceImpl(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.NBC.CES_NBCInterfaceImpl"))
|
|
{
|
|
Q_UNUSED(settings)
|
|
}
|
|
|
|
CES_NBCInterfaceImpl::~CES_NBCInterfaceImpl()
|
|
{
|
|
m_handlerNBC.reset();
|
|
}
|
|
|
|
|
|
bool CES_NBCInterfaceImpl::init(int domainId, int exerciseId)
|
|
{
|
|
|
|
m_domainId = domainId;
|
|
m_exerciseId = exerciseId;
|
|
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::init()"
|
|
<< " m_domainId=" << m_domainId
|
|
<< " m_exerciseId=" << m_exerciseId;
|
|
|
|
|
|
|
|
// initialize handlerNBC
|
|
m_handlerNBC = std::make_shared<HandlerNBC>(m_ddsHandler,
|
|
m_handlerParticipant,
|
|
this);
|
|
|
|
if (!m_handlerNBC->init())
|
|
{
|
|
ERROR_LOG(m_logger) << "Initialisation m_handlerNBC failed.";
|
|
return false;
|
|
}
|
|
|
|
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::init() return true";
|
|
return true;
|
|
}
|
|
|
|
QString CES_NBCInterfaceImpl::echo(const QString &message)
|
|
{
|
|
|
|
QString ret(QStringLiteral("<<<< %1 >>>> CES_NBCInterfaceImpl::echo").arg(message));
|
|
INFO_LOG(m_logger) << "CES_NBCInterfaceImpl::echo return:" << ret;
|
|
DEBUG_LOG(m_logger) << "DEBUG: CES_NBCInterfaceImpl::echo return:" << ret;
|
|
return ret;
|
|
}
|
|
|
|
} //namespace CES_NBC
|