SDK: Fix CTopology member init and remove separate init step again

This commit is contained in:
Dennis Klein 2019-07-24 10:34:10 +02:00
parent de4fca177e
commit bc98ab1eed
No known key found for this signature in database
GPG Key ID: 08E62D23FA0ECBBC
4 changed files with 8 additions and 16 deletions

View File

@ -13,6 +13,7 @@
#include <fairmq/sdk/DDSInfo.h>
#include <fairmq/sdk/DDSEnvironment.h>
#include <fairmq/sdk/DDSSession.h>
#include <fairmq/sdk/DDSTopology.h>
#include <fairmq/sdk/Topology.h>
// IWYU pragma: end_exports

View File

@ -8,6 +8,8 @@
#include "DDSTopology.h"
#include <boost/range/iterator_range.hpp>
#include <fairmq/sdk/DDSEnvironment.h>
#include <fairmq/Tools.h>
@ -29,14 +31,12 @@ struct DDSTopology::Impl
explicit Impl(Path topoFile, DDSEnvironment env)
: fEnv(std::move(env))
, fTopoFile(std::move(topoFile))
, fTopo(nullptr)
{
LOG(warn) << topoFile;
}
, fTopo(fTopoFile.string())
{}
DDSEnvironment fEnv;
Path fTopoFile;
std::unique_ptr<dds::topology_api::CTopology> fTopo;
dds::topology_api::CTopology fTopo;
};
DDSTopology::DDSTopology(Path topoFile, DDSEnvironment env)
@ -54,20 +54,15 @@ auto DDSTopology::GetTopoFile() const -> Path
return file;
}
void DDSTopology::CreateTopology(Path topoFile)
{
fImpl->fTopo = tools::make_unique<dds::topology_api::CTopology>(fImpl->fTopoFile.c_str());
}
int DDSTopology::GetNumRequiredAgents()
{
return fImpl->fTopo->getRequiredNofAgents();
return fImpl->fTopo.getRequiredNofAgents();
}
std::vector<uint64_t> DDSTopology::GetDeviceList()
{
std::vector<uint64_t> taskIDs;
taskIDs.reserve(fImpl->fTopo->getRequiredNofAgents());
taskIDs.reserve(GetNumRequiredAgents());
// TODO make sure returned tasks are actually devices
dds::topology_api::STopoRuntimeTask::FilterIteratorPair_t taskIt = fImpl->fTopo->getRuntimeTaskIterator([](const dds::topology_api::STopoRuntimeTask::FilterIterator_t::value_type& value) -> bool {

View File

@ -41,8 +41,6 @@ class DDSTopology
/// @throw std::runtime_error
auto GetTopoFile() const -> Path;
void CreateTopology(Path);
/// @brief Get number of required agents for this topology
int GetNumRequiredAgents();

View File

@ -61,8 +61,6 @@ Topology::Topology(DDSTopology topo, DDSSession session)
, fExecutionThread()
, fShutdown(false)
{
fDDSTopo.CreateTopology(fDDSTopo.GetTopoFile());
std::vector<uint64_t> deviceList = fDDSTopo.GetDeviceList();
for (const auto& d : deviceList) {
LOG(info) << "fair::mq::Topology Adding device " << d;