}
}
-void DragonflyZone::createLink(std::string id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
+void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
{
*linkup = nullptr;
*linkdown = nullptr;
-/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
void seal() override;
void generateRouters();
void generateLinks();
- void createLink(std::string id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
+ void createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
private:
void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
std::string link_up = "link_" + netpoint->name() + "_UP";
std::string link_down = "link_" + netpoint->name() + "_DOWN";
- surf::LinkImpl* linkUp = surf_network_model->createLink(link_up.c_str(), bw_out, 0, SURF_LINK_SHARED);
- surf::LinkImpl* linkDown = surf_network_model->createLink(link_down.c_str(), bw_in, 0, SURF_LINK_SHARED);
+ surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
+ surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
}
maxminSystem_->solve_fun = specificSolveFun;
}
-LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
/************
* Resource *
************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy, lmm_system_t system)
: LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
{
NetworkCm02Model();
explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
virtual ~NetworkCm02Model() = default;
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
void updateActionsStateLazy(double now, double delta) override;
void updateActionsStateFull(double now, double delta) override;
class NetworkCm02Link : public LinkImpl {
public:
- NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+ NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy, lmm_system_t system);
virtual ~NetworkCm02Link() = default;
void apply_event(tmgr_trace_event_t event, double value) override;
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
namespace simgrid {
namespace surf {
-LinkImpl* NetworkConstantModel::createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat,
+ e_surf_link_sharing_policy_t policy)
{
xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
"Please remove any link from your platform (and switch to routing='None')",
- name);
+ name.c_str());
return nullptr;
}
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
double nextOccuringEvent(double now) override;
void updateActionsState(double now, double delta) override;
- LinkImpl* createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
+ LinkImpl* createLink(const std::string& name, double bw, double lat,
+ e_surf_link_sharing_policy_t policy) override;
};
/**********
* Resource *
************/
- LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
+ LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint)
: Resource(model, name, constraint), piface_(this)
{
- if (strcmp(name,"__loopback__"))
- xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
+ if (name != "__loopback__")
+ xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name.c_str());
latency_.scale = 1;
bandwidth_.scale = 1;
links->insert({name, this});
- XBT_DEBUG("Create link '%s'",name);
-
+ XBT_DEBUG("Create link '%s'", name.c_str());
}
/** @brief use destroy() instead of this destructor */
* @param latency The initial latency of the Link in seconds
* @param policy The sharing policy of the Link
*/
- virtual LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ virtual LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) = 0;
/**
*/
class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
protected:
- LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint);
+ LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint);
~LinkImpl() override;
public:
xbt_dict_free(&flowFromSock);
}
-LinkImpl* NetworkNS3Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new LinkNS3(this, name, bandwidth, latency);
* Resource *
************/
-LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency)
+LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwidth, double latency)
: LinkImpl(model, name, nullptr)
{
bandwidth_.peak = bandwidth;
public:
NetworkNS3Model();
~NetworkNS3Model();
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
double nextOccuringEvent(double now) override;
************/
class LinkNS3 : public LinkImpl {
public:
- explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
+ explicit LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwidth, double latency);
~LinkNS3();
void apply_event(tmgr_trace_event_t event, double value) override;
-/* Copyright (c) 2007-2010, 2013-2015. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2013-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
return new CpuL07(this, host, speedPerPstate, core);
}
-LinkImpl* NetworkL07Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new LinkL07(this, name, bandwidth, latency, policy);
CpuL07::~CpuL07()=default;
-LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
+LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
: LinkImpl(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
{
-/* Copyright (c) 2013-2015. The SimGrid Team.
+/* Copyright (c) 2013-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
public:
NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
~NetworkL07Model();
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
class LinkL07 : public LinkImpl {
public:
- LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
+ LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy);
~LinkL07() override;
bool isUsed() override;
}
for (auto const& link_name : names) {
simgrid::surf::LinkImpl* l =
- surf_network_model->createLink(link_name.c_str(), link->bandwidth, link->latency, link->policy);
+ surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
if (link->properties) {
for (auto const& elm : *link->properties)
namespace simgrid {
namespace surf {
-Resource::Resource(Model* model, const char* name, lmm_constraint_t constraint)
+Resource::Resource(Model* model, const std::string& name, lmm_constraint_t constraint)
: name_(name), model_(model), constraint_(constraint)
{}
* @param name The name of the Resource
* @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
*/
- Resource(Model *model, const char *name, lmm_constraint_t constraint);
+ Resource(Model * model, const std::string& name, lmm_constraint_t constraint);
virtual ~Resource();