SDK: update DDSTopology::GetTasks()

This commit is contained in:
Alexey Rybalchenko 2020-01-24 15:43:03 +01:00 committed by Dennis Klein
parent 264a178424
commit 50dacbcdde
3 changed files with 10 additions and 27 deletions

View File

@ -48,8 +48,8 @@ struct DDSConfig
struct DDSSubscription
{
DDSSubscription()
: fDDSCustomCmd(fService)
, fDDSKeyValue(fService)
: fDDSCustomCmd(fService)
, fDDSKeyValue(fService)
{
LOG(debug) << "$DDS_TASK_PATH: " << dds::env_prop<dds::task_path>();
LOG(debug) << "$DDS_GROUP_NAME: " << dds::env_prop<dds::group_name>();

View File

@ -64,30 +64,16 @@ auto DDSTopology::GetNumRequiredAgents() const -> int
return fImpl->fTopo.getRequiredNofAgents();
}
auto DDSTopology::GetTasks() const -> std::vector<DDSTask>
auto DDSTopology::GetTasks(const std::string& path /* = "" */) const -> std::vector<DDSTask>
{
std::vector<DDSTask> list;
list.reserve(GetNumRequiredAgents());
auto itPair = fImpl->fTopo.getRuntimeTaskIterator(nullptr); // passing nullptr will get all tasks
auto tasks = boost::make_iterator_range(itPair.first, itPair.second);
for (const auto& task : tasks) {
LOG(debug) << "Found task with id: " << task.first << ", "
<< "Path: " << task.second.m_taskPath << ", "
<< "Collection id: " << task.second.m_taskCollectionId << ", "
<< "Name: " << task.second.m_task->getName() << "_" << task.second.m_taskIndex;
list.emplace_back(task.first, task.second.m_taskCollectionId);
dds::topology_api::STopoRuntimeTask::FilterIteratorPair_t itPair;
if (path == "") {
itPair = fImpl->fTopo.getRuntimeTaskIterator(nullptr); // passing nullptr will get all tasks
} else {
itPair = fImpl->fTopo.getRuntimeTaskIteratorMatchingPath(path);
}
return list;
}
auto DDSTopology::GetTasksMatchingPath(const std::string& path) const -> std::vector<DDSTask>
{
std::vector<DDSTask> list;
auto itPair = fImpl->fTopo.getRuntimeTaskIteratorMatchingPath(path);
auto tasks = boost::make_iterator_range(itPair.first, itPair.second);
for (const auto& task : tasks) {

View File

@ -53,11 +53,8 @@ class DDSTopology
/// @brief Get number of required agents for this topology
auto GetNumRequiredAgents() const -> int;
/// @brief Get list of tasks in this topology
auto GetTasks() const -> std::vector<DDSTask>;
/// @brief Get list of tasks matching the provided topology path
auto GetTasksMatchingPath(const std::string&) const -> std::vector<DDSTask>;
/// @brief Get list of tasks in this topology, optionally matching provided path
auto GetTasks(const std::string& = "") const -> std::vector<DDSTask>;
/// @brief Get list of tasks in this topology
auto GetCollections() const -> std::vector<DDSCollection>;