Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace redundant type with "auto" (include/ and src/).
[simgrid.git] / src / kernel / routing / NetZoneImpl.cpp
index 81a6383..ed7e84b 100644 (file)
@@ -24,7 +24,7 @@ NetZoneImpl::NetZoneImpl(NetZoneImpl* father, const std::string& name, resource:
   xbt_assert(nullptr == s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name()),
              "Refusing to create a second NetZone called '%s'.", get_cname());
 
-  netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone, father);
+  netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone, father_);
   XBT_DEBUG("NetZone '%s' created with the id '%u'", get_cname(), netpoint_->id());
 }
 
@@ -44,7 +44,7 @@ NetZoneImpl::~NetZoneImpl()
  * Only the hosts that are directly contained in this NetZone are retrieved,
  * not the ones contained in sub-netzones.
  */
-std::vector<s4u::Host*> NetZoneImpl::get_all_hosts()
+std::vector<s4u::Host*> NetZoneImpl::get_all_hosts() const
 {
   std::vector<s4u::Host*> res;
   for (auto const& card : get_vertices()) {
@@ -54,7 +54,7 @@ std::vector<s4u::Host*> NetZoneImpl::get_all_hosts()
   }
   return res;
 }
-int NetZoneImpl::get_host_count()
+int NetZoneImpl::get_host_count() const
 {
   int count = 0;
   for (auto const& card : get_vertices()) {
@@ -68,7 +68,7 @@ int NetZoneImpl::get_host_count()
 s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate,
                                     int coreAmount, const std::map<std::string, std::string>* props)
 {
-  s4u::Host* res = new s4u::Host(name);
+  auto* res = new s4u::Host(name);
 
   if (hierarchy_ == RoutingMode::unset)
     hierarchy_ = RoutingMode::base;
@@ -118,7 +118,7 @@ void NetZoneImpl::add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_sr
   }
 
   /* Build a copy that will be stored in the dict */
-  BypassRoute* newRoute = new BypassRoute(gw_src, gw_dst);
+  auto* newRoute = new BypassRoute(gw_src, gw_dst);
   for (auto const& link : link_list)
     newRoute->links.push_back(link);
 
@@ -202,13 +202,13 @@ static void find_common_ancestors(NetPoint* src, NetPoint* dst,
   NetZoneImpl* current = src->get_englobing_zone();
   while (current != nullptr) {
     path_src.push_back(current);
-    current = static_cast<NetZoneImpl*>(current->get_father());
+    current = current->get_father();
   }
   std::vector<NetZoneImpl*> path_dst;
   current = dst->get_englobing_zone();
   while (current != nullptr) {
     path_dst.push_back(current);
-    current = static_cast<NetZoneImpl*>(current->get_father());
+    current = current->get_father();
   }
 
   /* (3) find the common father.
@@ -265,14 +265,14 @@ bool NetZoneImpl::get_bypass_route(NetPoint* src, NetPoint* dst,
   std::vector<NetZoneImpl*> path_src;
   NetZoneImpl* current = src->get_englobing_zone();
   while (current != nullptr) {
-    path_src.push_back(static_cast<NetZoneImpl*>(current));
+    path_src.push_back(current);
     current = current->father_;
   }
 
   std::vector<NetZoneImpl*> path_dst;
   current = dst->get_englobing_zone();
   while (current != nullptr) {
-    path_dst.push_back(static_cast<NetZoneImpl*>(current));
+    path_dst.push_back(current);
     current = current->father_;
   }