Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a s4u::Link class, at least
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 7 Feb 2017 01:03:01 +0000 (02:03 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 7 Feb 2017 01:05:04 +0000 (02:05 +0100)
30 files changed:
include/simgrid/forward.h
include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/forward.hpp
include/simgrid/s4u/host.hpp
include/simgrid/s4u/link.hpp [new file with mode: 0644]
src/instr/instr_interface.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/ClusterZone.hpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/DragonflyZone.hpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FatTreeZone.hpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_link.cpp [new file with mode: 0644]
src/s4u/s4u_netzone.cpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp
teshsuite/simdag/flatifier/flatifier.cpp
tools/cmake/DefinePackages.cmake

index 5676f8a..9ebbda1 100644 (file)
@@ -15,6 +15,7 @@ namespace simgrid {
   namespace s4u {
   class NetZone;
   class Host;
+  class Link;
   class Mailbox;
   }
   namespace kernel {
@@ -42,10 +43,10 @@ namespace simgrid {
 
 typedef simgrid::s4u::NetZone simgrid_NetZone;
 typedef simgrid::s4u::Host simgrid_Host;
+typedef simgrid::s4u::Link Link;
 typedef simgrid::kernel::activity::ActivityImpl kernel_Activity;
 typedef simgrid::kernel::routing::NetPoint routing_NetPoint;
 typedef simgrid::surf::Cpu surf_Cpu;
-typedef simgrid::surf::LinkImpl Link;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
index 155a95c..6b738f1 100644 (file)
@@ -65,7 +65,7 @@ public:
   /*** Called on each newly created regular route (not on bypass routes) */
   static simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                                    kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                                   std::vector<Link*>* link_list)>
+                                   std::vector<surf::LinkImpl*>* link_list)>
       onRouteCreation;
 
 protected:
index 5b864a8..5327882 100644 (file)
@@ -18,6 +18,7 @@ class Activity;
 class Comm;
 class Engine;
 class Host;
+class Link;
 class Mailbox;
 using MailboxPtr = boost::intrusive_ptr<Mailbox>;
 
index 23e91e2..5251f3d 100644 (file)
@@ -103,6 +103,7 @@ public:
   boost::unordered_map<std::string, Storage*> const &mountedStorages();
 
   void routeTo(Host * dest, std::vector<Link*> * links, double* latency);
+  void routeTo(Host * dest, std::vector<surf::LinkImpl*> * links, double* latency);
 
 private:
   simgrid::xbt::string name_ = "noname";
diff --git a/include/simgrid/s4u/link.hpp b/include/simgrid/s4u/link.hpp
new file mode 100644 (file)
index 0000000..504125c
--- /dev/null
@@ -0,0 +1,94 @@
+/* Copyright (c) 2004-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. */
+
+#ifndef S4U_LINK_HPP_
+#define S4U_LINK_HPP_
+
+#include <xbt/base.h>
+
+#include <unordered_map>
+
+#include "xbt/dict.h"
+#include "xbt/fifo.h"
+
+#include "simgrid/link.h"
+
+/***********
+ * Classes *
+ ***********/
+
+namespace simgrid {
+namespace surf {
+class LinkImpl;
+}
+namespace s4u {
+/** @brief A Link represents the network facilities between [hosts](\ref simgrid::s4u::Host) */
+class Link {
+  friend simgrid::surf::LinkImpl;
+
+private:
+  // Links are created from the NetZone, and destroyed by their private implementation when the simulation ends
+  explicit Link(surf::LinkImpl* pimpl) : pimpl_(pimpl) {}
+  virtual ~Link() = default;
+  // The private implementation, that never changes
+  surf::LinkImpl* const pimpl_;
+
+public:
+  /** @brief Retrieve a link from its name */
+  static Link* byName(const char* name);
+
+  /** @brief Get da name */
+  const char* name();
+
+  /** @brief Get the bandwidth in bytes per second of current Link */
+  double bandwidth();
+
+  /** @brief Get the latency in seconds of current Link */
+  double latency();
+
+  /** @brief The sharing policy is a @{link e_surf_link_sharing_policy_t::EType} (0: FATPIPE, 1: SHARED, 2: FULLDUPLEX)
+   */
+  int sharingPolicy();
+
+  /** @brief Check if the Link is used */
+  bool isUsed();
+
+  void turnOn();
+  void turnOff();
+
+  void* getData();
+  void setData(void* d);
+
+  void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain
+                                             boolean values. */
+  void
+  setBandwidthTrace(tmgr_trace_t trace);    /*< setup the trace file with bandwidth events (peak speed changes due to
+                                               external load). Trace must contain percentages (value between 0 and 1). */
+  void setLatencyTrace(tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to
+                                               external load). Trace must contain absolute values */
+};
+}
+}
+
+#endif /* SURF_NETWORK_INTERFACE_HPP_ */
+
+/* Blueprint for the s4u/kernel split
+
+namespace s4u {
+  class Link {
+  public:
+    Link(kernel::Link* pimpl) : pimpl_(pimpl) {}
+  private:
+    kernel::Link* pimpl_;
+  };
+}
+
+namespace kernel  {
+  class Link : public util::refcounted<Link> {
+  private:
+    s4u::Link user_;
+  };
+}
+ */
index 74ee42b..2a7abcb 100644 (file)
@@ -316,7 +316,7 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
   if(!dst_elm)
     xbt_die("Element '%s' not found!",dst);
 
-  std::vector<Link*> route;
+  std::vector<simgrid::surf::LinkImpl*> route;
   simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr);
   for (auto link : route)
     instr_user_variable (time, link->getName(), variable, father_type, value, what, nullptr, user_link_variables);
index c6e2679..6cc36f1 100644 (file)
@@ -29,7 +29,7 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
   if ((src->id() == dst->id()) && hasLoopback_) {
     xbt_assert(!src->isRouter(), "Routing from a cluster private router to itself is meaningless");
 
-    std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
     route->link_list->push_back(info.first);
     if (lat)
       *lat += info.first->latency();
@@ -38,11 +38,12 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
 
   if (!src->isRouter()) { // No private link for the private router
     if (hasLimiter_) { // limiter for sender
-      std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0));
+      std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
+          privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0));
       route->link_list->push_back(info.first);
     }
 
-    std::pair<Link*, Link*> info =
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
         privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0));
     if (info.first) { // link up
       route->link_list->push_back(info.first);
@@ -59,7 +60,8 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
 
   if (!dst->isRouter()) { // No specific link for router
 
-    std::pair<Link*, Link*> info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
+        privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
     if (info.second) { // link down
       route->link_list->push_back(info.second);
       if (lat)
@@ -90,7 +92,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
     if (!src->isRouter()) {
       xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
 
-      std::pair<Link*, Link*> info = privateLinks_.at(src->id());
+      std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
 
       if (info.first) { // link up
         xbt_node_t current = new_xbt_graph_node(graph, info.first->getName(), nodes);
@@ -129,16 +131,16 @@ void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id
   link.policy    = cluster->sharing_policy;
   sg_platf_new_link(&link);
 
-  Link *linkUp, *linkDown;
+  surf::LinkImpl *linkUp, *linkDown;
   if (link.policy == SURF_LINK_FULLDUPLEX) {
     char* tmp_link = bprintf("%s_UP", link_id);
-    linkUp         = Link::byName(tmp_link);
+    linkUp         = surf::LinkImpl::byName(tmp_link);
     xbt_free(tmp_link);
     tmp_link = bprintf("%s_DOWN", link_id);
-    linkDown = Link::byName(tmp_link);
+    linkDown = surf::LinkImpl::byName(tmp_link);
     xbt_free(tmp_link);
   } else {
-    linkUp   = Link::byName(link_id);
+    linkUp   = surf::LinkImpl::byName(link_id);
     linkDown = linkUp;
   }
   privateLinks_.insert({position, {linkUp, linkDown}});
index 0137d37..497096c 100644 (file)
@@ -77,9 +77,9 @@ public:
 
   /* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
   /* The pair is {linkUp, linkDown} */
-  std::unordered_map<unsigned int, std::pair<Link*, Link*>> privateLinks_;
+  std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> privateLinks_;
 
-  Link* backbone_                = nullptr;
+  surf::LinkImpl* backbone_      = nullptr;
   void* loopback_                = nullptr;
   NetPoint* router_              = nullptr;
   bool hasLimiter_               = false;
index 08fd443..b376601 100644 (file)
@@ -68,7 +68,7 @@ void DijkstraZone::seal()
 
       if (!found) {
         sg_platf_route_cbarg_t e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
-        e_route->link_list             = new std::vector<Link*>();
+        e_route->link_list             = new std::vector<surf::LinkImpl*>();
         e_route->link_list->push_back(surf_network_model->loopback_);
         xbt_graph_new_edge(routeGraph_, node, node, e_route);
       }
@@ -173,7 +173,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
     for (auto link : *e_route->link_list) {
       route->link_list->insert(route->link_list->begin(), link);
       if (lat)
-        *lat += static_cast<Link*>(link)->latency();
+        *lat += static_cast<surf::LinkImpl*>(link)->latency();
     }
   }
 
@@ -261,11 +261,11 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
 
     if (hierarchy_ == RoutingMode::recursive && v != dst_node_id &&
         strcmp(gw_dst->name().c_str(), prev_gw_src->name().c_str())) {
-      std::vector<Link*>* e_route_as_to_as = new std::vector<Link*>();
+      std::vector<surf::LinkImpl*> e_route_as_to_as;
 
-      getGlobalRoute(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, nullptr);
+      getGlobalRoute(gw_dst_net_elm, prev_gw_src_net_elm, &e_route_as_to_as, nullptr);
       auto pos = route->link_list->begin();
-      for (auto link : *e_route_as_to_as) {
+      for (auto link : e_route_as_to_as) {
         route->link_list->insert(pos, link);
         if (lat)
           *lat += link->latency();
@@ -276,7 +276,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
     for (auto link : *e_route->link_list) {
       route->link_list->insert(route->link_list->begin(), link);
       if (lat)
-        *lat += static_cast<Link*>(link)->latency();
+        *lat += static_cast<surf::LinkImpl*>(link)->latency();
     }
     size++;
   }
index 0de5c30..1479f98 100644 (file)
@@ -133,7 +133,7 @@ void DragonflyZone::generateRouters()
   }
 }
 
-void DragonflyZone::createLink(char* id, int numlinks, Link** linkup, Link** linkdown)
+void DragonflyZone::createLink(char* id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
 {
   *linkup   = nullptr;
   *linkdown = nullptr;
@@ -145,17 +145,17 @@ void DragonflyZone::createLink(char* id, int numlinks, Link** linkup, Link** lin
   linkTemplate.id        = id;
   sg_platf_new_link(&linkTemplate);
   XBT_DEBUG("Generating link %s", id);
-  Link* link;
+  surf::LinkImpl* link;
   std::string tmpID;
   if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX) {
     tmpID     = std::string(linkTemplate.id) + "_UP";
-    link      = Link::byName(tmpID.c_str());
+    link      = surf::LinkImpl::byName(tmpID.c_str());
     *linkup   = link; // check link?
     tmpID     = std::string(linkTemplate.id) + "_DOWN";
-    link      = Link::byName(tmpID.c_str());
+    link      = surf::LinkImpl::byName(tmpID.c_str());
     *linkdown = link; // check link ?
   } else {
-    link      = Link::byName(linkTemplate.id);
+    link      = surf::LinkImpl::byName(linkTemplate.id);
     *linkup   = link;
     *linkdown = link;
   }
@@ -168,8 +168,8 @@ void DragonflyZone::generateLinks()
 
   static int uniqueId = 0;
   char* id            = nullptr;
-  Link* linkup;
-  Link* linkdown;
+  surf::LinkImpl* linkup;
+  surf::LinkImpl* linkdown;
 
   unsigned int numRouters = this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_;
 
@@ -179,10 +179,12 @@ void DragonflyZone::generateLinks()
   // Links from routers to their local nodes.
   for (unsigned int i = 0; i < numRouters; i++) {
     // allocate structures
-    this->routers_[i]->myNodes_ =
-        static_cast<Link**>(xbt_malloc0(numLinksperLink_ * this->numNodesPerBlade_ * sizeof(Link*)));
-    this->routers_[i]->greenLinks_ = static_cast<Link**>(xbt_malloc0(this->numBladesPerChassis_ * sizeof(Link*)));
-    this->routers_[i]->blackLinks_ = static_cast<Link**>(xbt_malloc0(this->numChassisPerGroup_ * sizeof(Link*)));
+    this->routers_[i]->myNodes_ = static_cast<surf::LinkImpl**>(
+        xbt_malloc0(numLinksperLink_ * this->numNodesPerBlade_ * sizeof(surf::LinkImpl*)));
+    this->routers_[i]->greenLinks_ =
+        static_cast<surf::LinkImpl**>(xbt_malloc0(this->numBladesPerChassis_ * sizeof(surf::LinkImpl*)));
+    this->routers_[i]->blackLinks_ =
+        static_cast<surf::LinkImpl**>(xbt_malloc0(this->numChassisPerGroup_ * sizeof(surf::LinkImpl*)));
 
     for (unsigned int j = 0; j < numLinksperLink_ * this->numNodesPerBlade_; j += numLinksperLink_) {
       id = bprintf("local_link_from_router_%d_to_node_%d_%d", i, j / numLinksperLink_, uniqueId);
@@ -234,8 +236,8 @@ void DragonflyZone::generateLinks()
     for (unsigned int j = i + 1; j < this->numGroups_; j++) {
       unsigned int routernumi                = i * numBladesPerChassis_ * numChassisPerGroup_ + j;
       unsigned int routernumj                = j * numBladesPerChassis_ * numChassisPerGroup_ + i;
-      this->routers_[routernumi]->blueLinks_ = static_cast<Link**>(xbt_malloc0(sizeof(Link*)));
-      this->routers_[routernumj]->blueLinks_ = static_cast<Link**>(xbt_malloc0(sizeof(Link*)));
+      this->routers_[routernumi]->blueLinks_ = static_cast<surf::LinkImpl**>(xbt_malloc0(sizeof(surf::LinkImpl*)));
+      this->routers_[routernumj]->blueLinks_ = static_cast<surf::LinkImpl**>(xbt_malloc0(sizeof(surf::LinkImpl*)));
       id = bprintf("blue_link_between_group_%d_and_%d_routers_%d_and_%d_%d", i, j, routernumi, routernumj, uniqueId);
       this->createLink(id, this->numLinksBlue_, &linkup, &linkdown);
       this->routers_[routernumi]->blueLinks_[0] = linkup;
@@ -257,7 +259,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_c
            dst->id());
 
   if ((src->id() == dst->id()) && hasLoopback_) {
-    std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
 
     route->link_list->push_back(info.first);
     if (latency)
@@ -283,7 +285,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_c
     *latency += myRouter->myNodes_[myCoords[3] * numLinksperLink_]->latency();
 
   if (hasLimiter_) { // limiter for sender
-    std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_ + hasLoopback_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_ + hasLoopback_);
     route->link_list->push_back(info.first);
   }
 
@@ -335,7 +337,7 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_c
   }
 
   if (hasLimiter_) { // limiter for receiver
-    std::pair<Link*, Link*> info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_);
     route->link_list->push_back(info.first);
   }
 
index 01b07dc..d9a6016 100644 (file)
@@ -68,7 +68,7 @@ public:
   void seal() override;
   void generateRouters();
   void generateLinks();
-  void createLink(char* id, int numlinks, Link** linkup, Link** linkdown);
+  void createLink(char* id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
   unsigned int* rankId_to_coords(int rankId);
 
 private:
index 9475591..4a1fa4c 100644 (file)
@@ -437,7 +437,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, in
     linkTemplate.policy    = SURF_LINK_SHARED;
     linkTemplate.id        = bprintf("limiter_%d", id);
     sg_platf_new_link(&linkTemplate);
-    this->limiterLink = Link::byName(linkTemplate.id);
+    this->limiterLink = surf::LinkImpl::byName(linkTemplate.id);
     free(const_cast<char*>(linkTemplate.id));
   }
   if (cluster->loopback_bw || cluster->loopback_lat) {
@@ -447,7 +447,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, in
     linkTemplate.policy    = SURF_LINK_FATPIPE;
     linkTemplate.id        = bprintf("loopback_%d", id);
     sg_platf_new_link(&linkTemplate);
-    this->loopback = Link::byName(linkTemplate.id);
+    this->loopback = surf::LinkImpl::byName(linkTemplate.id);
     free(const_cast<char*>(linkTemplate.id));
   }
 }
@@ -466,11 +466,11 @@ FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode* downNode
 
   if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX) {
     std::string tmpID = std::string(linkTemplate.id) + "_UP";
-    this->upLink      = Link::byName(tmpID.c_str()); // check link?
+    this->upLink      = surf::LinkImpl::byName(tmpID.c_str()); // check link?
     tmpID          = std::string(linkTemplate.id) + "_DOWN";
-    this->downLink    = Link::byName(tmpID.c_str()); // check link ?
+    this->downLink    = surf::LinkImpl::byName(tmpID.c_str()); // check link ?
   } else {
-    this->upLink   = Link::byName(linkTemplate.id);
+    this->upLink   = surf::LinkImpl::byName(linkTemplate.id);
     this->downLink = this->upLink;
   }
   free(const_cast<char*>(linkTemplate.id));
index 8d85387..8050329 100644 (file)
@@ -46,11 +46,11 @@ public:
 
   /** Virtual link standing for the node global capacity.
    */
-  Link* limiterLink;
+  surf::LinkImpl* limiterLink;
   /** If present, communications from this node to this node will pass through it
    * instead of passing by an upper level switch.
    */
-  Link* loopback;
+  surf::LinkImpl* loopback;
   FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, int position);
 };
 
@@ -63,9 +63,9 @@ class FatTreeLink {
 public:
   FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode* source, FatTreeNode* destination);
   /** Link going up in the tree */
-  Link* upLink;
+  surf::LinkImpl* upLink;
   /** Link going down in the tree */
-  Link* downLink;
+  surf::LinkImpl* downLink;
   /** Upper end of the link */
   FatTreeNode* upNode;
   /** Lower end of the link */
index e88464b..000db3f 100644 (file)
@@ -181,7 +181,7 @@ void FloydZone::seal()
         e_route            = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->gw_src    = nullptr;
         e_route->gw_dst    = nullptr;
-        e_route->link_list = new std::vector<Link*>();
+        e_route->link_list = new std::vector<surf::LinkImpl*>();
         e_route->link_list->push_back(surf_network_model->loopback_);
         TO_FLOYD_LINK(i, i) = e_route;
         TO_FLOYD_PRED(i, i) = i;
index 71723c7..8187c3d 100644 (file)
@@ -34,7 +34,7 @@ void FullZone::seal()
         e_route            = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->gw_src    = nullptr;
         e_route->gw_dst    = nullptr;
-        e_route->link_list = new std::vector<Link*>();
+        e_route->link_list = new std::vector<surf::LinkImpl*>();
         e_route->link_list->push_back(surf_network_model->loopback_);
         TO_ROUTE_FULL(i, i) = e_route;
       }
index a5175cc..90c4828 100644 (file)
@@ -23,7 +23,7 @@ public:
   explicit BypassRoute(NetPoint* gwSrc, NetPoint* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
   const NetPoint* gw_src;
   const NetPoint* gw_dst;
-  std::vector<Link*> links;
+  std::vector<surf::LinkImpl*> links;
 };
 
 NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, name)
index deaadbe..61e80c4 100644 (file)
@@ -82,7 +82,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
         continue;
 
       sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
-      route->link_list             = new std::vector<Link*>();
+      route->link_list             = new std::vector<surf::LinkImpl*>();
 
       getLocalRoute(my_src, my_dst, route, nullptr);
 
@@ -134,7 +134,7 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl
   sg_platf_route_cbarg_t result;
 
   result            = xbt_new0(s_sg_platf_route_cbarg_t, 1);
-  result->link_list = new std::vector<Link*>();
+  result->link_list = new std::vector<surf::LinkImpl*>();
 
   xbt_assert(hierarchy == RoutingMode::base || hierarchy == RoutingMode::recursive,
              "The hierarchy of this netzone is neither BASIC nor RECURSIVE, I'm lost here.");
index a7fc92c..b2c1896 100644 (file)
@@ -60,17 +60,17 @@ void TorusZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id,
     link.latency   = cluster->lat;
     link.policy    = cluster->sharing_policy;
     sg_platf_new_link(&link);
-    Link* linkUp;
-    Link* linkDown;
+    surf::LinkImpl* linkUp;
+    surf::LinkImpl* linkDown;
     if (link.policy == SURF_LINK_FULLDUPLEX) {
       char* tmp_link = bprintf("%s_UP", link_id);
-      linkUp         = Link::byName(tmp_link);
+      linkUp         = surf::LinkImpl::byName(tmp_link);
       free(tmp_link);
       tmp_link = bprintf("%s_DOWN", link_id);
-      linkDown = Link::byName(tmp_link);
+      linkDown = surf::LinkImpl::byName(tmp_link);
       free(tmp_link);
     } else {
-      linkUp   = Link::byName(link_id);
+      linkUp   = surf::LinkImpl::byName(link_id);
       linkDown = linkUp;
     }
     /*
@@ -119,7 +119,7 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
     return;
 
   if (src->id() == dst->id() && hasLoopback_) {
-    std::pair<Link*, Link*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
 
     route->link_list->push_back(info.first);
     if (lat)
@@ -199,7 +199,7 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
       dim_product *= cur_dim;
     }
 
-    std::pair<Link*, Link*> info;
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info;
 
     if (hasLimiter_) { // limiter for sender
       info = privateLinks_.at(nodeOffset + hasLoopback_);
index 85b34ac..78e500c 100644 (file)
@@ -66,8 +66,8 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, c
 
   std::string link_up   = "link_" + netpoint->name() + "_UP";
   std::string link_down = "link_" + netpoint->name() + "_DOWN";
-  Link* linkUp          = surf_network_model->createLink(link_up.c_str(), bw_out, 0, SURF_LINK_SHARED);
-  Link* linkDown        = surf_network_model->createLink(link_down.c_str(), bw_in, 0, SURF_LINK_SHARED);
+  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);
   privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
@@ -84,7 +84,7 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
 
   /* Retrieve the private links */
   if (privateLinks_.find(src->id()) != privateLinks_.end()) {
-    std::pair<Link*, Link*> info = privateLinks_.at(src->id());
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
     if (info.first) {
       route->link_list->push_back(info.first);
       if (lat)
@@ -92,7 +92,7 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
     }
   }
   if (privateLinks_.find(dst->id()) != privateLinks_.end()) {
-    std::pair<Link*, Link*> info = privateLinks_.at(dst->id());
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(dst->id());
     if (info.second) {
       route->link_list->push_back(info.second);
       if (lat)
index e481e2d..10eec1d 100644 (file)
@@ -141,6 +141,14 @@ int Host::pstatesCount() const {
  * by calling each "get_route" function in each routing component.
  */
 void Host::routeTo(Host* dest, std::vector<Link*>* links, double* latency)
+{
+  std::vector<surf::LinkImpl*> linkImpls;
+  this->routeTo(dest, &linkImpls, latency);
+  for (surf::LinkImpl* l : linkImpls)
+    links->push_back(&l->piface_);
+}
+/** @brief Just like Host::routeTo, but filling an array of link implementations */
+void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>* links, double* latency)
 {
   simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
   if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
diff --git a/src/s4u/s4u_link.cpp b/src/s4u/s4u_link.cpp
new file mode 100644 (file)
index 0000000..c7fb403
--- /dev/null
@@ -0,0 +1,153 @@
+/* Copyright (c) 2013-2015. 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 <algorithm>
+
+#include "simgrid/s4u/link.hpp"
+#include "simgrid/sg_config.h"
+#include "simgrid/simix.hpp"
+#include "src/surf/network_interface.hpp"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U links");
+
+/*********
+ * C API *
+ *********/
+
+extern "C" {
+
+const char* sg_link_name(Link* link)
+{
+  return link->name();
+}
+Link* sg_link_by_name(const char* name)
+{
+  return Link::byName(name);
+}
+
+int sg_link_is_shared(Link* link)
+{
+  return link->sharingPolicy();
+}
+double sg_link_bandwidth(Link* link)
+{
+  return link->bandwidth();
+}
+double sg_link_latency(Link* link)
+{
+  return link->latency();
+}
+void* sg_link_data(Link* link)
+{
+  return link->getData();
+}
+void sg_link_data_set(Link* link, void* data)
+{
+  link->setData(data);
+}
+int sg_link_count()
+{
+  return simgrid::surf::LinkImpl::linksCount();
+}
+Link** sg_link_list()
+{
+  simgrid::surf::LinkImpl** list = simgrid::surf::LinkImpl::linksList();
+  Link** res                     = (Link**)list; // Use the same memory area
+
+  int size = sg_link_count();
+  for (int i = 0; i < size; i++)
+    res[i] = &(list[i]->piface_); // Convert each entry into its interface
+
+  return res;
+}
+void sg_link_exit()
+{
+  simgrid::surf::LinkImpl::linksExit();
+}
+}
+
+/***********
+ * C++ API *
+ ***********/
+
+namespace simgrid {
+namespace s4u {
+Link* Link::byName(const char* name)
+{
+  surf::LinkImpl* res = surf::LinkImpl::byName(name);
+  if (res == nullptr)
+    return nullptr;
+  return &res->piface_;
+}
+const char* Link::name()
+{
+  return pimpl_->getName();
+}
+bool Link::isUsed()
+{
+  return pimpl_->isUsed();
+}
+
+double Link::latency()
+{
+  return pimpl_->latency();
+}
+
+double Link::bandwidth()
+{
+  return pimpl_->bandwidth();
+}
+
+int Link::sharingPolicy()
+{
+  return pimpl_->sharingPolicy();
+}
+
+void Link::turnOn()
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->turnOn();
+  });
+}
+void Link::turnOff()
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->turnOff();
+  });
+}
+
+void* Link::getData()
+{
+  return pimpl_->getData();
+}
+void Link::setData(void* d)
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->setData(d);
+  });
+}
+
+void Link::setStateTrace(tmgr_trace_t trace)
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->setStateTrace(trace);
+  });
+}
+void Link::setBandwidthTrace(tmgr_trace_t trace)
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->setBandwidthTrace(trace);
+  });
+}
+void Link::setLatencyTrace(tmgr_trace_t trace)
+{
+  simgrid::simix::kernelImmediate([&]() {
+    this->pimpl_->setLatencyTrace(trace);
+  });
+}
+}
+}
index 1ab825e..ea2f37c 100644 (file)
@@ -18,7 +18,7 @@ namespace s4u {
 
 simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                           kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                          std::vector<Link*>* link_list)>
+                          std::vector<surf::LinkImpl*>* link_list)>
     NetZone::onRouteCreation;
 
 NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
index d00e88c..64e9649 100644 (file)
@@ -87,7 +87,7 @@ void surf_network_model_init_IB()
   surf_network_model = new simgrid::surf::NetworkIBModel();
   all_existing_models->push_back(surf_network_model);
   networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback);
-  Link::onCommunicate.connect(IB_action_init_callback);
+  simgrid::surf::LinkImpl::onCommunicate.connect(IB_action_init_callback);
   simgrid::s4u::Host::onCreation.connect(IB_create_host_callback);
   xbt_cfg_setdefault_double("network/weight-S", 8775);
 
index efaeacc..7584401 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, "Logging specific to the SURF network module");
 
-/*********
- * C API *
- *********/
-
-extern "C" {
-
-  const char* sg_link_name(Link *link) {
-    return link->getName();
-  }
-  Link * sg_link_by_name(const char* name) {
-    return Link::byName(name);
-  }
-
-  int sg_link_is_shared(Link *link){
-    return link->sharingPolicy();
-  }
-  double sg_link_bandwidth(Link *link){
-    return link->bandwidth();
-  }
-  double sg_link_latency(Link *link){
-    return link->latency();
-  }
-  void* sg_link_data(Link *link) {
-    return link->getData();
-  }
-  void sg_link_data_set(Link *link,void *data) {
-    link->setData(data);
-  }
-  int sg_link_count() {
-    return Link::linksCount();
-  }
-  Link** sg_link_list() {
-    return Link::linksList();
-  }
-  void sg_link_exit() {
-    Link::linksExit();
-  }
-
-}
-
-/*****************
- * List of links *
- *****************/
-
 namespace simgrid {
   namespace surf {
 
+  /* List of links */
   std::unordered_map<std::string, LinkImpl*>* LinkImpl::links = new std::unordered_map<std::string, LinkImpl*>();
+
   LinkImpl* LinkImpl::byName(const char* name)
   {
     if (links->find(name) == links->end())
       return nullptr;
     return links->at(name);
-    }
-    /** @brief Returns the amount of links in the platform */
-    int LinkImpl::linksCount()
-    {
-      return links->size();
+  }
+  /** @brief Returns the amount of links in the platform */
+  int LinkImpl::linksCount()
+  {
+    return links->size();
     }
     /** @brief Returns a list of all existing links */
     LinkImpl** LinkImpl::linksList()
@@ -152,8 +110,9 @@ namespace simgrid {
      ************/
 
     LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
-        : Resource(model, name, constraint)
+        : Resource(model, name, constraint), piface_(Link(this))
     {
+
       if (strcmp(name,"__loopback__"))
         xbt_assert(!LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
 
index 1c86cfd..f0838b6 100644 (file)
@@ -17,6 +17,7 @@
 #include "src/surf/PropertyHolder.hpp"
 
 #include "simgrid/link.h"
+#include "simgrid/s4u/link.hpp"
 
 /***********
  * Classes *
@@ -139,6 +140,8 @@ namespace simgrid {
       bool currentlyDestroying_ = false;
 
     public:
+      /** @brief Public interface */
+      s4u::Link piface_;
       /** @brief Callback signal fired when a new Link is created */
       static simgrid::xbt::signal<void(surf::LinkImpl*)> onCreation;
 
index 5e00d5e..ac3ce92 100644 (file)
@@ -125,7 +125,8 @@ void sg_platf_new_link(sg_platf_link_cbarg_t link){
     names.push_back(xbt_strdup(link->id));
   }
   for (auto link_name : names) {
-    Link* l = surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
+    simgrid::surf::LinkImpl* l =
+        surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
 
     if (link->properties) {
       xbt_dict_cursor_t cursor = nullptr;
@@ -223,8 +224,8 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
     // other columns are to store one or more link for the node
 
     //add a loopback link
-    Link* linkUp   = nullptr;
-    Link* linkDown = nullptr;
+    simgrid::surf::LinkImpl* linkUp   = nullptr;
+    simgrid::surf::LinkImpl* linkDown = nullptr;
     if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
       char *tmp_link = bprintf("%s_loopback", link_id);
       XBT_DEBUG("<loopback\tid=\"%s\"\tbw=\"%f\"/>", tmp_link, cluster->loopback_bw);
@@ -235,8 +236,8 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
       link.latency   = cluster->loopback_lat;
       link.policy    = SURF_LINK_FATPIPE;
       sg_platf_new_link(&link);
-      linkUp   = Link::byName(tmp_link);
-      linkDown = Link::byName(tmp_link);
+      linkUp   = simgrid::surf::LinkImpl::byName(tmp_link);
+      linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
       free(tmp_link);
 
       auto as_cluster = static_cast<ClusterZone*>(current_as);
@@ -256,7 +257,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
       link.latency = 0;
       link.policy = SURF_LINK_SHARED;
       sg_platf_new_link(&link);
-      linkUp = linkDown = Link::byName(tmp_link);
+      linkUp = linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
       free(tmp_link);
       current_as->privateLinks_.insert(
           {rankId * current_as->linkCountPerNode_ + current_as->hasLoopback_, {linkUp, linkDown}});
@@ -298,7 +299,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
     XBT_DEBUG("<link\tid=\"%s\" bw=\"%f\" lat=\"%f\"/>", link.id, cluster->bb_bw, cluster->bb_lat);
     sg_platf_new_link(&link);
 
-    routing_cluster_add_backbone(Link::byName(link.id));
+    routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id));
     free((char*)link.id);
   }
 
@@ -724,8 +725,8 @@ void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t hostlink)
   xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
              "Only hosts from Cluster and Vivaldi ASes can get an host_link.");
 
-  simgrid::surf::LinkImpl* linkUp   = Link::byName(hostlink->link_up);
-  simgrid::surf::LinkImpl* linkDown = Link::byName(hostlink->link_down);
+  simgrid::surf::LinkImpl* linkUp   = simgrid::surf::LinkImpl::byName(hostlink->link_up);
+  simgrid::surf::LinkImpl* linkDown = simgrid::surf::LinkImpl::byName(hostlink->link_down);
 
   xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up);
   xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down);
index 379c8f4..6929d35 100644 (file)
@@ -85,7 +85,7 @@ typedef struct s_sg_platf_route_cbarg {
   sg_netpoint_t dst;
   sg_netpoint_t gw_src;
   sg_netpoint_t gw_dst;
-  std::vector<Link*> *link_list;
+  std::vector<simgrid::surf::LinkImpl*>* link_list;
 } s_sg_platf_route_cbarg_t;
 
 typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
@@ -188,7 +188,7 @@ typedef struct s_sg_platf_AS_cbarg {
 #define SG_PLATF_AS_INITIALIZER {nullptr,0}
 
 /********** Routing **********/
-void routing_cluster_add_backbone(Link* bb);
+void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb);
 /*** END of the parsing cruft ***/
 
 XBT_PUBLIC(void) sg_platf_begin();  // Start a new platform
index 420cabf..684780a 100644 (file)
@@ -689,15 +689,15 @@ void STag_surfxml_link___ctn(){
   switch (A_surfxml_link___ctn_direction) {
   case AU_surfxml_link___ctn_direction:
   case A_surfxml_link___ctn_direction_NONE:
-    link = Link::byName(A_surfxml_link___ctn_id);
+    link = simgrid::surf::LinkImpl::byName(A_surfxml_link___ctn_id);
     break;
   case A_surfxml_link___ctn_direction_UP:
     link_name = bprintf("%s_UP", A_surfxml_link___ctn_id);
-    link = Link::byName(link_name);
+    link      = simgrid::surf::LinkImpl::byName(link_name);
     break;
   case A_surfxml_link___ctn_direction_DOWN:
     link_name = bprintf("%s_DOWN", A_surfxml_link___ctn_id);
-    link = Link::byName(link_name);
+    link      = simgrid::surf::LinkImpl::byName(link_name);
     break;
   }
   xbt_free(link_name); // no-op if it's already nullptr
@@ -720,7 +720,7 @@ void ETag_surfxml_backbone(){
   link.policy = SURF_LINK_SHARED;
 
   sg_platf_new_link(&link);
-  routing_cluster_add_backbone(sg_link_by_name(A_surfxml_backbone_id));
+  routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(A_surfxml_backbone_id));
 }
 
 void STag_surfxml_route(){
@@ -768,7 +768,7 @@ void ETag_surfxml_route(){
   route.dst         = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag
   route.gw_src    = nullptr;
   route.gw_dst    = nullptr;
-  route.link_list = new std::vector<Link*>();
+  route.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
   route.symmetrical = (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES);
 
   for (auto link: parsed_link_list)
@@ -789,7 +789,7 @@ void ETag_surfxml_ASroute(){
   ASroute.gw_src = sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___src); // tested to not be nullptr in start tag
   ASroute.gw_dst = sg_netpoint_by_name_or_null(A_surfxml_ASroute_gw___dst); // tested to not be nullptr in start tag
 
-  ASroute.link_list =  new std::vector<Link*>();
+  ASroute.link_list = new std::vector<simgrid::surf::LinkImpl*>();
 
   for (auto link: parsed_link_list)
     ASroute.link_list->push_back(link);
@@ -818,7 +818,7 @@ void ETag_surfxml_bypassRoute(){
   route.gw_src = nullptr;
   route.gw_dst = nullptr;
   route.symmetrical = false;
-  route.link_list =  new std::vector<Link*>();
+  route.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
 
   for (auto link: parsed_link_list)
     route.link_list->push_back(link);
@@ -833,7 +833,7 @@ void ETag_surfxml_bypassASroute(){
 
   ASroute.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_src);
   ASroute.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassASroute_dst);
-  ASroute.link_list   = new std::vector<Link*>();
+  ASroute.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
   for (auto link: parsed_link_list)
     ASroute.link_list->push_back(link);
   parsed_link_list.clear();
index ffa3c58..4471349 100644 (file)
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
       simgrid::kernel::routing::NetPoint* netcardSrc = host1->pimpl_netpoint;
       for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
         simgrid::s4u::Host* host2 = hosts[it_dst];
-        std::vector<Link*> route;
+        std::vector<simgrid::surf::LinkImpl*> route;
         simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
         simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
         if (!route.empty()) {
@@ -166,7 +166,7 @@ int main(int argc, char **argv)
       for (auto netcardDst : netcardList) { // to router
         if (netcardDst->isRouter()) {
           std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->cname(), netcardDst->cname());
-          std::vector<Link*> route;
+          std::vector<simgrid::surf::LinkImpl*> route;
           simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
           for (auto link : route)
             std::printf("<link_ctn id=\"%s\"/>",link->getName());
@@ -180,7 +180,7 @@ int main(int argc, char **argv)
         for (auto value2 : netcardList) { // to router
           if (value2->isRouter()) {
             std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->cname(), value2->cname());
-            std::vector<Link*> route;
+            std::vector<simgrid::surf::LinkImpl*> route;
             simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr);
             for (auto link : route)
               std::printf("<link_ctn id=\"%s\"/>",link->getName());
@@ -190,7 +190,7 @@ int main(int argc, char **argv)
         for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
           simgrid::s4u::Host* host2 = hosts[it_dst];
           std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->cname(), host2->cname());
-          std::vector<Link*> route;
+          std::vector<simgrid::surf::LinkImpl*> route;
           simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
           simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
           for (auto link : route)
index fe90e71..1fe3b98 100644 (file)
@@ -395,6 +395,7 @@ set(S4U_SRC
   src/s4u/s4u_engine.cpp  
   src/s4u/s4u_file.cpp  
   src/s4u/s4u_host.cpp  
+  src/s4u/s4u_link.cpp
   src/s4u/s4u_mailbox.cpp
   src/s4u/s4u_mutex.cpp
   src/s4u/s4u_netzone.cpp
@@ -656,6 +657,7 @@ set(headers_to_install
   include/simgrid/s4u/engine.hpp  
   include/simgrid/s4u/file.hpp  
   include/simgrid/s4u/host.hpp  
+  include/simgrid/s4u/link.hpp  
   include/simgrid/s4u/Mailbox.hpp
   include/simgrid/s4u/Mutex.hpp
   include/simgrid/s4u/NetZone.hpp