From d7eafaa8d4c2e62e38309af508b04888fbbd1270 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 17 Jan 2022 15:37:06 +0100 Subject: [PATCH 1/1] Rename method, and make it return a boolean. --- include/simgrid/s4u/Activity.hpp | 2 +- src/dag/loaders.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index df676a1e7f..4319dcbb1c 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -46,7 +46,7 @@ public: virtual bool is_assigned() const = 0; bool dependencies_solved() const { return dependencies_.empty(); } - unsigned long is_waited_by() const { return successors_.size(); } + bool has_no_successor() const { return successors_.empty(); } const std::set& get_dependencies() const { return dependencies_; } const std::vector& get_successors() const { return successors_; } diff --git a/src/dag/loaders.cpp b/src/dag/loaders.cpp index 8187942b15..c697e9e4be 100644 --- a/src/dag/loaders.cpp +++ b/src/dag/loaders.cpp @@ -41,7 +41,7 @@ static bool check_for_cycle(const std::vector& dag) std::vector current; for (const auto& a : dag) - if (dynamic_cast(a.get()) != nullptr && a->is_waited_by() == 0) + if (dynamic_cast(a.get()) != nullptr && a->has_no_successor()) current.push_back(a); while (not current.empty()) { @@ -123,7 +123,7 @@ std::vector create_DAG_from_DAX(const std::string& filename) result.push_back(newfile); } } - if (file->is_waited_by() == 0) { + if (file->has_no_successor()) { for (auto const& it : file->get_dependencies()) { newfile = Comm::sendto_init()->set_name(file->get_name())->set_payload_size(file->get_remaining()); it->add_successor(newfile); @@ -162,7 +162,7 @@ std::vector create_DAG_from_DAX(const std::string& filename) if ((a != root_task) && (a != end_task)) { if (a->dependencies_solved()) root_task->add_successor(a); - if (a->is_waited_by() == 0) + if (a->has_no_successor()) a->add_successor(end_task); } } @@ -267,7 +267,7 @@ std::vector create_DAG_from_dot(const std::string& filename) root->add_successor(a); } - if (a->is_waited_by() == 0 && a != end) { + if (a->has_no_successor() && a != end) { XBT_DEBUG("Activity '%s' has no successors. Add dependency to 'end'", a->get_cname()); a->add_successor(end); } -- 2.20.1