Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not use RouteCreationArgs outside of XML parsing
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 3 May 2021 10:49:56 +0000 (12:49 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 3 May 2021 10:49:56 +0000 (12:49 +0200)
26 files changed:
include/simgrid/kernel/routing/ClusterZone.hpp
include/simgrid/kernel/routing/DijkstraZone.hpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/kernel/routing/EmptyZone.hpp
include/simgrid/kernel/routing/FatTreeZone.hpp
include/simgrid/kernel/routing/FloydZone.hpp
include/simgrid/kernel/routing/FullZone.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
include/simgrid/kernel/routing/StarZone.hpp
include/simgrid/kernel/routing/TorusZone.hpp
include/simgrid/kernel/routing/VivaldiZone.hpp
include/simgrid/kernel/routing/WifiZone.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/StarZone.cpp
src/kernel/routing/StarZone_test.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/kernel/routing/WifiZone.cpp

index 2ce7210..5e4964e 100644 (file)
@@ -111,7 +111,7 @@ public:
     return private_links_.find(position) != private_links_.end();
   }
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
                  std::map<std::string, xbt_edge_t, std::less<>>* edges) override;
 
index 16a435f..ec3992f 100644 (file)
@@ -32,7 +32,7 @@ class XBT_PRIVATE DijkstraZone : public RoutedZone {
 
   xbt_node_t route_graph_new_node(int id);
   xbt_node_t node_map_search(int id);
-  void new_edge(int src_id, int dst_id, RouteCreationArgs* e_route);
+  void new_edge(int src_id, int dst_id, Route* e_route);
   void do_seal() override;
 
 public:
@@ -49,7 +49,7 @@ public:
    * After this function returns, any node in the graph
    * will have a loopback attached to it.
    */
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
 };
index 382c4d1..fa5fa22 100644 (file)
@@ -68,7 +68,7 @@ public:
   };
 
   explicit DragonflyZone(const std::string& name);
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   /**
    * @brief Parse topology parameters from string format
    *
index 7f54013..4b9114c 100644 (file)
@@ -23,7 +23,7 @@ class XBT_PRIVATE EmptyZone : public NetZoneImpl {
 public:
   explicit EmptyZone(const std::string& name) : NetZoneImpl(name) {}
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override
   {
     /* There can't be route in an Empty zone */
   }
index dee249c..911f92a 100644 (file)
@@ -135,7 +135,7 @@ public:
   FatTreeZone(const FatTreeZone&) = delete;
   FatTreeZone& operator=(const FatTreeZone&) = delete;
   ~FatTreeZone() override;
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
 
   /**
    * @brief Parse the topology parameters from string format
index 17ade54..f35bc19 100644 (file)
@@ -25,7 +25,7 @@ class XBT_PRIVATE FloydZone : public RoutedZone {
   /* vars to compute the Floyd algorithm. */
   std::vector<int> predecessor_table_;
   std::vector<double> cost_table_;
-  std::vector<RouteCreationArgs*> link_table_;
+  std::vector<Route*> link_table_;
 
   void init_tables(unsigned int table_size);
   void do_seal() override;
@@ -36,7 +36,7 @@ public:
   FloydZone& operator=(const FloydZone&) = delete;
   ~FloydZone() override;
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
 };
index 13565c4..4551451 100644 (file)
@@ -19,19 +19,18 @@ namespace routing {
  *  computational requirements, but also the highest memory requirements (both in platform file and in memory).
  */
 class XBT_PRIVATE FullZone : public RoutedZone {
+  std::vector<Route*> routing_table_;
+  void do_seal() override;
+
 public:
   using RoutedZone::RoutedZone;
   FullZone(const FullZone&) = delete;
   FullZone& operator=(const FullZone) = delete;
   ~FullZone() override;
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                  const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
-
-private:
-  std::vector<RouteCreationArgs*> routing_table_;
-  void do_seal() override;
 };
 } // namespace routing
 } // namespace kernel
index f164487..94b474c 100644 (file)
@@ -19,6 +19,20 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
+class Route {
+public:
+  Route() = default;
+  explicit Route(NetPoint* src, NetPoint* dst, NetPoint* gwSrc, NetPoint* gwDst)
+      : src_(src), dst_(dst), gw_src_(gwSrc), gw_dst_(gwDst)
+  {
+  }
+  NetPoint* src_    = nullptr;
+  NetPoint* dst_    = nullptr;
+  NetPoint* gw_src_ = nullptr;
+  NetPoint* gw_dst_ = nullptr;
+  std::vector<resource::LinkImpl*> link_list_;
+};
+
 class BypassRoute {
 public:
   explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
@@ -85,7 +99,7 @@ protected:
    * @param into Container into which the traversed links and gateway information should be pushed
    * @param latency Accumulator in which the latencies should be added (caller must set it to 0)
    */
-  virtual void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) = 0;
+  virtual void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) = 0;
   /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
   /* returns whether we found a bypass path */
   bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
index 6e061e2..3fcbd94 100644 (file)
@@ -15,7 +15,7 @@ namespace routing {
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing (abstract class)
  *
- * This abstract class factorizes code between its subclasses: Full, Dijkstra and Floyd.
+ * This abstract class factors code between its subclasses: Full, Dijkstra and Floyd.
  *
  * <table>
  * <caption>Comparison of the RoutedZone subclasses</caption>
@@ -56,9 +56,9 @@ public:
                  std::map<std::string, xbt_edge_t, std::less<>>* edges) override;
 
 protected:
-  RouteCreationArgs* new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
-                                        const std::vector<resource::LinkImpl*>& link_list, bool preserve_order);
-  XBT_ATTRIB_DEPRECATED_v330("Please drop 2nd, 3rd and 7th parameters") virtual RouteCreationArgs* new_extended_route(
+  Route* new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
+                            const std::vector<resource::LinkImpl*>& link_list, bool preserve_order);
+  XBT_ATTRIB_DEPRECATED_v330("Please drop 2nd, 3rd and 7th parameters") virtual Route* new_extended_route(
       RoutingMode hierarchy, NetPoint* /* src */, NetPoint* /* dst */, NetPoint* gw_src, NetPoint* gw_dst,
       std::vector<resource::LinkImpl*>& link_list, bool /* symmetrical */, bool preserve_order)
   {
index 6ecabca..b441706 100644 (file)
@@ -65,7 +65,7 @@ class StarZone : public NetZoneImpl {
 public:
   explicit StarZone(const std::string& name);
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency) override;
   void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
                  std::map<std::string, xbt_edge_t, std::less<>>* edges) override;
 
@@ -87,7 +87,7 @@ private:
     bool has_links_down() const { return links_down_set; }
   };
   /** @brief Auxiliary method to add links to a route */
-  void add_links_to_route(const std::vector<resource::LinkImpl*>& links, RouteCreationArgs* route, double* latency,
+  void add_links_to_route(const std::vector<resource::LinkImpl*>& links, Route* route, double* latency,
                           std::unordered_set<resource::LinkImpl*>& added_links) const;
   /** @brief Auxiliary methods to check params received in add_route method */
   void check_add_route_param(const NetPoint* src, const NetPoint* dst, const NetPoint* gw_src, const NetPoint* gw_dst,
index ae6e6d9..983a6bb 100644 (file)
@@ -25,7 +25,7 @@ class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
   using ClusterZone::ClusterZone;
   void create_links(int id, int rank, unsigned int position);
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   void set_topology(const std::vector<unsigned int>& dimensions);
 
   /** @brief Convert topology parameters from string to vector of uint */
index cd0fc40..ffc6f2e 100644 (file)
@@ -48,7 +48,7 @@ class XBT_PRIVATE VivaldiZone : public StarZone {
 public:
   using StarZone::StarZone;
   void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out);
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
 };
 
 namespace vivaldi {
index 1c45b4f..2eb9f76 100644 (file)
@@ -29,7 +29,7 @@ public:
   WifiZone(const WifiZone&) = delete;
   WifiZone& operator=(const WifiZone) = delete;
 
-  void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+  void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
   s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
   NetPoint* get_access_point() const { return access_point_; }
 };
index eb2fcce..43651e2 100644 (file)
@@ -7,7 +7,6 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp" // FIXME: RouteCreationArgs and friends
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
 
@@ -47,7 +46,7 @@ void ClusterZone::add_private_link_at(unsigned int position, std::pair<resource:
   private_links_.insert({position, link});
 }
 
-void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
 {
   XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
   xbt_assert(not private_links_.empty(),
@@ -58,7 +57,7 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
       XBT_WARN("Routing from a cluster private router to itself is meaningless");
     } else {
       std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
-      route->link_list.push_back(info.first);
+      route->link_list_.push_back(info.first);
       if (lat)
         *lat += info.first->get_latency();
     }
@@ -68,20 +67,20 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
   if (not src->is_router()) { // No private link for the private router
     if (has_limiter_) {       // limiter for sender
       std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos_with_loopback(src->id()));
-      route->link_list.push_back(info.first);
+      route->link_list_.push_back(info.first);
     }
 
     std::pair<resource::LinkImpl*, resource::LinkImpl*> info =
         private_links_.at(node_pos_with_loopback_limiter(src->id()));
     if (info.first) { // link up
-      route->link_list.push_back(info.first);
+      route->link_list_.push_back(info.first);
       if (lat)
         *lat += info.first->get_latency();
     }
   }
 
   if (backbone_) {
-    route->link_list.push_back(backbone_);
+    route->link_list_.push_back(backbone_);
     if (lat)
       *lat += backbone_->get_latency();
   }
@@ -91,13 +90,13 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
         private_links_.at(node_pos_with_loopback_limiter(dst->id()));
 
     if (info.second) { // link down
-      route->link_list.push_back(info.second);
+      route->link_list_.push_back(info.second);
       if (lat)
         *lat += info.second->get_latency();
     }
     if (has_limiter_) { // limiter for receiver
       info = private_links_.at(node_pos_with_loopback(dst->id()));
-      route->link_list.push_back(info.first);
+      route->link_list_.push_back(info.first);
     }
   }
 }
index 6270976..30c7515 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/DijkstraZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 #include "xbt/string.hpp"
 
@@ -30,8 +29,8 @@ public:
 void DijkstraZone::route_graph_delete(xbt_graph_t g)
 {
   xbt_graph_free_graph(
-      g, [](void* n) { delete static_cast<simgrid::kernel::routing::GraphNodeData*>(n); },
-      [](void* e) { delete static_cast<simgrid::kernel::routing::RouteCreationArgs*>(e); }, nullptr);
+      g, [](void* n) { delete static_cast<GraphNodeData*>(n); }, [](void* e) { delete static_cast<Route*>(e); },
+      nullptr);
 }
 
 void DijkstraZone::do_seal()
@@ -53,8 +52,8 @@ void DijkstraZone::do_seal()
       }
 
       if (not found) {
-        auto* route = new simgrid::kernel::routing::RouteCreationArgs();
-        route->link_list.push_back(get_network_model()->loopback_);
+        auto* route = new Route();
+        route->link_list_.push_back(get_network_model()->loopback_);
         xbt_graph_new_edge(route_graph_.get(), node, node, route);
       }
     }
@@ -85,7 +84,7 @@ xbt_node_t DijkstraZone::node_map_search(int id)
 
 /* Parsing */
 
-void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
 {
   get_route_check_params(src, dst);
   int src_id = src->id();
@@ -109,10 +108,10 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
     if (edge == nullptr)
       throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
 
-    const RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
+    const Route* e_route = static_cast<Route*>(xbt_graph_edge_get_data(edge));
 
-    for (auto const& link : e_route->link_list) {
-      route->link_list.insert(route->link_list.begin(), link);
+    for (auto const& link : e_route->link_list_) {
+      route->link_list_.insert(route->link_list_.begin(), link);
       if (lat)
         *lat += link->get_latency();
     }
@@ -154,8 +153,8 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
         const s_xbt_node_t* u_node           = xbt_graph_edge_get_target(edge);
         const GraphNodeData* data            = static_cast<GraphNodeData*>(xbt_graph_node_get_data(u_node));
         int u_id                             = data->graph_id_;
-        const RouteCreationArgs* tmp_e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
-        int cost_v_u                         = tmp_e_route->link_list.size(); /* count of links, old model assume 1 */
+        const Route* tmp_e_route             = static_cast<Route*>(xbt_graph_edge_get_data(edge));
+        int cost_v_u                         = tmp_e_route->link_list_.size(); /* count of links, old model assume 1 */
 
         if (cost_v_u + cost_arr[v_id] < cost_arr[u_id]) {
           pred_arr[u_id] = v_id;
@@ -178,11 +177,11 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
     if (edge == nullptr)
       throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
 
-    const RouteCreationArgs* e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
+    const Route* e_route = static_cast<Route*>(xbt_graph_edge_get_data(edge));
 
     const NetPoint* prev_gw_src = gw_src;
-    gw_src                      = e_route->gw_src;
-    NetPoint* gw_dst            = e_route->gw_dst;
+    gw_src                      = e_route->gw_src_;
+    NetPoint* gw_dst            = e_route->gw_dst_;
 
     if (v == dst_node_id)
       first_gw = gw_dst;
@@ -194,25 +193,25 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
       NetPoint* gw_dst_net_elm      = nullptr;
       NetPoint* prev_gw_src_net_elm = nullptr;
       get_global_route(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, nullptr);
-      auto pos = route->link_list.begin();
+      auto pos = route->link_list_.begin();
       for (auto const& link : e_route_as_to_as) {
-        route->link_list.insert(pos, link);
+        route->link_list_.insert(pos, link);
         if (lat)
           *lat += link->get_latency();
         pos++;
       }
     }
 
-    for (auto const& link : e_route->link_list) {
-      route->link_list.insert(route->link_list.begin(), link);
+    for (auto const& link : e_route->link_list_) {
+      route->link_list_.insert(route->link_list_.begin(), link);
       if (lat)
         *lat += link->get_latency();
     }
   }
 
   if (get_hierarchy() == RoutingMode::recursive) {
-    route->gw_src = gw_src;
-    route->gw_dst = first_gw;
+    route->gw_src_ = gw_src;
+    route->gw_dst_ = first_gw;
   }
 
   if (not cached_)
@@ -220,17 +219,17 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
 }
 
 void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                             const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                             const std::vector<resource::LinkImpl*>& link_list_, bool symmetrical)
 {
-  add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
+  add_route_check_params(src, dst, gw_src, gw_dst, link_list_, symmetrical);
 
-  new_edge(src->id(), dst->id(), new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list, true));
+  new_edge(src->id(), dst->id(), new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list_, true));
 
   if (symmetrical)
-    new_edge(dst->id(), src->id(), new_extended_route(get_hierarchy(), gw_dst, gw_src, link_list, false));
+    new_edge(dst->id(), src->id(), new_extended_route(get_hierarchy(), gw_dst, gw_src, link_list_, false));
 }
 
-void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route)
+void DijkstraZone::new_edge(int src_id, int dst_id, Route* route)
 {
   XBT_DEBUG("Create Route from '%d' to '%d'", src_id, dst_id);
 
@@ -245,13 +244,13 @@ void DijkstraZone::new_edge(int src_id, int dst_id, RouteCreationArgs* route)
 
   // Make sure that this graph edge was not already added to the graph
   if (xbt_graph_get_edge(route_graph_.get(), src, dst) != nullptr) {
-    if (route->gw_dst == nullptr || route->gw_src == nullptr)
+    if (route->gw_dst_ == nullptr || route->gw_src_ == nullptr)
       throw std::invalid_argument(
-          xbt::string_printf("Route from %s to %s already exists", route->src->get_cname(), route->dst->get_cname()));
+          xbt::string_printf("Route from %s to %s already exists", route->src_->get_cname(), route->dst_->get_cname()));
     else
       throw std::invalid_argument(xbt::string_printf("Route from %s@%s to %s@%s already exists",
-                                                     route->src->get_cname(), route->gw_src->get_cname(),
-                                                     route->dst->get_cname(), route->gw_dst->get_cname()));
+                                                     route->src_->get_cname(), route->gw_src_->get_cname(),
+                                                     route->dst_->get_cname(), route->gw_dst_->get_cname()));
   }
 
   // Finally add it
index bfaa43b..bc7a8c1 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/DragonflyZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
@@ -73,13 +72,12 @@ s4u::DragonflyParams DragonflyZone::parse_topo_parameters(const std::string& top
   boost::split(parameters, topo_parameters, boost::is_any_of(";"));
 
   if (parameters.size() != 4)
-    surf_parse_error(
-        "Dragonfly are defined by the number of groups, chassis per groups, blades per chassis, nodes per blade");
+    xbt_die("Dragonfly are defined by the number of groups, chassis per groups, blades per chassis, nodes per blade");
 
   // Blue network : number of groups, number of links between each group
   boost::split(tmp, parameters[0], boost::is_any_of(","));
   if (tmp.size() != 2)
-    surf_parse_error("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
+    xbt_die("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
 
   unsigned int n_groups;
   try {
@@ -98,7 +96,7 @@ s4u::DragonflyParams DragonflyZone::parse_topo_parameters(const std::string& top
   // Black network : number of chassis/group, number of links between each router on the black network
   boost::split(tmp, parameters[1], boost::is_any_of(","));
   if (tmp.size() != 2)
-    surf_parse_error("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
+    xbt_die("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
 
   unsigned int n_chassis;
   try {
@@ -117,7 +115,7 @@ s4u::DragonflyParams DragonflyZone::parse_topo_parameters(const std::string& top
   // Green network : number of blades/chassis, number of links between each router on the green network
   boost::split(tmp, parameters[2], boost::is_any_of(","));
   if (tmp.size() != 2)
-    surf_parse_error("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
+    xbt_die("Dragonfly topologies are defined by 3 levels with 2 elements each, and one with one element");
 
   unsigned int n_routers;
   try {
@@ -267,7 +265,7 @@ void DragonflyZone::generate_links()
   }
 }
 
-void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
+void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency)
 {
   // Minimal routing version.
   // TODO : non-minimal random one, and adaptive ?
@@ -281,7 +279,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   if ((src->id() == dst->id()) && has_loopback()) {
     resource::LinkImpl* uplink = get_uplink_from(node_pos(src->id()));
 
-    route->link_list.push_back(uplink);
+    route->link_list_.push_back(uplink);
     if (latency)
       *latency += uplink->get_latency();
     return;
@@ -301,12 +299,12 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   DragonflyRouter* currentRouter = myRouter;
 
   // node->router local link
-  route->link_list.push_back(myRouter->my_nodes_[myCoords.node * num_links_per_link_]);
+  route->link_list_.push_back(myRouter->my_nodes_[myCoords.node * num_links_per_link_]);
   if (latency)
     *latency += myRouter->my_nodes_[myCoords.node * num_links_per_link_]->get_latency();
 
   if (has_limiter()) { // limiter for sender
-    route->link_list.push_back(get_uplink_from(node_pos_with_loopback(src->id())));
+    route->link_list_.push_back(get_uplink_from(node_pos_with_loopback(src->id())));
   }
 
   if (targetRouter != myRouter) {
@@ -315,7 +313,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
       // go to the router of our group connected to this one.
       if (currentRouter->blade_ != targetCoords.group) {
         // go to the nth router in our chassis
-        route->link_list.push_back(currentRouter->green_links_[targetCoords.group]);
+        route->link_list_.push_back(currentRouter->green_links_[targetCoords.group]);
         if (latency)
           *latency += currentRouter->green_links_[targetCoords.group]->get_latency();
         currentRouter = &routers_[myCoords.group * (num_chassis_per_group_ * num_blades_per_chassis_) +
@@ -324,7 +322,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
 
       if (currentRouter->chassis_ != 0) {
         // go to the first chassis of our group
-        route->link_list.push_back(currentRouter->black_links_[0]);
+        route->link_list_.push_back(currentRouter->black_links_[0]);
         if (latency)
           *latency += currentRouter->black_links_[0]->get_latency();
         currentRouter =
@@ -332,7 +330,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
       }
 
       // go to destination group - the only optical hop
-      route->link_list.push_back(currentRouter->blue_link_);
+      route->link_list_.push_back(currentRouter->blue_link_);
       if (latency)
         *latency += currentRouter->blue_link_->get_latency();
       currentRouter =
@@ -341,7 +339,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
 
     // same group, but same blade ?
     if (targetRouter->blade_ != currentRouter->blade_) {
-      route->link_list.push_back(currentRouter->green_links_[targetCoords.blade]);
+      route->link_list_.push_back(currentRouter->green_links_[targetCoords.blade]);
       if (latency)
         *latency += currentRouter->green_links_[targetCoords.blade]->get_latency();
       currentRouter =
@@ -350,26 +348,26 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
 
     // same blade, but same chassis ?
     if (targetRouter->chassis_ != currentRouter->chassis_) {
-      route->link_list.push_back(currentRouter->black_links_[targetCoords.chassis]);
+      route->link_list_.push_back(currentRouter->black_links_[targetCoords.chassis]);
       if (latency)
         *latency += currentRouter->black_links_[targetCoords.chassis]->get_latency();
     }
   }
 
   if (has_limiter()) { // limiter for receiver
-    route->link_list.push_back(get_downlink_to(node_pos_with_loopback(dst->id())));
+    route->link_list_.push_back(get_downlink_to(node_pos_with_loopback(dst->id())));
   }
 
   // router->node local link
-  route->link_list.push_back(
+  route->link_list_.push_back(
       targetRouter->my_nodes_[targetCoords.node * num_links_per_link_ + num_links_per_link_ - 1]);
   if (latency)
     *latency +=
         targetRouter->my_nodes_[targetCoords.node * num_links_per_link_ + num_links_per_link_ - 1]->get_latency();
 
   // set gateways (if any)
-  route->gw_src = get_gateway(src->id());
-  route->gw_dst = get_gateway(dst->id());
+  route->gw_src_ = get_gateway(src->id());
+  route->gw_dst_ = get_gateway(dst->id());
 }
 } // namespace routing
 } // namespace kernel
index bac4382..b7df0d1 100644 (file)
@@ -51,7 +51,7 @@ bool FatTreeZone::is_in_sub_tree(FatTreeNode* root, FatTreeNode* node) const
   return true;
 }
 
-void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency)
+void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency)
 {
   if (dst->is_router() || src->is_router())
     return;
@@ -72,7 +72,7 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
 
   /* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
   if (source->id == destination->id && has_loopback()) {
-    into->link_list.push_back(source->loopback_);
+    into->link_list_.push_back(source->loopback_);
     if (latency)
       *latency += source->loopback_->get_latency();
     return;
@@ -89,13 +89,13 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
 
     int k = this->num_parents_per_node_[currentNode->level];
     d     = d % k;
-    into->link_list.push_back(currentNode->parents[d]->up_link_);
+    into->link_list_.push_back(currentNode->parents[d]->up_link_);
 
     if (latency)
       *latency += currentNode->parents[d]->up_link_->get_latency();
 
     if (currentNode->limiter_link_)
-      into->link_list.push_back(currentNode->limiter_link_);
+      into->link_list_.push_back(currentNode->limiter_link_);
     currentNode = currentNode->parents[d]->up_node_;
   }
 
@@ -106,20 +106,20 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
   while (currentNode != destination) {
     for (unsigned int i = 0; i < currentNode->children.size(); i++) {
       if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
-        into->link_list.push_back(currentNode->children[i]->down_link_);
+        into->link_list_.push_back(currentNode->children[i]->down_link_);
         if (latency)
           *latency += currentNode->children[i]->down_link_->get_latency();
         currentNode = currentNode->children[i]->down_node_;
         if (currentNode->limiter_link_)
-          into->link_list.push_back(currentNode->limiter_link_);
+          into->link_list_.push_back(currentNode->limiter_link_);
         XBT_DEBUG("%d(%u,%u) is accessible through %d(%u,%u)", destination->id, destination->level,
                   destination->position, currentNode->id, currentNode->level, currentNode->position);
       }
     }
   }
   // set gateways (if any)
-  into->gw_src = get_gateway(src->id());
-  into->gw_dst = get_gateway(dst->id());
+  into->gw_src_ = get_gateway(src->id());
+  into->gw_dst_ = get_gateway(dst->id());
 }
 
 /* This function makes the assumption that parse_specific_arguments() and
index 5e109f3..593810d 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/FloydZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 #include "xbt/string.hpp"
 
@@ -40,14 +39,14 @@ void FloydZone::init_tables(unsigned int table_size)
   }
 }
 
-void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
 {
   unsigned int table_size = get_table_size();
 
   get_route_check_params(src, dst);
 
   /* create a result route */
-  std::vector<RouteCreationArgs*> route_stack;
+  std::vector<Route*> route_stack;
   unsigned int cur = dst->id();
   do {
     int pred = TO_FLOYD_PRED(src->id(), cur);
@@ -58,37 +57,37 @@ void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   } while (cur != src->id());
 
   if (get_hierarchy() == RoutingMode::recursive) {
-    route->gw_src = route_stack.back()->gw_src;
-    route->gw_dst = route_stack.front()->gw_dst;
+    route->gw_src_ = route_stack.back()->gw_src_;
+    route->gw_dst_ = route_stack.front()->gw_dst_;
   }
 
   NetPoint* prev_dst_gw = nullptr;
   while (not route_stack.empty()) {
-    const RouteCreationArgs* e_route = route_stack.back();
+    const Route* e_route = route_stack.back();
     route_stack.pop_back();
     if (get_hierarchy() == RoutingMode::recursive && prev_dst_gw != nullptr &&
-        prev_dst_gw->get_cname() != e_route->gw_src->get_cname()) {
-      get_global_route(prev_dst_gw, e_route->gw_src, route->link_list, lat);
+        prev_dst_gw->get_cname() != e_route->gw_src_->get_cname()) {
+      get_global_route(prev_dst_gw, e_route->gw_src_, route->link_list_, lat);
     }
 
-    for (auto const& link : e_route->link_list) {
-      route->link_list.push_back(link);
+    for (auto const& link : e_route->link_list_) {
+      route->link_list_.push_back(link);
       if (lat)
         *lat += link->get_latency();
     }
 
-    prev_dst_gw = e_route->gw_dst;
+    prev_dst_gw = e_route->gw_dst_;
   }
 }
 
 void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                          const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                          const std::vector<resource::LinkImpl*>& link_list_, bool symmetrical)
 {
   /* set the size of table routing */
   unsigned int table_size = get_table_size();
   init_tables(table_size);
 
-  add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
+  add_route_check_params(src, dst, gw_src, gw_dst, link_list_, symmetrical);
 
   /* Check that the route does not already exist */
   if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
@@ -100,9 +99,9 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
                "The route between %s and %s already exists (Rq: routes are symmetrical by default).", src->get_cname(),
                dst->get_cname());
 
-  TO_FLOYD_LINK(src->id(), dst->id()) = new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list, true);
+  TO_FLOYD_LINK(src->id(), dst->id()) = new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list_, true);
   TO_FLOYD_PRED(src->id(), dst->id()) = src->id();
-  TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
+  TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list_.size();
 
   if (symmetrical) {
     if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
@@ -127,10 +126,10 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
       XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", dst->get_cname(), gw_src->get_cname(),
                 src->get_cname(), gw_dst->get_cname());
 
-    TO_FLOYD_LINK(dst->id(), src->id()) = new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list, false);
+    TO_FLOYD_LINK(dst->id(), src->id()) = new_extended_route(get_hierarchy(), gw_src, gw_dst, link_list_, false);
     TO_FLOYD_PRED(dst->id(), src->id()) = dst->id();
     TO_FLOYD_COST(dst->id(), src->id()) =
-        (TO_FLOYD_LINK(dst->id(), src->id()))->link_list.size(); /* count of links, old model assume 1 */
+        (TO_FLOYD_LINK(dst->id(), src->id()))->link_list_.size(); /* count of links, old model assume 1 */
   }
 }
 
@@ -143,10 +142,10 @@ void FloydZone::do_seal()
   /* Add the loopback if needed */
   if (get_network_model()->loopback_ && get_hierarchy() == RoutingMode::base) {
     for (unsigned int i = 0; i < table_size; i++) {
-      RouteCreationArgs* route = TO_FLOYD_LINK(i, i);
+      Route* route = TO_FLOYD_LINK(i, i);
       if (not route) {
-        route = new RouteCreationArgs();
-        route->link_list.push_back(get_network_model()->loopback_);
+        route = new Route();
+        route->link_list_.push_back(get_network_model()->loopback_);
         TO_FLOYD_LINK(i, i) = route;
         TO_FLOYD_PRED(i, i) = i;
         TO_FLOYD_COST(i, i) = 1;
index ab756c1..3570508 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/FullZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
@@ -28,10 +27,10 @@ void FullZone::do_seal()
   /* Add the loopback if needed */
   if (get_network_model()->loopback_ && get_hierarchy() == RoutingMode::base) {
     for (unsigned int i = 0; i < table_size; i++) {
-      RouteCreationArgs* route = TO_ROUTE_FULL(i, i);
+      Route* route = TO_ROUTE_FULL(i, i);
       if (not route) {
-        route = new RouteCreationArgs();
-        route->link_list.push_back(get_network_model()->loopback_);
+        route = new Route();
+        route->link_list_.push_back(get_network_model()->loopback_);
         TO_ROUTE_FULL(i, i) = route;
       }
     }
@@ -45,18 +44,18 @@ FullZone::~FullZone()
     delete route;
 }
 
-void FullZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat)
+void FullZone::get_local_route(NetPoint* src, NetPoint* dst, Route* res, double* lat)
 {
   XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
 
   unsigned int table_size          = get_table_size();
-  const RouteCreationArgs* e_route = TO_ROUTE_FULL(src->id(), dst->id());
+  const Route* e_route             = TO_ROUTE_FULL(src->id(), dst->id());
 
   if (e_route != nullptr) {
-    res->gw_src = e_route->gw_src;
-    res->gw_dst = e_route->gw_dst;
-    for (auto const& link : e_route->link_list) {
-      res->link_list.push_back(link);
+    res->gw_src_ = e_route->gw_src_;
+    res->gw_dst_ = e_route->gw_dst_;
+    for (auto const& link : e_route->link_list_) {
+      res->link_list_.push_back(link);
       if (lat)
         *lat += link->get_latency();
     }
index ca5ae92..b9efafc 100644 (file)
@@ -13,7 +13,6 @@
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
@@ -176,26 +175,26 @@ int NetZoneImpl::add_component(NetPoint* elm)
 }
 
 void NetZoneImpl::add_route(NetPoint* /*src*/, NetPoint* /*dst*/, NetPoint* /*gw_src*/, NetPoint* /*gw_dst*/,
-                            const std::vector<resource::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
+                            const std::vector<resource::LinkImpl*>& /*link_list_*/, bool /*symmetrical*/)
 {
   xbt_die("NetZone '%s' does not accept new routes (wrong class).", get_cname());
 }
 
 void NetZoneImpl::add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                                   std::vector<resource::LinkImpl*>& link_list, bool /* symmetrical */)
+                                   std::vector<resource::LinkImpl*>& link_list_, bool /* symmetrical */)
 {
   /* Argument validity checks */
   if (gw_dst) {
     XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", src->get_cname(), gw_src->get_cname(), dst->get_cname(),
               gw_dst->get_cname());
-    xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->get_cname(),
+    xbt_assert(not link_list_.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->get_cname(),
                gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname());
     xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(),
                "The bypass route between %s@%s and %s@%s already exists.", src->get_cname(), gw_src->get_cname(),
                dst->get_cname(), gw_dst->get_cname());
   } else {
     XBT_DEBUG("Load bypassRoute from %s to %s", src->get_cname(), dst->get_cname());
-    xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->get_cname(),
+    xbt_assert(not link_list_.empty(), "Bypass route between %s and %s cannot be empty.", src->get_cname(),
                dst->get_cname());
     xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(),
                "The bypass route between %s and %s already exists.", src->get_cname(), dst->get_cname());
@@ -203,7 +202,7 @@ void NetZoneImpl::add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_sr
 
   /* Build a copy that will be stored in the dict */
   auto* newRoute = new BypassRoute(gw_src, gw_dst);
-  for (auto const& link : link_list)
+  for (auto const& link : link_list_)
     newRoute->links.push_back(link);
 
   /* Store it */
@@ -415,7 +414,7 @@ bool NetZoneImpl::get_bypass_route(NetPoint* src, NetPoint* dst,
 void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst,
                                    /* OUT */ std::vector<resource::LinkImpl*>& links, double* latency)
 {
-  RouteCreationArgs route;
+  Route route;
 
   XBT_DEBUG("Resolve route from '%s' to '%s'", src->get_cname(), dst->get_cname());
 
@@ -433,26 +432,26 @@ void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst,
 
   /* If src and dst are in the same netzone, life is good */
   if (src_ancestor == dst_ancestor) { /* SURF_ROUTING_BASE */
-    route.link_list = std::move(links);
+    route.link_list_ = std::move(links);
     common_ancestor->get_local_route(src, dst, &route, latency);
-    links = std::move(route.link_list);
+    links = std::move(route.link_list_);
     return;
   }
 
   /* Not in the same netzone, no bypass. We'll have to find our path between the netzones recursively */
 
   common_ancestor->get_local_route(src_ancestor->netpoint_, dst_ancestor->netpoint_, &route, latency);
-  xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr), "Bad gateways for route from '%s' to '%s'.",
+  xbt_assert((route.gw_src_ != nullptr) && (route.gw_dst_ != nullptr), "Bad gateways for route from '%s' to '%s'.",
              src->get_cname(), dst->get_cname());
 
   /* If source gateway is not our source, we have to recursively find our way up to this point */
-  if (src != route.gw_src)
-    get_global_route(src, route.gw_src, links, latency);
-  links.insert(links.end(), begin(route.link_list), end(route.link_list));
+  if (src != route.gw_src_)
+    get_global_route(src, route.gw_src_, links, latency);
+  links.insert(links.end(), begin(route.link_list_), end(route.link_list_));
 
   /* If dest gateway is not our destination, we have to recursively find our way from this point */
-  if (route.gw_dst != dst)
-    get_global_route(route.gw_dst, dst, links, latency);
+  if (route.gw_dst_ != dst)
+    get_global_route(route.gw_dst_, dst, links, latency);
 }
 
 void NetZoneImpl::seal()
index 4a07c1a..8be4dfe 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "xbt/dict.h"
 #include "xbt/graph.h"
 #include "xbt/log.h"
@@ -66,7 +65,7 @@ void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt
       if (my_src == my_dst)
         continue;
 
-      RouteCreationArgs route;
+      Route route;
 
       get_local_route(my_src, my_dst, &route, nullptr);
 
@@ -77,15 +76,15 @@ void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt
       const char* previous_name;
       const char* current_name;
 
-      if (route.gw_src) {
-        previous      = new_xbt_graph_node(graph, route.gw_src->get_cname(), nodes);
-        previous_name = route.gw_src->get_cname();
+      if (route.gw_src_) {
+        previous      = new_xbt_graph_node(graph, route.gw_src_->get_cname(), nodes);
+        previous_name = route.gw_src_->get_cname();
       } else {
         previous      = new_xbt_graph_node(graph, my_src->get_cname(), nodes);
         previous_name = my_src->get_cname();
       }
 
-      for (auto const& link : route.link_list) {
+      for (auto const& link : route.link_list_) {
         const char* link_name = link->get_cname();
         current               = new_xbt_graph_node(graph, link_name, nodes);
         current_name          = link_name;
@@ -95,9 +94,9 @@ void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt
         previous_name = current_name;
       }
 
-      if (route.gw_dst) {
-        current      = new_xbt_graph_node(graph, route.gw_dst->get_cname(), nodes);
-        current_name = route.gw_dst->get_cname();
+      if (route.gw_dst_) {
+        current      = new_xbt_graph_node(graph, route.gw_dst_->get_cname(), nodes);
+        current_name = route.gw_dst_->get_cname();
       } else {
         current      = new_xbt_graph_node(graph, my_dst->get_cname(), nodes);
         current_name = my_dst->get_cname();
@@ -111,24 +110,23 @@ 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 */
-RouteCreationArgs* RoutedZone::new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
-                                                  const std::vector<resource::LinkImpl*>& link_list,
-                                                  bool preserve_order)
+Route* RoutedZone::new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
+                                      const std::vector<resource::LinkImpl*>& link_list, bool preserve_order)
 {
-  auto* result = new RouteCreationArgs();
+  auto* result = new Route();
 
   if (hierarchy == RoutingMode::recursive) {
     xbt_assert(gw_src && gw_dst, "nullptr is obviously a deficient gateway");
 
-    result->gw_src = gw_src;
-    result->gw_dst = gw_dst;
+    result->gw_src_ = gw_src;
+    result->gw_dst_ = gw_dst;
   }
 
   if (preserve_order)
-    result->link_list = link_list;
+    result->link_list_ = link_list;
   else
-    result->link_list.assign(link_list.rbegin(), link_list.rend()); // reversed
-  result->link_list.shrink_to_fit();
+    result->link_list_.assign(link_list.rbegin(), link_list.rend()); // reversed
+  result->link_list_.shrink_to_fit();
 
   return result;
 }
index 72fb1e4..ac88fd2 100644 (file)
@@ -7,7 +7,6 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp" // RouteCreationArgs and friends
 #include "xbt/string.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_star, surf, "Routing part of surf");
@@ -17,20 +16,20 @@ namespace kernel {
 namespace routing {
 StarZone::StarZone(const std::string& name) : NetZoneImpl(name) {}
 
-void StarZone::add_links_to_route(const std::vector<resource::LinkImpl*>& links, RouteCreationArgs* route,
-                                  double* latency, std::unordered_set<resource::LinkImpl*>& added_links) const
+void StarZone::add_links_to_route(const std::vector<resource::LinkImpl*>& links, Route* route, double* latency,
+                                  std::unordered_set<resource::LinkImpl*>& added_links) const
 {
   for (auto* link : links) {
-    /* do not add duplicated links in route->link_list */
+    /* do not add duplicated links in route->link_list_ */
     if (not added_links.insert(link).second)
       continue;
     if (latency)
       *latency += link->get_latency();
-    route->link_list.push_back(link);
+    route->link_list_.push_back(link);
   }
 }
 
-void StarZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* latency)
+void StarZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency)
 {
   XBT_VERB("StarZone getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(),
            dst->id());
@@ -57,8 +56,8 @@ void StarZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   /* going DOWN */
   add_links_to_route(dst_route.links_down, route, latency, added_links);
   /* gateways */
-  route->gw_src = src_route.gateway;
-  route->gw_dst = dst_route.gateway;
+  route->gw_src_ = src_route.gateway;
+  route->gw_dst_ = dst_route.gateway;
 }
 
 void StarZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
@@ -126,32 +125,32 @@ void StarZone::check_add_route_param(const NetPoint* src, const NetPoint* dst, c
 }
 
 void StarZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                         const std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
+                         const std::vector<kernel::resource::LinkImpl*>& link_list_, bool symmetrical)
 {
   check_add_route_param(src, dst, gw_src, gw_dst, symmetrical);
 
-  s4u::NetZone::on_route_creation(symmetrical, gw_src, gw_dst, gw_src, gw_dst, link_list);
+  s4u::NetZone::on_route_creation(symmetrical, gw_src, gw_dst, gw_src, gw_dst, link_list_);
 
   /* loopback */
   if (src == dst) {
-    routes_[src->id()].loopback = link_list;
+    routes_[src->id()].loopback = link_list_;
   } else {
     /* src to everyone */
     if (src) {
       auto& route        = routes_[src->id()];
-      route.links_up     = link_list;
+      route.links_up     = link_list_;
       route.gateway      = gw_src;
       route.links_up_set = true;
       if (symmetrical) {
         /* reverse it for down/symmetrical links */
-        route.links_down.assign(link_list.rbegin(), link_list.rend());
+        route.links_down.assign(link_list_.rbegin(), link_list_.rend());
         route.links_down_set = true;
       }
     }
     /* dst to everyone */
     if (dst) {
       auto& route          = routes_[dst->id()];
-      route.links_down     = link_list;
+      route.links_down     = link_list_;
       route.gateway        = gw_dst;
       route.links_down_set = true;
     }
index 8f57da1..d9c5a98 100644 (file)
@@ -11,7 +11,6 @@
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/NetZone.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp" // RouteCreationArgs and friends
 
 namespace {
 class EngineWrapper {
@@ -103,7 +102,7 @@ TEST_CASE("kernel::routing::StarZone: Get routes: assert", "[.][assert]")
     zone->add_route(host1->get_netpoint(), nullptr, nullptr, nullptr, links, true);
     zone->add_route(nullptr, host2->get_netpoint(), nullptr, nullptr, links2, false);
     double lat;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(host2->get_netpoint(), host1->get_netpoint(), &route, &lat);
   }
 
@@ -112,7 +111,7 @@ TEST_CASE("kernel::routing::StarZone: Get routes: assert", "[.][assert]")
     zone->add_route(host1->get_netpoint(), nullptr, nullptr, nullptr, links, false);
     zone->add_route(host2->get_netpoint(), nullptr, nullptr, nullptr, links2, true);
     double lat;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(host2->get_netpoint(), host1->get_netpoint(), &route, &lat);
   }
 }
@@ -172,14 +171,14 @@ TEST_CASE("kernel::routing::StarZone: Get routes (hosts)", "")
     zone->seal();
 
     double lat = 0.0;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(host1->get_netpoint(), host2->get_netpoint(), &route, &lat);
     REQUIRE(lat == 30);
-    REQUIRE(route.gw_src == nullptr);
-    REQUIRE(route.gw_dst == nullptr);
-    REQUIRE(route.link_list.size() == 2);
-    REQUIRE(route.link_list[0]->get_name() == "link1");
-    REQUIRE(route.link_list[1]->get_name() == "link2");
+    REQUIRE(route.gw_src_ == nullptr);
+    REQUIRE(route.gw_dst_ == nullptr);
+    REQUIRE(route.link_list_.size() == 2);
+    REQUIRE(route.link_list_[0]->get_name() == "link1");
+    REQUIRE(route.link_list_[1]->get_name() == "link2");
   }
 
   SECTION("Get route: shared link(backbone)")
@@ -197,13 +196,13 @@ TEST_CASE("kernel::routing::StarZone: Get routes (hosts)", "")
     zone->seal();
 
     double lat = 0.0;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(host1->get_netpoint(), host2->get_netpoint(), &route, &lat);
     REQUIRE(lat == 130);
-    REQUIRE(route.link_list.size() == 3);
-    REQUIRE(route.link_list[0]->get_name() == "link1");
-    REQUIRE(route.link_list[1]->get_name() == "backbone");
-    REQUIRE(route.link_list[2]->get_name() == "link2");
+    REQUIRE(route.link_list_.size() == 3);
+    REQUIRE(route.link_list_[0]->get_name() == "link1");
+    REQUIRE(route.link_list_[1]->get_name() == "backbone");
+    REQUIRE(route.link_list_[2]->get_name() == "link2");
   }
 
   SECTION("Get route: loopback")
@@ -217,12 +216,12 @@ TEST_CASE("kernel::routing::StarZone: Get routes (hosts)", "")
     zone->seal();
 
     double lat = 0.0;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(host1->get_netpoint(), host1->get_netpoint(), &route, &lat);
     REQUIRE(lat == 110);
-    REQUIRE(route.link_list.size() == 2);
-    REQUIRE(route.link_list[0]->get_name() == "link1");
-    REQUIRE(route.link_list[1]->get_name() == "backbone");
+    REQUIRE(route.link_list_.size() == 2);
+    REQUIRE(route.link_list_[0]->get_name() == "link1");
+    REQUIRE(route.link_list_[1]->get_name() == "backbone");
   }
 }
 
@@ -251,13 +250,13 @@ TEST_CASE("kernel::routing::StarZone: Get routes (netzones)", "")
     zone->seal();
 
     double lat = 0.0;
-    simgrid::kernel::routing::RouteCreationArgs route;
+    simgrid::kernel::routing::Route route;
     zone->get_local_route(subzone1, subzone2, &route, &lat);
     REQUIRE(lat == 30);
-    REQUIRE(route.gw_src == router1);
-    REQUIRE(route.gw_dst == router2);
-    REQUIRE(route.link_list.size() == 2);
-    REQUIRE(route.link_list[0]->get_name() == "link1");
-    REQUIRE(route.link_list[1]->get_name() == "link2");
+    REQUIRE(route.gw_src_ == router1);
+    REQUIRE(route.gw_dst_ == router2);
+    REQUIRE(route.link_list_.size() == 2);
+    REQUIRE(route.link_list_[0]->get_name() == "link1");
+    REQUIRE(route.link_list_[1]->get_name() == "link2");
   }
 }
index e1ad2dd..a9d371d 100644 (file)
@@ -7,7 +7,6 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
@@ -70,7 +69,8 @@ std::vector<unsigned int> TorusZone::parse_topo_parameters(const std::string& to
      * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and save them into a vector.
      * Additionally, we need to know how many ranks we have in total
      */
-    std::transform(begin(dimensions_str), end(dimensions_str), std::back_inserter(dimensions), surf_parse_get_int);
+    std::transform(begin(dimensions_str), end(dimensions_str), std::back_inserter(dimensions),
+                   [](const std::string& s) { return std::stoi(s); });
   }
   return dimensions;
 }
@@ -82,7 +82,7 @@ void TorusZone::set_topology(const std::vector<unsigned int>& dimensions)
   set_num_links_per_node(dimensions_.size());
 }
 
-void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
 {
   XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
 
@@ -92,7 +92,7 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   if (src->id() == dst->id() && has_loopback()) {
     resource::LinkImpl* uplink = get_uplink_from(node_pos(src->id()));
 
-    route->link_list.push_back(uplink);
+    route->link_list_.push_back(uplink);
     if (lat)
       *lat += uplink->get_latency();
     return;
@@ -168,7 +168,7 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     }
 
     if (has_limiter()) { // limiter for sender
-      route->link_list.push_back(get_uplink_from(node_pos_with_loopback(current_node)));
+      route->link_list_.push_back(get_uplink_from(node_pos_with_loopback(current_node)));
     }
 
     resource::LinkImpl* lnk;
@@ -177,15 +177,15 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     else
       lnk = get_downlink_to(linkOffset);
 
-    route->link_list.push_back(lnk);
+    route->link_list_.push_back(lnk);
     if (lat)
       *lat += lnk->get_latency();
 
     current_node = next_node;
   }
   // set gateways (if any)
-  route->gw_src = get_gateway(src->id());
-  route->gw_dst = get_gateway(dst->id());
+  route->gw_src_ = get_gateway(src->id());
+  route->gw_dst_ = get_gateway(dst->id());
 }
 
 } // namespace routing
index cb9beb4..eceb3f7 100644 (file)
@@ -8,7 +8,6 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 
 #include <boost/algorithm/string.hpp>
@@ -71,15 +70,15 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out)
   add_route(nullptr, netpoint, nullptr, nullptr, {linkDown->get_impl()}, false);
 }
 
-void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
+void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
 {
   XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
 
   if (src->is_netzone()) {
     std::string srcName = "router_" + src->get_name();
     std::string dstName = "router_" + dst->get_name();
-    route->gw_src       = s4u::Engine::get_instance()->netpoint_by_name_or_null(srcName);
-    route->gw_dst       = s4u::Engine::get_instance()->netpoint_by_name_or_null(dstName);
+    route->gw_src_      = s4u::Engine::get_instance()->netpoint_by_name_or_null(srcName);
+    route->gw_dst_      = s4u::Engine::get_instance()->netpoint_by_name_or_null(dstName);
   }
 
   StarZone::get_local_route(src, dst, route, lat);
index f6693e0..95f3c16 100644 (file)
@@ -6,7 +6,6 @@
 #include "simgrid/kernel/routing/WifiZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
-#include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
 
 #include <unordered_set>
@@ -29,7 +28,7 @@ void WifiZone::do_seal()
   }
 }
 
-void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* res, double* lat)
+void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, Route* res, double* lat)
 {
   XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
 
@@ -39,13 +38,13 @@ void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
 
     if (src != access_point_) {
       XBT_DEBUG("src %s is not our gateway", src->get_cname());
-      res->link_list.push_back(wifi_link_);
+      res->link_list_.push_back(wifi_link_);
       if (lat)
         *lat += wifi_link_->get_latency();
     }
     if (dst != access_point_) {
       XBT_DEBUG("dst %s is not our gateway", dst->get_cname());
-      res->link_list.push_back(wifi_link_);
+      res->link_list_.push_back(wifi_link_);
       if (lat)
         *lat += wifi_link_->get_latency();
     }