]> AND Public Git Repository - simgrid.git/blobdiff - src/s4u/s4u_Host.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better check for mpi_datatype_null
[simgrid.git] / src / s4u / s4u_Host.cpp
index 72c27ad7ca5eb270ffd99c7fdadd410e7306048b..9db61956a86ce99d962c0bfc29fa0776a02deb71 100644 (file)
@@ -134,7 +134,7 @@ std::vector<ActorPtr> Host::get_all_actors() const
 }
 
 /** @brief Returns how many actors (daemonized or not) have been launched on this host */
-int Host::get_actor_count() const
+size_t Host::get_actor_count() const
 {
   return pimpl_->get_actor_count();
 }
@@ -172,7 +172,7 @@ void Host::route_to(const Host* dest, std::vector<kernel::resource::LinkImpl*>&
 }
 
 /** @brief Returns the networking zone englobing that host */
-NetZone* Host::get_englobing_zone()
+NetZone* Host::get_englobing_zone() const
 {
   return pimpl_netpoint_->get_englobing_zone()->get_iface();
 }
@@ -277,7 +277,7 @@ std::vector<double> Host::convert_pstate_speed_vector(const std::vector<std::str
   speed_list.reserve(speed_per_state.size());
   for (const auto& speed_str : speed_per_state) {
     try {
-      double speed = xbt_parse_get_speed("", 0, speed_str.c_str(), nullptr, "");
+      double speed = xbt_parse_get_speed("", 0, speed_str, "");
       speed_list.push_back(speed);
     } catch (const simgrid::ParseError&) {
       throw std::invalid_argument(std::string("Invalid speed value: ") + speed_str);
@@ -319,7 +319,9 @@ std::vector<Disk*> Host::get_disks() const
 Disk* Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth)
 {
   return kernel::actor::simcall([this, &name, read_bandwidth, write_bandwidth] {
-    return this->pimpl_->create_disk(name, read_bandwidth, write_bandwidth);
+    auto* disk = pimpl_->create_disk(name, read_bandwidth, write_bandwidth);
+    pimpl_->add_disk(disk);
+    return disk;
   });
 }
 
@@ -327,14 +329,14 @@ Disk* Host::create_disk(const std::string& name, const std::string& read_bandwid
 {
   double d_read;
   try {
-    d_read = xbt_parse_get_bandwidth("", 0, read_bandwidth.c_str(), nullptr, "");
+    d_read = xbt_parse_get_bandwidth("", 0, read_bandwidth, "");
   } catch (const simgrid::ParseError&) {
     throw std::invalid_argument(std::string("Impossible to create disk: ") + name +
                                 std::string(". Invalid read bandwidth: ") + read_bandwidth);
   }
   double d_write;
   try {
-    d_write = xbt_parse_get_bandwidth("", 0, write_bandwidth.c_str(), nullptr, "");
+    d_write = xbt_parse_get_bandwidth("", 0, write_bandwidth, "");
   } catch (const simgrid::ParseError&) {
     throw std::invalid_argument(std::string("Impossible to create disk: ") + name +
                                 std::string(". Invalid write bandwidth: ") + write_bandwidth);
@@ -395,7 +397,7 @@ 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();
 
-  sg_host_t* res = xbt_new(sg_host_t, hosts.size());
+  auto* res = xbt_new(sg_host_t, hosts.size());
   std::copy(begin(hosts), end(hosts), res);
 
   return res;