Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use xbt::string for MC hostnames.
[simgrid.git] / src / mc / api.cpp
index a7847e73346fe4b1e02e6694180301abd7ef9e3f..c4f6abcf13916eb7a342c85398293083db5b1f69 100644 (file)
@@ -291,9 +291,14 @@ bool Api::request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2) const
 }
 
 const char* Api::actor_get_host_name(smx_actor_t actor) const
+{
+  return get_actor_host_name(actor).c_str();
+}
+
+xbt::string const& Api::get_actor_host_name(smx_actor_t actor) const
 {
   if (mc_model_checker == nullptr)
-    return actor->get_host()->get_cname();
+    return actor->get_host()->get_name();
 
   const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
 
@@ -305,8 +310,8 @@ const char* Api::actor_get_host_name(smx_actor_t actor) const
   std::vector<char> hostname(remote_string.len + 1);
   // no need to read the terminating null byte, and thus hostname[remote_string.len] is guaranteed to be '\0'
   process->read_bytes(hostname.data(), remote_string.len, remote(remote_string.data));
-  info->hostname = mc_model_checker->get_host_name(hostname.data()).c_str();
-  return info->hostname;
+  info->hostname = &mc_model_checker->get_host_name(hostname.data());
+  return *info->hostname;
 }
 
 const char* Api::actor_get_name(smx_actor_t actor) const
@@ -428,12 +433,6 @@ std::vector<char> Api::get_pattern_comm_data(RemotePtr<kernel::activity::CommImp
   return buffer;
 }
 
-const char* Api::get_actor_host_name(smx_actor_t actor) const
-{
-  const char* host_name = actor_get_host_name(actor);
-  return host_name;
-}
-
 #if HAVE_SMPI
 bool Api::check_send_request_detached(smx_simcall_t const& simcall) const
 {
@@ -605,11 +604,6 @@ void Api::mc_exit(int status) const
   mc_model_checker->exit(status);
 }
 
-std::string const& Api::mc_get_host_name(std::string const& hostname) const
-{
-  return mc_model_checker->get_host_name(hostname);
-}
-
 void Api::dump_record_path() const
 {
   simgrid::mc::dumpRecordPath();
@@ -999,11 +993,6 @@ std::string Api::request_get_dot_output(smx_simcall_t req, int value) const
   return xbt::string_printf("label = \"%s\", color = %s, fontcolor = %s", label.c_str(), color, color);
 }
 
-const char* Api::simcall_get_name(simgrid::simix::Simcall kind) const
-{
-  return simcall_names[static_cast<int>(kind)];
-}
-
 #if HAVE_SMPI
 int Api::get_smpi_request_tag(smx_simcall_t const& simcall, simgrid::simix::Simcall type) const
 {