Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make helper functions static members of NetZoneImpl.
[simgrid.git] / src / kernel / routing / RoutedZone.cpp
index 7bbddf9..27fbd27 100644 (file)
@@ -1,57 +1,22 @@
-/* Copyright (c) 2009-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2022. 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. */
 
 #include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
-#include "src/surf/network_interface.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
 #include "xbt/dict.h"
 #include "xbt/graph.h"
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_routing_generic, ker_routing, "Kernel Generic Routing");
 
 /* ***************************************************************** */
 /* *********************** GENERIC METHODS ************************* */
 
-xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name,
-                              std::map<std::string, xbt_node_t, std::less<>>* nodes)
-{
-  auto elm = nodes->find(name);
-  if (elm == nodes->end()) {
-    xbt_node_t ret = xbt_graph_new_node(graph, xbt_strdup(name));
-    nodes->insert({name, ret});
-    return ret;
-  } else
-    return elm->second;
-}
-
-xbt_edge_t new_xbt_graph_edge(const s_xbt_graph_t* graph, xbt_node_t s, xbt_node_t d,
-                              std::map<std::string, xbt_edge_t, std::less<>>* edges)
-{
-  const auto* sn   = static_cast<const char*>(xbt_graph_node_get_data(s));
-  const auto* dn   = static_cast<const char*>(xbt_graph_node_get_data(d));
-  std::string name = std::string(sn) + dn;
-
-  auto elm = edges->find(name);
-  if (elm == edges->end()) {
-    name = std::string(dn) + sn;
-    elm  = edges->find(name);
-  }
-
-  if (elm == edges->end()) {
-    xbt_edge_t ret = xbt_graph_new_edge(graph, s, d, nullptr);
-    edges->insert({name, ret});
-    return ret;
-  } else
-    return elm->second;
-}
-
-namespace simgrid {
-namespace kernel {
-namespace routing {
+namespace simgrid::kernel::routing {
 
 RoutedZone::RoutedZone(const std::string& name) : NetZoneImpl(name) {}
 
@@ -111,7 +76,7 @@ void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt
 /* ************************* GENERIC AUX FUNCTIONS ************************** */
 /* change a route containing link names into a route containing link entities */
 Route* RoutedZone::new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
-                                      const std::vector<resource::LinkImpl*>& link_list, bool preserve_order)
+                                      const std::vector<resource::StandardLinkImpl*>& link_list, bool preserve_order)
 {
   auto* result = new Route();
 
@@ -165,7 +130,6 @@ void RoutedZone::add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint*
     xbt_assert(not dst->is_netzone(),
                "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have a NetzoneRoute?",
                dstName);
-    s4u::NetZone::on_route_creation(symmetrical, src, dst, gw_src, gw_dst, get_link_list_impl(link_list, false));
     NetZoneImpl::on_route_creation(symmetrical, src, dst, gw_src, gw_dst, get_link_list_impl(link_list, false));
   } else {
     XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, gw_src->get_cname(), dstName, gw_dst->get_cname());
@@ -196,10 +160,7 @@ void RoutedZone::add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint*
                "Invalid NetzoneRoute from %s@%s to %s@%s: gw_dst %s belongs to %s, not to %s.", srcName,
                gw_src->get_cname(), dstName, gw_dst->get_cname(), gw_dst->get_cname(),
                gw_dst->get_englobing_zone()->get_cname(), dst->get_cname());
-    s4u::NetZone::on_route_creation(symmetrical, gw_src, gw_dst, gw_src, gw_dst, get_link_list_impl(link_list, false));
     NetZoneImpl::on_route_creation(symmetrical, gw_src, gw_dst, gw_src, gw_dst, get_link_list_impl(link_list, false));
   }
 }
-} // namespace routing
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::routing