Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small cleanups in the simix timers
[simgrid.git] / src / s4u / s4u_host.cpp
index f39b2a2..5439ce8 100644 (file)
@@ -87,11 +87,8 @@ Host* Host::by_name_or_null(const char* name)
 }
 Host* Host::by_name_or_null(std::string name)
 {
-  try {
-    return host_list.at(name);
-  } catch (std::out_of_range& unfound) {
-    return nullptr;
-  }
+  auto host = host_list.find(name);
+  return host == host_list.end() ? nullptr : host->second;
 }
 
 Host *Host::current(){
@@ -177,11 +174,9 @@ void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>* links, double* late
 }
 
 /** Get the properties assigned to a host */
-xbt_dict_t Host::getProperties()
+std::map<std::string, std::string>* Host::getProperties()
 {
-  return simgrid::simix::kernelImmediate([this] {
-    return this->pimpl_->getProperties();
-  });
+  return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); });
 }
 
 /** Retrieve the property value (or nullptr if not set) */
@@ -190,7 +185,7 @@ const char* Host::getProperty(const char* key)
   return this->pimpl_->getProperty(key);
 }
 
-void Host::setProperty(const char* key, const char* value)
+void Host::setProperty(std::string key, std::string value)
 {
   simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); });
 }