Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stop loading private headers from now public NetZoneImpl.hpp
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Mar 2018 13:47:21 +0000 (14:47 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Mar 2018 14:02:50 +0000 (15:02 +0100)
21 files changed:
include/simgrid/forward.h
include/simgrid/kernel/routing/NetZoneImpl.hpp
src/bindings/lua/lua_platf.cpp
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/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/simix/smx_deployment.cpp
src/surf/network_ns3.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp

index ecf224b..6e8fdd0 100644 (file)
@@ -54,8 +54,11 @@ class Model;
 class Resource;
 }
 namespace routing {
-  class NetPoint;
-  class NetZoneImpl;
+class ClusterCreationArgs;
+class LinkCreationArgs;
+class NetPoint;
+class NetZoneImpl;
+class RouteCreationArgs;
 }
 }
 namespace simix {
index eb79d14..afb2d38 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "simgrid/forward.h"
 #include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
 
 namespace simgrid {
 namespace kernel {
index ebd4cb8..c91e07b 100644 (file)
@@ -63,7 +63,7 @@ int console_close(lua_State *L) {
 }
 
 int console_add_backbone(lua_State *L) {
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties = nullptr;
 
@@ -111,7 +111,7 @@ int console_add_backbone(lua_State *L) {
 }
 
 int console_add_host___link(lua_State *L) {
-  HostLinkCreationArgs hostlink;
+  simgrid::kernel::routing::HostLinkCreationArgs hostlink;
   int type;
 
   lua_ensure(lua_istable(L, -1), "Bad Arguments to create host_link in Lua. Should be a table with named arguments.");
@@ -143,7 +143,7 @@ int console_add_host___link(lua_State *L) {
 }
 
 int console_add_host(lua_State *L) {
-  s_sg_platf_host_cbarg_t host;
+  simgrid::kernel::routing::HostCreationArgs host;
   int type;
 
   // we get values from the table passed as argument
@@ -202,7 +202,7 @@ int console_add_host(lua_State *L) {
 }
 
 int  console_add_link(lua_State *L) {
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   const char* policy;
 
@@ -308,7 +308,7 @@ int console_add_router(lua_State* L) {
 
 int console_add_route(lua_State *L) {
   XBT_DEBUG("Adding route");
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
   int type;
 
   lua_ensure(lua_istable(L, -1), "Bad Arguments to add a route. Should be a table with named arguments");
@@ -379,7 +379,7 @@ int console_add_route(lua_State *L) {
 }
 
 int console_add_ASroute(lua_State *L) {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   lua_pushstring(L, "src");
   lua_gettable(L, -2);
@@ -480,7 +480,7 @@ int console_AS_open(lua_State *L) {
    mode_int = A_surfxml_AS_routing_None;
  else xbt_die("Don't have the model name '%s'",mode);
 
- ZoneCreationArgs AS;
simgrid::kernel::routing::ZoneCreationArgs AS;
  AS.id = id;
  AS.routing = mode_int;
  simgrid::s4u::NetZone* new_as = sg_platf_new_Zone_begin(&AS);
index 58d8a72..aefe976 100644 (file)
@@ -7,6 +7,7 @@
 #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");
 
index 0224455..346cdf7 100644 (file)
@@ -6,6 +6,7 @@
 #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 <cfloat>
 #include <queue>
@@ -22,7 +23,7 @@ static void graph_node_data_free(void* n)
 
 static void graph_edge_data_free(void* e)
 {
-  delete static_cast<RouteCreationArgs*>(e);
+  delete static_cast<simgrid::kernel::routing::RouteCreationArgs*>(e);
 }
 
 /* Utility functions */
@@ -54,7 +55,7 @@ void DijkstraZone::seal()
       }
 
       if (not found) {
-        RouteCreationArgs* e_route = new RouteCreationArgs();
+        RouteCreationArgs* e_route = new simgrid::kernel::routing::RouteCreationArgs();
         e_route->link_list.push_back(surf_network_model->loopback_);
         xbt_graph_new_edge(routeGraph_, node, node, e_route);
       }
@@ -90,7 +91,7 @@ xbt_node_t DijkstraZone::nodeMapSearch(int id)
 
 /* Parsing */
 
-void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route)
+void DijkstraZone::newRoute(int src_id, int dst_id, simgrid::kernel::routing::RouteCreationArgs* e_route)
 {
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = nullptr;
index 438320c..1ca6814 100644 (file)
@@ -6,6 +6,7 @@
 #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>
index ad33b99..3da6df4 100644 (file)
@@ -10,6 +10,8 @@
 #include "simgrid/kernel/routing/FatTreeZone.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>
index 8f14b40..b3aa110 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "xbt/log.h"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <cfloat>
 #include <limits>
index e83fda3..a0af248 100644 (file)
@@ -6,6 +6,7 @@
 #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"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
index f896d7a..3597560 100644 (file)
@@ -9,7 +9,7 @@
 #include "simgrid/s4u/Host.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
-
+#include "src/surf/xml/platf_private.hpp"
 #include "xbt/log.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
index 1e4854a..73df03a 100644 (file)
@@ -7,10 +7,10 @@
 #include "xbt/graph.h"
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
-
 #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"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
index 0e45b81..4a607d8 100644 (file)
@@ -6,6 +6,7 @@
 #include "simgrid/kernel/routing/TorusZone.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>
index bfdcbc2..18b5553 100644 (file)
@@ -8,6 +8,7 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <boost/algorithm/string.hpp>
 
index c9ce06a..e767079 100644 (file)
@@ -117,7 +117,7 @@ simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const char *name)
 void SIMIX_process_set_function(const char* process_host, const char* process_function, xbt_dynar_t arguments,
                                 double process_start_time, double process_kill_time)
 {
-  ActorCreationArgs actor;
+  simgrid::kernel::routing::ActorCreationArgs actor;
 
   sg_host_t host = sg_host_by_name(process_host);
   if (not host)
@@ -139,7 +139,7 @@ void SIMIX_process_set_function(const char* process_host, const char* process_fu
   actor.host       = process_host;
   actor.kill_time  = process_kill_time;
   actor.start_time = process_start_time;
-  actor.on_failure = ActorOnFailure::DIE;
+  actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE;
   sg_platf_new_actor(&actor);
 }
 
index b49a92f..ab86421 100644 (file)
@@ -25,6 +25,7 @@
 #include "simgrid/plugins/energy.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/NetZone.hpp"
+#include "src/surf/xml/platf_private.hpp"
 #include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network NS3 module");
@@ -61,7 +62,7 @@ NetPointNs3::NetPointNs3()
  * Callbacks *
  *************/
 
-static void clusterCreation_cb(ClusterCreationArgs* cluster)
+static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs* cluster)
 {
   for (int const& i : *cluster->radicals) {
     // Routers don't create a router on the other end of the private link by themselves.
index 3ed44de..fb7716b 100644 (file)
@@ -5,16 +5,13 @@
 
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Storage.hpp"
-
 #include "src/kernel/EngineImpl.hpp"
 #include "src/simix/smx_private.hpp"
-
 #include "src/include/simgrid/sg_config.h"
-
 #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 "simgrid/kernel/routing/ClusterZone.hpp"
 #include "simgrid/kernel/routing/DijkstraZone.hpp"
 #include "simgrid/kernel/routing/DragonflyZone.hpp"
@@ -26,7 +23,9 @@
 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/kernel/routing/TorusZone.hpp"
 #include "simgrid/kernel/routing/VivaldiZone.hpp"
+
 #include <string>
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
 XBT_PRIVATE std::map<std::string, simgrid::surf::StorageImpl*> mount_list;
@@ -35,7 +34,7 @@ XBT_PRIVATE std::vector<std::string> known_storages;
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
+simgrid::xbt::signal<void(kernel::routing::ClusterCreationArgs*)> on_cluster;
 }
 }
 
@@ -65,7 +64,7 @@ void sg_platf_exit() {
 }
 
 /** @brief Add an host to the current AS */
-void sg_platf_new_host(sg_platf_host_cbarg_t args)
+void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
 {
   std::map<std::string, std::string> props;
   if (args->properties) {
@@ -112,7 +111,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const
   return netpoint;
 }
 
-void sg_platf_new_link(LinkCreationArgs* link)
+void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link)
 {
   std::vector<std::string> names;
 
@@ -141,7 +140,7 @@ void sg_platf_new_link(LinkCreationArgs* link)
   delete link->properties;
 }
 
-void sg_platf_new_cluster(ClusterCreationArgs* cluster)
+void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster)
 {
   using simgrid::kernel::routing::ClusterZone;
   using simgrid::kernel::routing::DragonflyZone;
@@ -151,16 +150,16 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   int rankId=0;
 
   // What an inventive way of initializing the AS that I have as ancestor :-(
-  ZoneCreationArgs zone;
+  simgrid::kernel::routing::ZoneCreationArgs zone;
   zone.id = cluster->id;
   switch (cluster->topology) {
-    case ClusterTopology::TORUS:
+    case simgrid::kernel::routing::ClusterTopology::TORUS:
       zone.routing = A_surfxml_AS_routing_ClusterTorus;
       break;
-    case ClusterTopology::DRAGONFLY:
+    case simgrid::kernel::routing::ClusterTopology::DRAGONFLY:
       zone.routing = A_surfxml_AS_routing_ClusterDragonfly;
       break;
-    case ClusterTopology::FAT_TREE:
+    case simgrid::kernel::routing::ClusterTopology::FAT_TREE:
       zone.routing = A_surfxml_AS_routing_ClusterFatTree;
       break;
     default:
@@ -187,7 +186,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
 
     XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id.c_str(), cluster->speeds.front());
 
-    s_sg_platf_host_cbarg_t host;
+    simgrid::kernel::routing::HostCreationArgs host;
     host.id = host_id.c_str();
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
       host.properties = new std::map<std::string, std::string>;
@@ -218,7 +217,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       std::string tmp_link = link_id + "_loopback";
       XBT_DEBUG("<loopback\tid=\"%s\"\tbw=\"%f\"/>", tmp_link.c_str(), cluster->loopback_bw);
 
-      LinkCreationArgs link;
+      simgrid::kernel::routing::LinkCreationArgs link;
       link.id        = tmp_link;
       link.bandwidth = cluster->loopback_bw;
       link.latency   = cluster->loopback_lat;
@@ -238,7 +237,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       std::string tmp_link = std::string(link_id) + "_limiter";
       XBT_DEBUG("<limiter\tid=\"%s\"\tbw=\"%f\"/>", tmp_link.c_str(), cluster->limiter_link);
 
-      LinkCreationArgs link;
+      simgrid::kernel::routing::LinkCreationArgs link;
       link.id        = tmp_link;
       link.bandwidth = cluster->limiter_link;
       link.latency = 0;
@@ -250,7 +249,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
     }
 
     //call the cluster function that adds the others links
-    if (cluster->topology == ClusterTopology::FAT_TREE) {
+    if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) {
       static_cast<FatTreeZone*>(current_as)->addProcessingNode(i);
     } else {
       current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId));
@@ -272,7 +271,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   //Make the backbone
   if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) {
 
-    LinkCreationArgs link;
+    simgrid::kernel::routing::LinkCreationArgs link;
     link.id        = std::string(cluster->id)+ "_backbone";
     link.bandwidth = cluster->bb_bw;
     link.latency   = cluster->bb_lat;
@@ -303,25 +302,25 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
   XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname());
 }
 
-void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
+void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet)
 {
   for (int const& radical : *cabinet->radicals) {
     std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
-    s_sg_platf_host_cbarg_t host;
+    simgrid::kernel::routing::HostCreationArgs host;
     host.pstate           = 0;
     host.core_amount      = 1;
     host.id               = hostname.c_str();
     host.speed_per_pstate.push_back(cabinet->speed);
     sg_platf_new_host(&host);
 
-    LinkCreationArgs link;
+    simgrid::kernel::routing::LinkCreationArgs link;
     link.policy    = SURF_LINK_SPLITDUPLEX;
     link.latency   = cabinet->lat;
     link.bandwidth = cabinet->bw;
     link.id        = "link_" + hostname;
     sg_platf_new_link(&link);
 
-    HostLinkCreationArgs host_link;
+    simgrid::kernel::routing::HostLinkCreationArgs host_link;
     host_link.id        = hostname;
     host_link.link_up   = std::string("link_") + hostname + "_UP";
     host_link.link_down = std::string("link_") + hostname + "_DOWN";
@@ -330,7 +329,7 @@ void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
   delete cabinet->radicals;
 }
 
-void sg_platf_new_storage(StorageCreationArgs* storage)
+void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage)
 {
   xbt_assert(std::find(known_storages.begin(), known_storages.end(), storage->id) == known_storages.end(),
              "Refusing to add a second storage named \"%s\"", storage->id.c_str());
@@ -370,7 +369,7 @@ void sg_platf_new_storage(StorageCreationArgs* storage)
   }
 }
 
-void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type)
+void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type)
 {
   xbt_assert(storage_types.find(storage_type->id) == storage_types.end(),
              "Reading a storage type, processing unit \"%s\" already exists", storage_type->id.c_str());
@@ -385,7 +384,7 @@ void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type)
   storage_types[storage_type->id] = stype;
 }
 
-void sg_platf_new_mount(MountCreationArgs* mount)
+void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount)
 {
   xbt_assert(std::find(known_storages.begin(), known_storages.end(), mount->storageId) != known_storages.end(),
              "Cannot mount non-existent disk \"%s\"", mount->storageId.c_str());
@@ -397,19 +396,19 @@ void sg_platf_new_mount(MountCreationArgs* mount)
   mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storageByName(mount->storageId)->getImpl()});
 }
 
-void sg_platf_new_route(RouteCreationArgs* route)
+void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
 {
   routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
                                   route->symmetrical);
 }
 
-void sg_platf_new_bypassRoute(RouteCreationArgs* bypassRoute)
+void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassRoute)
 {
   routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
                                         bypassRoute->link_list, bypassRoute->symmetrical);
 }
 
-void sg_platf_new_actor(ActorCreationArgs* actor)
+void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
 {
   sg_host_t host = sg_host_by_name(actor->host);
   if (not host) {
@@ -435,7 +434,7 @@ void sg_platf_new_actor(ActorCreationArgs* actor)
 
   double start_time = actor->start_time;
   double kill_time  = actor->kill_time;
-  bool auto_restart = actor->on_failure != ActorOnFailure::DIE;
+  bool auto_restart = actor->on_failure != simgrid::kernel::routing::ActorOnFailure::DIE;
 
   std::string actor_name     = actor->args[0];
   std::function<void()> code = factory(std::move(actor->args));
@@ -476,7 +475,7 @@ void sg_platf_new_actor(ActorCreationArgs* actor)
   }
 }
 
-void sg_platf_new_peer(PeerCreationArgs* peer)
+void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
 {
   simgrid::kernel::routing::VivaldiZone* as = dynamic_cast<simgrid::kernel::routing::VivaldiZone*>(current_routing);
   xbt_assert(as, "<peer> tag can only be used in Vivaldi netzones.");
@@ -549,7 +548,7 @@ static void surf_config_models_setup()
  *
  * @param zone the parameters defining the Zone to build.
  */
-simgrid::s4u::NetZone* sg_platf_new_Zone_begin(ZoneCreationArgs* zone)
+simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone)
 {
   if (not surf_parse_models_setup_already_called) {
     /* Initialize the surf models. That must be done after we got all config, and before we need the models.
@@ -640,7 +639,7 @@ void sg_platf_new_Zone_seal()
 }
 
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
-void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink)
+void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
 {
   simgrid::kernel::routing::NetPoint* netpoint = sg_host_by_name(hostlink->id.c_str())->pimpl_netpoint;
   xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
@@ -662,7 +661,7 @@ void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink)
   as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
-void sg_platf_new_trace(TraceCreationArgs* trace)
+void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace)
 {
   tmgr_trace_t tmgr_trace;
   if (not trace->file.empty()) {
index d242419..cc8b5e1 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
+#include "src/surf/xml/platf.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "xbt/utility.hpp"
 #include <cmath> /*ceil*/
index 00c2e12..79a3f27 100644 (file)
@@ -12,6 +12,7 @@
 #include "src/kernel/lmm/maxmin.hpp"   // Constraint
 #include "src/surf/HostImpl.hpp"
 #include "xbt/utility.hpp"
+#include "src/surf/xml/platf.hpp"
 
 #include <fstream>
 #include <set>
index 456a10a..cf233ba 100644 (file)
 #include <string>
 #include <vector>
 
-extern "C" {
-#include "src/surf/xml/simgrid_dtd.h"
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
+namespace simgrid {
+namespace kernel {
+namespace routing {
 /* ***************************************** */
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
@@ -34,7 +29,7 @@ typedef size_t yy_size_t;
  * used, instead of malloced structures.
  */
 
-struct s_sg_platf_host_cbarg_t {
+struct HostCreationArgs {
   const char* id = nullptr;
   std::vector<double> speed_per_pstate;
   int pstate               = 0;
@@ -44,7 +39,7 @@ struct s_sg_platf_host_cbarg_t {
   const char* coord        = nullptr;
   std::map<std::string, std::string>* properties = nullptr;
 };
-typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t;
+typedef HostCreationArgs* sg_platf_host_cbarg_t; // FIXME: killme
 
 class HostLinkCreationArgs {
 public:
@@ -164,7 +159,7 @@ public:
   std::string element;
 };
 
-enum class ActorOnFailure { DIE, RESTART };
+enum class ActorOnFailure { DIE, RESTART }; // FIXME: move to a better namespace
 
 class ActorCreationArgs {
 public:
@@ -182,6 +177,15 @@ public:
   std::string id;
   int routing;
 };
+}}}
+
+extern "C" {
+#include "src/surf/xml/simgrid_dtd.h"
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
 
 /********** Routing **********/
 void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb);
@@ -190,29 +194,29 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb);
 XBT_PUBLIC void sg_platf_begin(); // Start a new platform
 XBT_PUBLIC void sg_platf_end();   // Finish the creation of the platform
 
-XBT_PUBLIC simgrid::s4u::NetZone* sg_platf_new_Zone_begin(ZoneCreationArgs* zone); // Begin description of new Zone
+XBT_PUBLIC simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone); // Begin description of new Zone
 XBT_PUBLIC void sg_platf_new_Zone_seal();                                          // That Zone is fully described
 
-XBT_PUBLIC void sg_platf_new_host(sg_platf_host_cbarg_t host);      // Add a host      to the current Zone
-XBT_PUBLIC void sg_platf_new_hostlink(HostLinkCreationArgs* h);     // Add a host_link to the current Zone
-XBT_PUBLIC void sg_platf_new_link(LinkCreationArgs* link);          // Add a link      to the current Zone
-XBT_PUBLIC void sg_platf_new_peer(PeerCreationArgs* peer);          // Add a peer      to the current Zone
-XBT_PUBLIC void sg_platf_new_cluster(ClusterCreationArgs* clust);   // Add a cluster   to the current Zone
-XBT_PUBLIC void sg_platf_new_cabinet(CabinetCreationArgs* cabinet); // Add a cabinet   to the current Zone
+XBT_PUBLIC void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* host);      // Add a host      to the current Zone
+XBT_PUBLIC void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* h);     // Add a host_link to the current Zone
+XBT_PUBLIC void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link);          // Add a link      to the current Zone
+XBT_PUBLIC void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer);          // Add a peer      to the current Zone
+XBT_PUBLIC void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* clust);   // Add a cluster   to the current Zone
+XBT_PUBLIC void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet); // Add a cabinet   to the current Zone
 XBT_PUBLIC simgrid::kernel::routing::NetPoint*                      // Add a router    to the current Zone
     sg_platf_new_router(std::string, const char* coords);
 
-XBT_PUBLIC void sg_platf_new_route(RouteCreationArgs* route);             // Add a route
-XBT_PUBLIC void sg_platf_new_bypassRoute(RouteCreationArgs* bypassroute); // Add a bypassRoute
+XBT_PUBLIC void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route);             // Add a route
+XBT_PUBLIC void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassroute); // Add a bypassRoute
 
-XBT_PUBLIC void sg_platf_new_trace(TraceCreationArgs* trace);
+XBT_PUBLIC void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace);
 
-XBT_PUBLIC void sg_platf_new_storage(StorageCreationArgs* storage); // Add a storage to the current Zone
-XBT_PUBLIC void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type);
-XBT_PUBLIC void sg_platf_new_mount(MountCreationArgs* mount);
+XBT_PUBLIC void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage); // Add a storage to the current Zone
+XBT_PUBLIC void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type);
+XBT_PUBLIC void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount);
 
-XBT_PUBLIC void sg_platf_new_actor(ActorCreationArgs* actor);
-XBT_PRIVATE void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect);
+XBT_PUBLIC void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor);
+XBT_PRIVATE void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect);
 
 /* Prototypes of the functions offered by flex */
 XBT_PUBLIC int surf_parse_lex();
@@ -232,7 +236,7 @@ XBT_PUBLIC int surf_parse_lex_destroy();
 namespace simgrid {
 namespace surf {
 
-extern XBT_PRIVATE simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
+extern XBT_PRIVATE simgrid::xbt::signal<void(kernel::routing::ClusterCreationArgs*)> on_cluster;
 }
 }
 
index ddcc677..de90f8d 100644 (file)
@@ -34,26 +34,26 @@ XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link
 XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
 
 extern "C" {
-void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect)
+void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
 {
   xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
              "Cannot connect trace %s to %s: trace unknown", trace_connect->trace.c_str(),
              trace_connect->element.c_str());
 
   switch (trace_connect->kind) {
-    case TraceConnectKind::HOST_AVAIL:
+    case simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL:
       trace_connect_list_host_avail.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::SPEED:
+    case simgrid::kernel::routing::TraceConnectKind::SPEED:
       trace_connect_list_host_speed.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::LINK_AVAIL:
+    case simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL:
       trace_connect_list_link_avail.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::BANDWIDTH:
+    case simgrid::kernel::routing::TraceConnectKind::BANDWIDTH:
       trace_connect_list_link_bw.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::LATENCY:
+    case simgrid::kernel::routing::TraceConnectKind::LATENCY:
       trace_connect_list_link_lat.insert({trace_connect->trace, trace_connect->element});
       break;
     default:
index aa22f1c..7a9d017 100644 (file)
@@ -284,7 +284,7 @@ void STag_surfxml_storage()
 
 void ETag_surfxml_storage()
 {
-  StorageCreationArgs storage;
+  simgrid::kernel::routing::StorageCreationArgs storage;
 
   storage.properties   = current_property_set;
   current_property_set = nullptr;
@@ -305,7 +305,7 @@ void STag_surfxml_storage___type()
 }
 void ETag_surfxml_storage___type()
 {
-  StorageTypeCreationArgs storage_type;
+  simgrid::kernel::routing::StorageTypeCreationArgs storage_type;
 
   storage_type.properties = current_property_set;
   current_property_set    = nullptr;
@@ -328,7 +328,7 @@ void STag_surfxml_mount()
 
 void ETag_surfxml_mount()
 {
-  MountCreationArgs mount;
+  simgrid::kernel::routing::MountCreationArgs mount;
 
   mount.name      = A_surfxml_mount_name;
   mount.storageId = A_surfxml_mount_storageId;
@@ -421,7 +421,7 @@ void STag_surfxml_prop()
 }
 
 void ETag_surfxml_host()    {
-  s_sg_platf_host_cbarg_t host;
+  simgrid::kernel::routing::HostCreationArgs host;
 
   host.properties = current_property_set;
   current_property_set = nullptr;
@@ -442,7 +442,7 @@ void ETag_surfxml_host()    {
 
 void STag_surfxml_host___link(){
   XBT_DEBUG("Create a Host_link for %s",A_surfxml_host___link_id);
-  HostLinkCreationArgs host_link;
+  simgrid::kernel::routing::HostLinkCreationArgs host_link;
 
   host_link.id        = A_surfxml_host___link_id;
   host_link.link_up   = A_surfxml_host___link_up;
@@ -455,7 +455,7 @@ void STag_surfxml_router(){
 }
 
 void ETag_surfxml_cluster(){
-  ClusterCreationArgs cluster;
+  simgrid::kernel::routing::ClusterCreationArgs cluster;
   cluster.properties   = current_property_set;
   current_property_set = nullptr;
 
@@ -480,16 +480,16 @@ void ETag_surfxml_cluster(){
 
   switch(AX_surfxml_cluster_topology){
   case A_surfxml_cluster_topology_FLAT:
-    cluster.topology = ClusterTopology::FLAT;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::FLAT;
     break;
   case A_surfxml_cluster_topology_TORUS:
-    cluster.topology = ClusterTopology::TORUS;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::TORUS;
     break;
   case A_surfxml_cluster_topology_FAT___TREE:
-    cluster.topology = ClusterTopology::FAT_TREE;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::FAT_TREE;
     break;
   case A_surfxml_cluster_topology_DRAGONFLY:
-    cluster.topology = ClusterTopology::DRAGONFLY;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::DRAGONFLY;
     break;
   default:
     surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id);
@@ -539,7 +539,7 @@ void STag_surfxml_cluster(){
 
 void STag_surfxml_cabinet(){
   parse_after_config();
-  CabinetCreationArgs cabinet;
+  simgrid::kernel::routing::CabinetCreationArgs cabinet;
   cabinet.id      = A_surfxml_cabinet_id;
   cabinet.prefix  = A_surfxml_cabinet_prefix;
   cabinet.suffix  = A_surfxml_cabinet_suffix;
@@ -553,7 +553,7 @@ void STag_surfxml_cabinet(){
 
 void STag_surfxml_peer(){
   parse_after_config();
-  PeerCreationArgs peer;
+  simgrid::kernel::routing::PeerCreationArgs peer;
 
   peer.id          = std::string(A_surfxml_peer_id);
   peer.speed       = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id.c_str());
@@ -576,7 +576,7 @@ void STag_surfxml_link(){
 }
 
 void ETag_surfxml_link(){
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties          = current_property_set;
   current_property_set     = nullptr;
@@ -645,7 +645,7 @@ void STag_surfxml_link___ctn()
 }
 
 void ETag_surfxml_backbone(){
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties = nullptr;
   link.id = std::string(A_surfxml_backbone_id);
@@ -695,7 +695,7 @@ void STag_surfxml_bypassZoneRoute(){
 }
 
 void ETag_surfxml_route(){
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
 
   route.src         = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag
   route.dst         = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag
@@ -719,7 +719,7 @@ void ETag_surfxml_ASroute()
 }
 void ETag_surfxml_zoneRoute()
 {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag
   ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag
@@ -745,7 +745,7 @@ void ETag_surfxml_zoneRoute()
 }
 
 void ETag_surfxml_bypassRoute(){
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
 
   route.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag
   route.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag
@@ -768,7 +768,7 @@ void ETag_surfxml_bypassASroute()
 }
 void ETag_surfxml_bypassZoneRoute()
 {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   ASroute.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src);
   ASroute.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst);
@@ -783,7 +783,7 @@ void ETag_surfxml_bypassZoneRoute()
 }
 
 void ETag_surfxml_trace(){
-  TraceCreationArgs trace;
+  simgrid::kernel::routing::TraceCreationArgs trace;
 
   trace.id = A_surfxml_trace_id;
   trace.file = A_surfxml_trace_file;
@@ -796,7 +796,7 @@ void ETag_surfxml_trace(){
 void STag_surfxml_trace___connect()
 {
   parse_after_config();
-  TraceConnectCreationArgs trace_connect;
+  simgrid::kernel::routing::TraceConnectCreationArgs trace_connect;
 
   trace_connect.element = A_surfxml_trace___connect_element;
   trace_connect.trace = A_surfxml_trace___connect_trace;
@@ -804,19 +804,19 @@ void STag_surfxml_trace___connect()
   switch (A_surfxml_trace___connect_kind) {
   case AU_surfxml_trace___connect_kind:
   case A_surfxml_trace___connect_kind_SPEED:
-    trace_connect.kind = TraceConnectKind::SPEED;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::SPEED;
     break;
   case A_surfxml_trace___connect_kind_BANDWIDTH:
-    trace_connect.kind = TraceConnectKind::BANDWIDTH;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::BANDWIDTH;
     break;
   case A_surfxml_trace___connect_kind_HOST___AVAIL:
-    trace_connect.kind = TraceConnectKind::HOST_AVAIL;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL;
     break;
   case A_surfxml_trace___connect_kind_LATENCY:
-    trace_connect.kind = TraceConnectKind::LATENCY;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LATENCY;
     break;
   case A_surfxml_trace___connect_kind_LINK___AVAIL:
-    trace_connect.kind = TraceConnectKind::LINK_AVAIL;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL;
     break;
   default:
     surf_parse_error("Invalid trace kind");
@@ -841,7 +841,7 @@ void STag_surfxml_zone()
 {
   parse_after_config();
   ZONE_TAG                 = 1;
-  ZoneCreationArgs zone;
+  simgrid::kernel::routing::ZoneCreationArgs zone;
   zone.id      = A_surfxml_zone_id;
   zone.routing = static_cast<int>(A_surfxml_zone_routing);
 
@@ -907,7 +907,7 @@ void ETag_surfxml_process()
 
 void ETag_surfxml_actor()
 {
-  ActorCreationArgs actor;
+  simgrid::kernel::routing::ActorCreationArgs actor;
 
   actor.properties     = current_property_set;
   current_property_set = nullptr;
@@ -921,10 +921,10 @@ void ETag_surfxml_actor()
   switch (A_surfxml_actor_on___failure) {
   case AU_surfxml_actor_on___failure:
   case A_surfxml_actor_on___failure_DIE:
-    actor.on_failure = ActorOnFailure::DIE;
+    actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE;
     break;
   case A_surfxml_actor_on___failure_RESTART:
-    actor.on_failure = ActorOnFailure::RESTART;
+    actor.on_failure = simgrid::kernel::routing::ActorOnFailure::RESTART;
     break;
   default:
     surf_parse_error("Invalid on failure behavior");