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());
// 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;

View File

@ -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;