From 388b1be05637c72c066bbcd9768dbbe956a5254c Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Wed, 24 Jul 2019 10:48:19 +0200 Subject: [PATCH] SDK: Make GetDeviceList implementation more readable --- fairmq/sdk/DDSTopology.cxx | 14 ++++++++------ fairmq/sdk/Topology.h | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fairmq/sdk/DDSTopology.cxx b/fairmq/sdk/DDSTopology.cxx index 7c5515f4..ec72bffd 100644 --- a/fairmq/sdk/DDSTopology.cxx +++ b/fairmq/sdk/DDSTopology.cxx @@ -65,13 +65,15 @@ std::vector DDSTopology::GetDeviceList() 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 { - return true; - }); + auto itPair = fImpl->fTopo.getRuntimeTaskIterator( + [](const dds::topology_api::STopoRuntimeTask::FilterIterator_t::value_type& /*value*/) -> bool { return true; }); + auto tasks = boost::make_iterator_range(itPair.first, itPair.second); - for (auto& it = taskIt.first; it != taskIt.second; ++it) { - LOG(debug) << "Found task " << it->first << " : " << "Path: " << it->second.m_task->getPath() << "Name: " << it->second.m_task->getName(); - taskIDs.push_back(it->first); + for (auto task : tasks) { + LOG(debug) << "Found task " << task.first << ": " + << "Path: " << task.second.m_taskPath << ", " + << "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex; + taskIDs.push_back(task.first); } return taskIDs; diff --git a/fairmq/sdk/Topology.h b/fairmq/sdk/Topology.h index e02d5a65..56b1e32c 100644 --- a/fairmq/sdk/Topology.h +++ b/fairmq/sdk/Topology.h @@ -95,7 +95,6 @@ class Topology /// @return The result of the state transition auto ChangeState(TopologyTransition t, Duration timeout = std::chrono::milliseconds(0)) -> ChangeStateResult; - private: DDSSession fDDSSession; DDSTopology fDDSTopo;