Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+74
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* MainHandler for SituationReplay
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hanna E. Rathje, SLSE, 2016-01-13
|
||||
*/
|
||||
|
||||
#include "main_handler.h"
|
||||
#include "settings.h"
|
||||
#include "db_reader.h"
|
||||
|
||||
#include "handler_situation_replay.h"
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <ngldb/db_service_handler.h>
|
||||
|
||||
namespace SituationReplay
|
||||
{
|
||||
|
||||
MainHandler::MainHandler()
|
||||
: m_handlerSrp(nullptr)
|
||||
, m_ddsInterface(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
m_dbReader = nullptr;
|
||||
m_handlerSrp = nullptr;
|
||||
m_ddsInterface = nullptr;
|
||||
m_dbHandler = nullptr;
|
||||
}
|
||||
|
||||
bool MainHandler::init(const SituationReplay::ConnectionParams &input,
|
||||
const SituationReplay::ConnectionParams &output)
|
||||
{
|
||||
// initialize database
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(input.partitionId, Settings::settings()))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation dbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize DDS
|
||||
m_ddsInterface = std::make_shared<DdsHandler>(input, output);
|
||||
if (!m_ddsInterface->init())
|
||||
return false;
|
||||
|
||||
m_dbReader = std::make_shared<DbReader>(m_ddsInterface->ddsReplay(), input.partitionId, true);
|
||||
if (!m_dbReader->init(m_dbHandler->db()->database()))
|
||||
return false;
|
||||
|
||||
// read project specific data from database
|
||||
// publish project specific data
|
||||
// initialize the specific handler
|
||||
if (!initSrpHandler(input.partitionId, output.partitionId))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainHandler::initSrpHandler(int partitionIdIn, int partitionIdOut)
|
||||
{
|
||||
m_handlerSrp.reset(new HandlerSituationReplay(m_ddsInterface, m_dbHandler->db(), m_dbReader));
|
||||
|
||||
if (!m_handlerSrp->init(partitionIdIn, partitionIdOut))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace SituationReplay
|
||||
Reference in new issue
Block a user