X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4de2a148bea34f550b79c07fb5e80ac36e6aa0e9..3f53fa0e417dcf21536630d285ec51c0deced9a8:/examples/cpp/dag-from-dot/s4u-dag-from-dot.cpp diff --git a/examples/cpp/dag-from-dot/s4u-dag-from-dot.cpp b/examples/cpp/dag-from-dot/s4u-dag-from-dot.cpp index 10d32a5b3b..079e323316 100644 --- a/examples/cpp/dag-from-dot/s4u-dag-from-dot.cpp +++ b/examples/cpp/dag-from-dot/s4u-dag-from-dot.cpp @@ -1,6 +1,6 @@ /* simple test trying to load a DOT file. */ -/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -44,13 +44,11 @@ int main(int argc, char** argv) static_cast(dag.back().get())->set_host(hosts[0]); for (const auto& a : dag) { - auto* exec = dynamic_cast(a.get()); - if (exec != nullptr && exec->get_name() != "end") { + if (auto* exec = dynamic_cast(a.get()); exec != nullptr && exec->get_name() != "end") { exec->set_host(hosts[cursor % count]); cursor++; } - auto* comm = dynamic_cast(a.get()); - if (comm != nullptr) { + if (auto* comm = dynamic_cast(a.get())) { auto pred = dynamic_cast((*comm->get_dependencies().begin()).get()); auto succ = dynamic_cast(comm->get_successors().front().get()); comm->set_source(pred->get_host())->set_destination(succ->get_host()); @@ -62,13 +60,11 @@ int main(int argc, char** argv) XBT_INFO("-------------- Summary of executed schedule ------------------"); for (const auto& a : dag) { - const auto* exec = dynamic_cast(a.get()); - if (exec != nullptr) { + if (const auto* exec = dynamic_cast(a.get())) { XBT_INFO("[%f->%f] '%s' executed on %s", exec->get_start_time(), exec->get_finish_time(), exec->get_cname(), exec->get_host()->get_cname()); } - const auto* comm = dynamic_cast(a.get()); - if (comm != nullptr) { + if (const auto* comm = dynamic_cast(a.get())) { XBT_INFO("[%f->%f] '%s' transferred from %s to %s", comm->get_start_time(), comm->get_finish_time(), comm->get_cname(), comm->get_source()->get_cname(), comm->get_destination()->get_cname()); }