if (src->is_netzone()) {
std::string srcName = "router_" + src->get_name();
std::string dstName = "router_" + dst->get_name();
- route->gw_src = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(srcName.c_str());
- route->gw_dst = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(dstName.c_str());
+ route->gw_src = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(srcName);
+ route->gw_dst = simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(dstName);
}
/* Retrieve the private links */
// Create private link
std::string host_id = cluster->prefix + std::to_string(i) + cluster->suffix;
- NetPointNs3* host_src = sg_host_by_name(host_id.c_str())->pimpl_netpoint->extension<NetPointNs3>();
+ NetPointNs3* host_src = simgrid::s4u::Host::by_name(host_id)->pimpl_netpoint->extension<NetPointNs3>();
xbt_assert(host_src, "Cannot find a NS3 host of name %s", host_id.c_str());
// Any NS3 route is symmetrical
/** @brief Add a link connecting a host to the rest of its AS (which must be cluster or vivaldi) */
void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
{
- simgrid::kernel::routing::NetPoint* netpoint = sg_host_by_name(hostlink->id.c_str())->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->pimpl_netpoint;
xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
"Only hosts from Cluster and Vivaldi ASes can get a host_link.");
#include "storage_n11.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Host.hpp"
#include "src/kernel/lmm/maxmin.hpp"
#include "src/surf/xml/platf.hpp"
#include "surf/surf.hpp"
void check_disk_attachment()
{
for (auto const& s : simgrid::s4u::Engine::get_instance()->get_all_storages()) {
- simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->get_impl()->getHost().c_str());
+ simgrid::kernel::routing::NetPoint* host_elm =
+ simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(s->get_impl()->getHost());
if (not host_elm)
surf_parse_error(std::string("Unable to attach storage ") + s->get_cname() + ": host " +
- s->get_impl()->getHost().c_str() + " does not exist.");
+ s->get_impl()->getHost() + " does not exist.");
else
- s->set_host(sg_host_by_name(s->get_impl()->getHost().c_str()));
+ s->set_host(simgrid::s4u::Host::by_name(s->get_impl()->getHost()));
}
}
xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
- simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
+ simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
xbt_assert(host, "Host %s undefined", elm.second.c_str());
simgrid::surf::Cpu* cpu = host->pimpl_cpu;
xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
- simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
+ simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
xbt_assert(host, "Host %s undefined", elm.second.c_str());
simgrid::surf::Cpu* cpu = host->pimpl_cpu;
xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
- sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str());
+ sg_link_t link = simgrid::s4u::Link::by_name(elm.second);
xbt_assert(link, "Link %s undefined", elm.second.c_str());
link->set_state_profile(profile);
}
for (auto const& elm : trace_connect_list_link_bw) {
xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
- sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str());
+ sg_link_t link = simgrid::s4u::Link::by_name(elm.second);
xbt_assert(link, "Link %s undefined", elm.second.c_str());
link->set_bandwidth_profile(profile);
}
for (auto const& elm : trace_connect_list_link_lat) {
xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
- sg_link_t link = simgrid::s4u::Link::by_name(elm.second.c_str());
+ sg_link_t link = simgrid::s4u::Link::by_name(elm.second);
xbt_assert(link, "Link %s undefined", elm.second.c_str());
link->set_latency_profile(profile);
}
void surf_parse_assert_netpoint(const std::string& hostname, const std::string& pre, const std::string& post)
{
- if (sg_netpoint_by_name_or_null(hostname.c_str()) != nullptr) // found
+ if (simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(hostname) != nullptr) // found
return;
std::string msg = pre + hostname + post + " Existing netpoints: \n";
for (unsigned int test = 1; test <= args[0].size(); test++) {
simgrid::s4u::this_actor::sleep_until(test * 5 - 5);
std::string* mboxName = new std::string("Test #" + std::to_string(test));
- simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName->c_str());
+ simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(*mboxName);
switch (args[0][test - 1]) {
case 'r':
for (unsigned int test = 1; test <= args[0].size(); test++) {
simgrid::s4u::this_actor::sleep_until(test * 5 - 5);
std::string mboxName = "Test #" + std::to_string(test);
- simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName.c_str());
+ simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(mboxName);
void* received = nullptr;
switch (args[0][test - 1]) {