Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer to use emplace_back.
[simgrid.git] / src / surf / network_ns3.cpp
index 35c7b03..b44c56a 100644 (file)
@@ -70,7 +70,7 @@ NetPointNs3::NetPointNs3() : ns3_node_(ns3::CreateObject<ns3::Node>(0))
   stack.Install(ns3_node_);
 }
 
-WifiZone::WifiZone(std::string name_, simgrid::s4u::Host* host_, ns3::Ptr<ns3::Node> ap_node_,
+WifiZone::WifiZone(const std::string& name_, simgrid::s4u::Host* host_, ns3::Ptr<ns3::Node> ap_node_,
                    ns3::Ptr<ns3::YansWifiChannel> channel_, int mcs_, int nss_, int network_, int link_)
     : name(name_)
     , host(host_)
@@ -93,7 +93,7 @@ bool WifiZone::is_ap(ns3::Ptr<ns3::Node> node)
   return false;
 }
 
-WifiZone* WifiZone::by_name(std::string name)
+WifiZone* WifiZone::by_name(const std::string& name)
 {
   WifiZone* zone;
   try {
@@ -377,8 +377,8 @@ LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwid
 
     ns3::NetDeviceContainer netA;
     WifiZone* zone = WifiZone::by_name(name);
-    xbt_assert(zone != 0, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
-    NetPointNs3* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
+    xbt_assert(zone != nullptr, "Link name '%s' does not match the 'wifi_link' property of a host.", name.c_str());
+    auto* netpoint_ns3 = zone->get_host()->get_netpoint()->extension<NetPointNs3>();
 
     wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode",
                                  ns3::StringValue("HtMcs" + std::to_string(zone->get_mcs())));