From: Arnaud Giersch Date: Sat, 14 Oct 2017 20:15:40 +0000 (+0200) Subject: Change name() to getCname() and add getName() in s4u::Link. X-Git-Tag: v3.18~460 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/afd2ff03984f505acd352509ee102f086e0374a3 Change name() to getCname() and add getName() in s4u::Link. --- diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index de05738704..fce807cfe4 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -10,6 +10,7 @@ #include #include +#include #include /*********** @@ -36,8 +37,10 @@ public: /** @brief Retrieve a link from its name */ static Link* byName(const char* name); - /** @brief Get da name */ - const char* name(); + /** @brief Retrieves the name of that link as a C++ string */ + const std::string& getName() const; + /** @brief Retrieves the name of that link as a C string */ + const char* getCname() const; /** @brief Get the bandwidth in bytes per second of current Link */ double bandwidth(); diff --git a/src/s4u/s4u_link.cpp b/src/s4u/s4u_link.cpp index 60ef3fba7f..66351429ac 100644 --- a/src/s4u/s4u_link.cpp +++ b/src/s4u/s4u_link.cpp @@ -21,7 +21,7 @@ extern "C" { const char* sg_link_name(sg_link_t link) { - return link->name(); + return link->getCname(); } sg_link_t sg_link_by_name(const char* name) { @@ -82,7 +82,11 @@ Link* Link::byName(const char* name) return nullptr; return &res->piface_; } -const char* Link::name() +const std::string& Link::getName() const +{ + return this->pimpl_->getName(); +} +const char* Link::getCname() const { return this->pimpl_->getCname(); } diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index cec863df5a..774ad4b2ee 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -197,7 +197,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) double bandwidth_value = link.bandwidth(); double latency_value = link.latency(); - container_t container = new simgrid::instr::Container(link.name(), simgrid::instr::INSTR_LINK, father); + container_t container = new simgrid::instr::Container(link.getCname(), simgrid::instr::INSTR_LINK, father); if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) { simgrid::instr::Type* bandwidth = container->type_->getOrCreateVariableType("bandwidth", ""); diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 2297065f12..622d3bca57 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -103,7 +103,7 @@ static void dump_platform() simgrid::s4u::Link* link = links[i]; std::printf(" name(), link->bandwidth(), link->latency()); + std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->getCname(), link->bandwidth(), link->latency()); if (sg_link_is_shared(link)) { std::printf("/>\n"); } else {