Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
extend the example with another type of Zone
[simgrid.git] / src / s4u / s4u_netzone.cpp
index 22889ef..6e1b14b 100644 (file)
@@ -86,6 +86,17 @@ void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
   }
 }
 
+int NetZone::getHostCount()
+{
+  int count = 0;
+  for (auto const& card : vertices_) {
+    s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->getName());
+    if (host != nullptr)
+      count++;
+  }
+  return count;
+}
+
 int NetZone::addComponent(kernel::routing::NetPoint* elm)
 {
   vertices_.push_back(elm);