X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5e044aacdc2c13e6d78c4f5bb64db0f25140bc10..f6acb706fa20197049c849cf3021077c5fa97f93:/src/s4u/s4u_engine.cpp diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index f991b12959..9913599593 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -154,6 +154,21 @@ NetZone* Engine::getNetzoneByNameOrNull(const char* name) return netzoneByNameRecursive(getNetRoot(), name); } +template void netzoneByTypeRecursive(s4u::NetZone* current, std::vector* whereto) +{ + for (auto const& elem : *(current->getChildren())) { + netzoneByTypeRecursive(elem, whereto); + if (elem == dynamic_cast(elem)) + whereto->push_back(elem); + } +} + +/** @brief Retrieve all existing NetZones of the subtype of the whereto vector */ +template void Engine::getNetzoneByType(std::vector* whereto) +{ + netzoneByTypeRecursive(getNetRoot(), whereto); +} + /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */ simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(std::string name) {