From a0623831eea46d64e95390771cf0cc5bef67ccb1 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 14 Dec 2017 14:58:12 +0100 Subject: [PATCH] add Host::by_name(char*) --- include/simgrid/s4u/Host.hpp | 2 ++ src/s4u/s4u_host.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 889419c1be..a959c5cb89 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -61,6 +61,8 @@ public: /** Retrieves an host from its name, or return nullptr */ static Host* by_name_or_null(std::string name); /** Retrieves an host from its name, or die */ + static s4u::Host* by_name(const char* name); + /** Retrieves an host from its name, or die */ static s4u::Host* by_name(std::string name); /** Retrieves the host on which the current actor is running */ static s4u::Host* current(); diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 9b4f49ac65..82d6d66ca2 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -81,6 +81,10 @@ Host* Host::by_name(std::string name) { return host_list.at(name); // Will raise a std::out_of_range if the host does not exist } +Host* Host::by_name(const char* name) +{ + return host_list.at(std::string(name)); // Will raise a std::out_of_range if the host does not exist +} Host* Host::by_name_or_null(const char* name) { return by_name_or_null(std::string(name)); -- 2.20.1