81 lines
2.0 KiB
C++
Executable File
81 lines
2.0 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Data Plugin for InfrastructureManagement
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Mike Wille, SLSE, 2016-08-24
|
|
*/
|
|
|
|
#include "ism_data_plugin.h"
|
|
#include "ism_foreign_data_plugin.h"
|
|
|
|
#include <LtsSession/lts_session_data_dds.h>
|
|
|
|
|
|
namespace InfrastructureManagement
|
|
{
|
|
|
|
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
|
{
|
|
std::shared_ptr<Interface::Dtc> dtc;
|
|
std::shared_ptr<Interface::Ftc> ftc;
|
|
// if (!session->createTopicClient(dtc, ftc, true))
|
|
// return std::shared_ptr<DataPluginBase::Interface>();
|
|
|
|
return std::make_shared<DataInterfaceImpl>(session, dtc, ftc);
|
|
}
|
|
|
|
DataInterfaceImpl::DataInterfaceImpl(LtsSession::LtsSessionDataDds *session,
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Dtc> &dtc,
|
|
const std::shared_ptr<InfrastructureManagement::Interface::Ftc> &ftc)
|
|
: DataInterface()
|
|
, m_dtc(dtc)
|
|
, m_ftc(ftc)
|
|
, m_session(session)
|
|
//, m_foreignInterface(std::make_shared<ForeignInterfaceImpl>(dtc))
|
|
{}
|
|
|
|
std::shared_ptr<ForeignDataInterface> DataInterfaceImpl::getForeignDataInterface()
|
|
{
|
|
if (m_foreignInterface)
|
|
return m_foreignInterface;
|
|
|
|
if (!getDtc())
|
|
return {};
|
|
|
|
int exerciseId = -1;
|
|
if (m_session)
|
|
exerciseId = m_session->exerciseId();
|
|
|
|
m_foreignInterface = std::make_shared<ForeignInterfaceImpl>(m_dtc, exerciseId);
|
|
return m_foreignInterface;
|
|
}
|
|
|
|
std::shared_ptr<InfrastructureManagement::Interface::Dtc> DataInterfaceImpl::getDtc()
|
|
{
|
|
if (m_dtcEnabled)
|
|
return m_dtc;
|
|
|
|
if (!m_session->createTopicClient(m_dtc, false, true))
|
|
return {};
|
|
|
|
m_dtcEnabled = true;
|
|
return m_dtc;
|
|
}
|
|
|
|
std::shared_ptr<InfrastructureManagement::Interface::Ftc> DataInterfaceImpl::getFtc()
|
|
{
|
|
if (m_ftcEnabled)
|
|
return m_ftc;
|
|
|
|
if (!m_session->createTopicClient(m_ftc, true, true))
|
|
return {};
|
|
|
|
m_ftcEnabled = true;
|
|
return m_ftc;
|
|
}
|
|
|
|
} // namespace InfrastructureManagement
|