Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move NetCard to its own header file
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 6 Dec 2016 20:14:58 +0000 (21:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 6 Dec 2016 20:32:51 +0000 (21:32 +0100)
21 files changed:
src/kernel/routing/AsCluster.cpp
src/kernel/routing/AsClusterDragonfly.cpp
src/kernel/routing/AsClusterFatTree.cpp
src/kernel/routing/AsClusterTorus.cpp
src/kernel/routing/AsDijkstra.cpp
src/kernel/routing/AsFloyd.cpp
src/kernel/routing/AsFull.cpp
src/kernel/routing/AsImpl.cpp
src/kernel/routing/AsRoutedGraph.cpp
src/kernel/routing/AsVivaldi.cpp
src/kernel/routing/NetCard.hpp [new file with mode: 0644]
src/s4u/s4u_as.cpp
src/s4u/s4u_host.cpp
src/simgrid/host.cpp
src/surf/network_ns3.cpp
src/surf/sg_platf.cpp
src/surf/surf_interface.cpp
src/surf/surf_routing.hpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/is-router/is-router.cpp
tools/cmake/DefinePackages.cmake

index 7d90a51..8794292 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsCluster.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
index 9fb2d04..abe03ac 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsClusterDragonfly.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
 
index 169497d..d8d19e0 100644 (file)
@@ -7,6 +7,7 @@
 #include <sstream>
 
 #include "src/kernel/routing/AsClusterFatTree.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 #include "xbt/lib.h"
index 9bbb806..8690cdc 100644 (file)
@@ -4,6 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsClusterTorus.hpp"
+#include "src/kernel/routing/NetCard.hpp"
+
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
 
index 2102994..af50733 100644 (file)
@@ -4,6 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsDijkstra.hpp"
+#include "src/kernel/routing/NetCard.hpp"
+
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
index 4821b05..b9d098d 100644 (file)
@@ -5,9 +5,10 @@
 
 #include <limits>
 
-#include "xbt/log.h"
 #include "src/kernel/routing/AsFloyd.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
+#include "xbt/log.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 
index 1a116db..eb84b0c 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/routing/AsFull.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
index 80d8442..31b9e01 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
 
index 8dc559f..6e56149 100644 (file)
@@ -10,6 +10,7 @@
 #include "xbt/graph.h"
 
 #include "src/kernel/routing/AsRoutedGraph.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
index 915e807..e048015 100644 (file)
@@ -8,6 +8,7 @@
 #include <simgrid/s4u/host.hpp>
 
 #include "src/kernel/routing/AsVivaldi.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
diff --git a/src/kernel/routing/NetCard.hpp b/src/kernel/routing/NetCard.hpp
new file mode 100644 (file)
index 0000000..7a78c0a
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copyright (c) 2013-2016. 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 KERNEL_ROUTING_NETCARD_HPP_
+#define KERNEL_ROUTING_NETCARD_HPP_
+
+#include <xbt/base.h>
+#include <xbt/signal.hpp>
+
+#include "src/kernel/routing/AsImpl.hpp"
+/*
+#include <float.h>
+#include <vector>
+*/
+namespace simgrid {
+namespace kernel {
+namespace routing {
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
+
+/** @ingroup SURF_routing_interface
+ * @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes.
+ *
+ * @details This represents a position in the network. One can route information between two netcards
+ */
+class NetCard {
+public:
+  enum class Type { Host, Router, As };
+
+  NetCard(std::string name, NetCard::Type componentType, AsImpl* containingAS)
+      : name_(name), componentType_(componentType), containingAS_(containingAS)
+  {
+    if (containingAS != nullptr)
+      id_ = containingAS->addComponent(this);
+    simgrid::kernel::routing::netcardCreatedCallbacks(this);
+  }
+  ~NetCard() = default;
+
+  // Our rank in the vertices_ array of our containing AS.
+  unsigned int id() { return id_; }
+  std::string name() { return name_; }
+  const char* cname() { return name_.c_str(); }
+  // This is the AS in which I am
+  AsImpl* containingAS() { return containingAS_; }
+
+  bool isAS() { return componentType_ == Type::As; }
+  bool isHost() { return componentType_ == Type::Host; }
+  bool isRouter() { return componentType_ == Type::Router; }
+
+private:
+  unsigned int id_;
+  std::string name_;
+  NetCard::Type componentType_;
+  AsImpl* containingAS_;
+};
+}
+}
+}
+
+#endif /* KERNEL_ROUTING_NETCARD_HPP_ */
index 4700b23..435572c 100644 (file)
@@ -9,8 +9,9 @@
 #include <simgrid/s4u/host.hpp>
 #include <simgrid/s4u/As.hpp>
 
-#include "src/surf/surf_routing.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
+#include "src/surf/surf_routing.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_as,"S4U autonomous systems");
 
index 3d8550f..254dba7 100644 (file)
 
 #include <unordered_map>
 
+#include "simgrid/s4u/host.hpp"
+#include "simgrid/s4u/storage.hpp"
 #include "simgrid/simix.hpp"
-#include "src/surf/HostImpl.hpp"
-#include "xbt/log.h"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/msg/msg_private.h"
 #include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.h"
+#include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
-#include "simgrid/s4u/host.hpp"
-#include "simgrid/s4u/storage.hpp"
+#include "xbt/log.h"
 
 XBT_LOG_EXTERNAL_CATEGORY(surf_route);
 
index 77e84c3..70e54c4 100644 (file)
 #include <xbt/Extendable.hpp>
 #include <simgrid/s4u/host.hpp>
 
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/HostImpl.hpp"
-#include "surf/surf.h" // routing_get_network_element_type FIXME:killme
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
 
 extern std::unordered_map<std::string, simgrid::s4u::Host*>
-    host_list; // FIXME: don't dupplicate the content of s4u::Host this way
+    host_list; // FIXME: don't duplicate the content of s4u::Host this way
 
 void sg_host_exit()
 {
index d5b877e..f0ec983 100644 (file)
 #include "ns3/ns3_simulator.h"
 #include "network_ns3.hpp"
 
-#include "src/surf/HostImpl.hpp"
-#include "src/surf/surf_private.h"
 #include "simgrid/sg_config.h"
 #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
+#include "src/kernel/routing/NetCard.hpp"
+#include "src/surf/HostImpl.hpp"
+#include "src/surf/surf_private.h"
 
 #include "simgrid/s4u/As.hpp"
 #include "simgrid/s4u/engine.hpp"
index 58c5190..9b41ea4 100644 (file)
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
 
-#include "src/kernel/routing/AsImpl.hpp"
 #include "src/kernel/routing/AsCluster.hpp"
-#include "src/kernel/routing/AsClusterTorus.hpp"
-#include "src/kernel/routing/AsClusterFatTree.hpp"
 #include "src/kernel/routing/AsClusterDragonfly.hpp"
+#include "src/kernel/routing/AsClusterFatTree.hpp"
+#include "src/kernel/routing/AsClusterTorus.hpp"
 #include "src/kernel/routing/AsDijkstra.hpp"
 #include "src/kernel/routing/AsFloyd.hpp"
 #include "src/kernel/routing/AsFull.hpp"
+#include "src/kernel/routing/AsImpl.hpp"
 #include "src/kernel/routing/AsNone.hpp"
 #include "src/kernel/routing/AsVivaldi.hpp"
+#include "src/kernel/routing/NetCard.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
index d5b6319..3062d0c 100644 (file)
 #include "simgrid/sg_config.h"
 #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "src/internal_config.h"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/simix/smx_host_private.h"
 #include "src/surf/HostImpl.hpp"
 #include "surf_private.h"
-#include "surf_routing.hpp"
 #include <vector>
 
 XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
index 72680dc..6f570ba 100644 (file)
@@ -25,7 +25,6 @@ namespace kernel {
 namespace routing {
 
   XBT_PUBLIC_DATA(simgrid::xbt::signal<void(s4u::As*)>) asCreatedCallbacks;
-  XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
 
 /***********
  * Classes *
@@ -34,45 +33,6 @@ namespace routing {
 class XBT_PRIVATE Onelink;
 class RoutingPlatf;
 
-/** @ingroup SURF_routing_interface
- * @brief Network cards are the vertices in the graph representing the network, used to compute paths between nodes.
- *
- * @details This represents a position in the network. One can route information between two netcards
- */
-class NetCard {
-public:
-  enum class Type {
-    Host, Router, As
-  };
-
-  NetCard(std::string name, NetCard::Type componentType, AsImpl* containingAS)
-      : name_(name), componentType_(componentType), containingAS_(containingAS)
-  {
-    if (containingAS != nullptr)
-      id_ = containingAS->addComponent(this);
-    simgrid::kernel::routing::netcardCreatedCallbacks(this);
-  }
-  ~NetCard() = default;
-
-  // Our rank in the vertices_ array of our containing AS.
-  unsigned int id()      {return id_;}
-  std::string name()     { return name_; }
-  const char* cname()    { return name_.c_str(); }
-  // This is the AS in which I am
-  AsImpl *containingAS() {return containingAS_;}
-
-  bool isAS()            {return componentType_ == Type::As;}
-  bool isHost()          {return componentType_ == Type::Host;}
-  bool isRouter()        {return componentType_ == Type::Router;}
-
-
-private:
-  unsigned int id_;
-  std::string name_;
-  NetCard::Type componentType_;
-  AsImpl *containingAS_;
-};
-
 class AsRoute {
 public:
   explicit AsRoute(NetCard* gwSrc, NetCard* gwDst) : gw_src(gwSrc), gw_dst(gwDst) {}
index d88fef0..259d24a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <simgrid/simdag.h>
 
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/network_interface.hpp"
 
 
index 4e2bc76..2aa9ccf 100644 (file)
@@ -3,11 +3,11 @@
 /* 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 <stdio.h>
+#include "simgrid/s4u/host.hpp"
 #include "simgrid/simdag.h"
+#include "src/kernel/routing/NetCard.hpp"
 #include "src/surf/surf_routing.hpp"
-#include "simgrid/s4u/host.hpp"
-
+#include <stdio.h>
 
 int main(int argc, char **argv)
 {
index 14884e6..7e9dc7c 100644 (file)
@@ -74,6 +74,7 @@ set(EXTRA_DIST
   src/kernel/routing/AsRoutedGraph.hpp
   src/kernel/routing/AsNone.hpp
   src/kernel/routing/AsVivaldi.hpp  
+  src/kernel/routing/NetCard.hpp
 
   src/surf/storage_interface.hpp
   src/surf/storage_n11.hpp