SDK: Make GetDeviceList implementation more readable

This commit is contained in:
Dennis Klein 2019-07-24 10:48:19 +02:00
parent d70a203449
commit 388b1be056
No known key found for this signature in database
GPG Key ID: 08E62D23FA0ECBBC
2 changed files with 8 additions and 7 deletions

View File

@ -65,13 +65,15 @@ std::vector<uint64_t> DDSTopology::GetDeviceList()
taskIDs.reserve(GetNumRequiredAgents()); taskIDs.reserve(GetNumRequiredAgents());
// TODO make sure returned tasks are actually devices // 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 { auto itPair = fImpl->fTopo.getRuntimeTaskIterator(
return true; [](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) { for (auto task : tasks) {
LOG(debug) << "Found task " << it->first << " : " << "Path: " << it->second.m_task->getPath() << "Name: " << it->second.m_task->getName(); LOG(debug) << "Found task " << task.first << ": "
taskIDs.push_back(it->first); << "Path: " << task.second.m_taskPath << ", "
<< "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex;
taskIDs.push_back(task.first);
} }
return taskIDs; return taskIDs;

View File

@ -95,7 +95,6 @@ class Topology
/// @return The result of the state transition /// @return The result of the state transition
auto ChangeState(TopologyTransition t, Duration timeout = std::chrono::milliseconds(0)) -> ChangeStateResult; auto ChangeState(TopologyTransition t, Duration timeout = std::chrono::milliseconds(0)) -> ChangeStateResult;
private: private:
DDSSession fDDSSession; DDSSession fDDSSession;
DDSTopology fDDSTopo; DDSTopology fDDSTopo;