Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Add const.
[simgrid.git] / src / s4u / s4u_Host.cpp
index b52da40..f366323 100644 (file)
@@ -174,12 +174,17 @@ NetZone* Host::get_englobing_zone()
   return pimpl_netpoint_->get_englobing_zone()->get_iface();
 }
 
-void Host::send_to(Host* dest, double byte_amount)
+void Host::sendto(Host* dest, double byte_amount)
+{
+  sendto_async(dest, byte_amount)->wait();
+}
+
+ActivityPtr Host::sendto_async(Host* dest, double byte_amount)
 {
   std::vector<Host*> m_host_list   = {this, dest};
   std::vector<double> flops_amount = {0, 0};
   std::vector<double> bytes_amount = {0, byte_amount, 0, 0};
-  this_actor::parallel_execute(m_host_list, flops_amount, bytes_amount);
+  return this_actor::exec_init(m_host_list, flops_amount, bytes_amount)->start();
 }
 
 /** Get the properties assigned to a host */
@@ -318,12 +323,6 @@ sg_host_t* sg_host_list()
   xbt_assert(host_count > 0, "There is no host!");
   std::vector<simgrid::s4u::Host*> hosts = e->get_all_hosts();
 
-  auto last = std::remove_if(begin(hosts), end(hosts), [](const simgrid::s4u::Host* host) {
-    return not host || not host->get_netpoint() || not host->get_netpoint()->is_host();
-  });
-  std::sort(begin(hosts), last,
-            [](const simgrid::s4u::Host* a, const simgrid::s4u::Host* b) { return a->get_name() < b->get_name(); });
-
   sg_host_t* res = xbt_new(sg_host_t, hosts.size());
   memcpy(res, hosts.data(), sizeof(sg_host_t) * hosts.size());
 
@@ -390,7 +389,7 @@ void sg_host_user_destroy(sg_host_t host) // deprecated
 }
 
 // ========= storage related functions ============
-void sg_host_disks(sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
+void sg_host_disks(const_sg_host_t host, unsigned int* disk_count, sg_disk_t** disks)
 {
   std::vector<sg_disk_t> list = host->get_disks();
   *disk_count                 = list.size();
@@ -597,9 +596,9 @@ double sg_host_route_bandwidth(const_sg_host_t from, const_sg_host_t to)
   return min_bandwidth;
 }
 
-void sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount)
+void sg_host_sendto(sg_host_t from, sg_host_t to, double byte_amount)
 {
-  from->send_to(to, byte_amount);
+  from->sendto(to, byte_amount);
 }
 
 /** @brief Displays debugging information about a host */