Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Routing Test - handle a session (connection to and from sv for a specific partition)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
#include "session.h"
|
||||
|
||||
namespace RoutingService
|
||||
{
|
||||
Session::Session(const QString &partitionNameSv, const QString &partitionNameWs)
|
||||
: m_partitionNameSv(partitionNameSv.toStdString())
|
||||
, m_partitionNameWs(partitionNameWs.toStdString())
|
||||
, m_logger(getLogger("Session"))
|
||||
{}
|
||||
|
||||
Session::~Session()
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
|
||||
bool Session::init(const dds::domain::DomainParticipant &dpIn,
|
||||
const dds::domain::DomainParticipant &dpOut,
|
||||
const std::vector<TopicDispatcherInterface *> &topicsToRouteToWs,
|
||||
const std::vector<TopicDispatcherInterface *> &topicsToRouteToSv)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Creating new session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
|
||||
m_connectionSvToWs.reset(new Connection(dpIn, m_partitionNameSv, topicsToRouteToWs, "route to WS"));
|
||||
m_connectionWsToSv.reset(new Connection(dpOut, m_partitionNameWs, topicsToRouteToSv, "route from WS"));
|
||||
|
||||
m_connectionSvToWs->setOutput(m_connectionWsToSv.get());
|
||||
m_connectionWsToSv->setOutput(m_connectionSvToWs.get());
|
||||
|
||||
return m_connectionSvToWs->initialize() && m_connectionWsToSv->initialize();
|
||||
}
|
||||
|
||||
|
||||
void Session::shutdown()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Shutting down session for " << m_partitionNameSv << "-" << m_partitionNameWs;
|
||||
if (m_connectionSvToWs)
|
||||
{
|
||||
m_connectionSvToWs->shutdown();
|
||||
m_connectionSvToWs = nullptr;
|
||||
}
|
||||
if (m_connectionWsToSv)
|
||||
{
|
||||
m_connectionWsToSv->shutdown();
|
||||
m_connectionWsToSv = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace RoutingService
|
||||
Reference in new issue
Block a user