Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
AS->Zone + stringification
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Aug 2017 08:56:36 +0000 (10:56 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Aug 2017 08:57:52 +0000 (10:57 +0200)
28 files changed:
include/simgrid/s4u/NetZone.hpp
src/bindings/lua/lua_platf.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/ClusterZone.hpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DijkstraZone.hpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/DragonflyZone.hpp
src/kernel/routing/EmptyZone.cpp
src/kernel/routing/EmptyZone.hpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FatTreeZone.hpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FloydZone.hpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/FullZone.hpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/NetZoneImpl.hpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/RoutedZone.hpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/TorusZone.hpp
src/kernel/routing/VivaldiZone.cpp
src/kernel/routing/VivaldiZone.hpp
src/s4u/s4u_netzone.cpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index fa5ca04..0f50b37 100644 (file)
@@ -38,13 +38,13 @@ XBT_PUBLIC_CLASS NetZone
 protected:
   friend simgrid::kernel::routing::NetZoneImpl;
 
 protected:
   friend simgrid::kernel::routing::NetZoneImpl;
 
-  explicit NetZone(NetZone * father, const char* name);
+  explicit NetZone(NetZone * father, std::string name);
   virtual ~NetZone();
 
 public:
   /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */
   virtual void seal();
   virtual ~NetZone();
 
 public:
   /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */
   virtual void seal();
-  char* getCname();
+  const char* getCname();
   NetZone* getFather();
 
   std::vector<NetZone*>* getChildren();             // Sub netzones
   NetZone* getFather();
 
   std::vector<NetZone*>* getChildren();             // Sub netzones
@@ -80,7 +80,7 @@ private:
 
   std::unordered_map<std::string, std::string> properties_;
   NetZone* father_ = nullptr;
 
   std::unordered_map<std::string, std::string> properties_;
   NetZone* father_ = nullptr;
-  char* name_      = nullptr;
+  std::string name_;
 
   bool sealed_ = false; // We cannot add more content when sealed
 
 
   bool sealed_ = false; // We cannot add more content when sealed
 
index a079d4c..a4b8fac 100644 (file)
@@ -501,7 +501,7 @@ int console_AS_open(lua_State *L) {
 }
 int console_AS_seal(lua_State *L) {
   XBT_DEBUG("Sealing AS");
 }
 int console_AS_seal(lua_State *L) {
   XBT_DEBUG("Sealing AS");
-  sg_platf_new_AS_seal();
+  sg_platf_new_Zone_seal();
   return 0;
 }
 
   return 0;
 }
 
index 9467b8d..4cf5cb9 100644 (file)
@@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 namespace simgrid {
 namespace kernel {
 namespace routing {
 namespace simgrid {
 namespace kernel {
 namespace routing {
-ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
+ClusterZone::ClusterZone(NetZone* father, std::string name) : NetZoneImpl(father, name)
 {
 }
 
 {
 }
 
index 7a347a8..13e6aab 100644 (file)
@@ -67,7 +67,7 @@ namespace routing {
 
 class XBT_PRIVATE ClusterZone : public NetZoneImpl {
 public:
 
 class XBT_PRIVATE ClusterZone : public NetZoneImpl {
 public:
-  explicit ClusterZone(NetZone* father, const char* name);
+  explicit ClusterZone(NetZone* father, std::string name);
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
index b5c5313..a76b617 100644 (file)
@@ -307,7 +307,7 @@ DijkstraZone::~DijkstraZone()
 
 /* Creation routing model functions */
 
 
 /* Creation routing model functions */
 
-DijkstraZone::DijkstraZone(NetZone* father, const char* name, bool cached) : RoutedZone(father, name)
+DijkstraZone::DijkstraZone(NetZone* father, std::string name, bool cached) : RoutedZone(father, name)
 {
   if (cached)
     routeCache_ = xbt_dict_new_homogeneous(&route_cache_elem_free);
 {
   if (cached)
     routeCache_ = xbt_dict_new_homogeneous(&route_cache_elem_free);
index 2e089ed..29e8b90 100644 (file)
@@ -43,7 +43,7 @@ namespace routing {
  */
 class XBT_PRIVATE DijkstraZone : public RoutedZone {
 public:
  */
 class XBT_PRIVATE DijkstraZone : public RoutedZone {
 public:
-  DijkstraZone(NetZone* father, const char* name, bool cached);
+  DijkstraZone(NetZone* father, std::string name, bool cached);
   void seal() override;
 
   ~DijkstraZone() override;
   void seal() override;
 
   ~DijkstraZone() override;
index ffcce12..89a3124 100644 (file)
@@ -17,7 +17,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
 namespace kernel {
 namespace routing {
 
-DragonflyZone::DragonflyZone(NetZone* father, const char* name) : ClusterZone(father, name)
+DragonflyZone::DragonflyZone(NetZone* father, std::string name) : ClusterZone(father, name)
 {
 }
 
 {
 }
 
index b974803..760eac3 100644 (file)
@@ -60,7 +60,7 @@ public:
  */
 class XBT_PRIVATE DragonflyZone : public ClusterZone {
 public:
  */
 class XBT_PRIVATE DragonflyZone : public ClusterZone {
 public:
-  explicit DragonflyZone(NetZone* father, const char* name);
+  explicit DragonflyZone(NetZone* father, std::string name);
   ~DragonflyZone() override;
   //      void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   ~DragonflyZone() override;
   //      void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
index 732cab8..3ef2736 100644 (file)
@@ -15,7 +15,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
 namespace kernel {
 namespace routing {
 
-EmptyZone::EmptyZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
+EmptyZone::EmptyZone(NetZone* father, std::string name) : NetZoneImpl(father, name)
 {
 }
 
 {
 }
 
index a63d75f..888d744 100644 (file)
@@ -21,7 +21,7 @@ namespace routing {
 
 class XBT_PRIVATE EmptyZone : public NetZoneImpl {
 public:
 
 class XBT_PRIVATE EmptyZone : public NetZoneImpl {
 public:
-  explicit EmptyZone(NetZone* father, const char* name);
+  explicit EmptyZone(NetZone* father, std::string name);
   ~EmptyZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override
   ~EmptyZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override
index c1f8445..9e3cdbc 100644 (file)
@@ -20,7 +20,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
 namespace kernel {
 namespace routing {
 
-FatTreeZone::FatTreeZone(NetZone* father, const char* name) : ClusterZone(father, name)
+FatTreeZone::FatTreeZone(NetZone* father, std::string name) : ClusterZone(father, name)
 {
   XBT_DEBUG("Creating a new fat tree.");
 }
 {
   XBT_DEBUG("Creating a new fat tree.");
 }
index 40b439a..e24867f 100644 (file)
@@ -98,7 +98,7 @@ public:
  */
 class XBT_PRIVATE FatTreeZone : public ClusterZone {
 public:
  */
 class XBT_PRIVATE FatTreeZone : public ClusterZone {
 public:
-  explicit FatTreeZone(NetZone* father, const char* name);
+  explicit FatTreeZone(NetZone* father, std::string name);
   ~FatTreeZone() override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
 
   ~FatTreeZone() override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
 
index 863c876..329eff9 100644 (file)
@@ -21,7 +21,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
 namespace kernel {
 namespace routing {
 
-FloydZone::FloydZone(NetZone* father, const char* name) : RoutedZone(father, name)
+FloydZone::FloydZone(NetZone* father, std::string name) : RoutedZone(father, name)
 {
   predecessorTable_ = nullptr;
   costTable_        = nullptr;
 {
   predecessorTable_ = nullptr;
   costTable_        = nullptr;
index f1cb156..a612425 100644 (file)
@@ -23,7 +23,7 @@ namespace routing {
  */
 class XBT_PRIVATE FloydZone : public RoutedZone {
 public:
  */
 class XBT_PRIVATE FloydZone : public RoutedZone {
 public:
-  explicit FloydZone(NetZone* father, const char* name);
+  explicit FloydZone(NetZone* father, std::string name);
   ~FloydZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   ~FloydZone() override;
 
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
index 9bae539..dbb5a80 100644 (file)
@@ -14,7 +14,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 namespace simgrid {
 namespace kernel {
 namespace routing {
 namespace simgrid {
 namespace kernel {
 namespace routing {
-FullZone::FullZone(NetZone* father, const char* name) : RoutedZone(father, name)
+FullZone::FullZone(NetZone* father, std::string name) : RoutedZone(father, name)
 {
 }
 
 {
 }
 
index f13764f..ab13bc5 100644 (file)
@@ -15,13 +15,12 @@ namespace routing {
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing provided by the user
  *
 /** @ingroup ROUTING_API
  *  @brief NetZone with an explicit routing provided by the user
  *
- *  The full communication matrix is provided at creation, so this model
- *  has the highest expressive power and the lowest computational requirements,
- *  but also the highest memory requirements (both in platform file and in memory).
+ *  The full communication matrix is provided at creation, so this model has the highest expressive power and the lowest
+ *  computational requirements, but also the highest memory requirements (both in platform file and in memory).
  */
 class XBT_PRIVATE FullZone : public RoutedZone {
 public:
  */
 class XBT_PRIVATE FullZone : public RoutedZone {
 public:
-  explicit FullZone(NetZone* father, const char* name);
+  explicit FullZone(NetZone* father, std::string name);
   void seal() override;
   ~FullZone() override;
 
   void seal() override;
   ~FullZone() override;
 
index b26cf09..e128d57 100644 (file)
@@ -26,14 +26,15 @@ public:
   std::vector<surf::LinkImpl*> links;
 };
 
   std::vector<surf::LinkImpl*> links;
 };
 
-NetZoneImpl::NetZoneImpl(NetZone* father, const char* name) : NetZone(father, name)
+NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, name)
 {
 {
-  xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
-             "Refusing to create a second NetZone called '%s'.", name);
+  xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name.c_str()),
+             "Refusing to create a second NetZone called '%s'.", name.c_str());
 
   netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast<NetZoneImpl*>(father));
 
   netpoint_ = new NetPoint(name, NetPoint::Type::NetZone, static_cast<NetZoneImpl*>(father));
-  XBT_DEBUG("NetZone '%s' created with the id '%u'", name, netpoint_->id());
+  XBT_DEBUG("NetZone '%s' created with the id '%u'", name.c_str(), netpoint_->id());
 }
 }
+
 NetZoneImpl::~NetZoneImpl()
 {
   for (auto& kv : bypassRoutes_)
 NetZoneImpl::~NetZoneImpl()
 {
   for (auto& kv : bypassRoutes_)
index e4a297c..98296b5 100644 (file)
@@ -53,7 +53,7 @@ XBT_PUBLIC_CLASS NetZoneImpl : public s4u::NetZone
   friend simgrid::kernel::EngineImpl; // it destroys netRoot_
 
 protected:
   friend simgrid::kernel::EngineImpl; // it destroys netRoot_
 
 protected:
-  explicit NetZoneImpl(NetZone * father, const char* name);
+  explicit NetZoneImpl(NetZone * father, std::string name);
   virtual ~NetZoneImpl();
 
 public:
   virtual ~NetZoneImpl();
 
 public:
index 2647781..cd223f1 100644 (file)
@@ -65,7 +65,7 @@ namespace simgrid {
 namespace kernel {
 namespace routing {
 
 namespace kernel {
 namespace routing {
 
-RoutedZone::RoutedZone(NetZone* father, const char* name) : NetZoneImpl(father, name)
+RoutedZone::RoutedZone(NetZone* father, std::string name) : NetZoneImpl(father, name)
 {
 }
 
 {
 }
 
index 25be9b4..3904232 100644 (file)
@@ -50,7 +50,7 @@ namespace routing {
 
 class XBT_PRIVATE RoutedZone : public NetZoneImpl {
 public:
 
 class XBT_PRIVATE RoutedZone : public NetZoneImpl {
 public:
-  explicit RoutedZone(NetZone* father, const char* name);
+  explicit RoutedZone(NetZone* father, std::string name);
 
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
   virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
 
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override;
   virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg,
index a369c14..e5c6ce7 100644 (file)
@@ -27,7 +27,7 @@ inline void rankId_to_coords(int rankId, std::vector<unsigned int> dimensions, u
 namespace simgrid {
 namespace kernel {
 namespace routing {
 namespace simgrid {
 namespace kernel {
 namespace routing {
-TorusZone::TorusZone(NetZone* father, const char* name) : ClusterZone(father, name)
+TorusZone::TorusZone(NetZone* father, std::string name) : ClusterZone(father, name)
 {
 }
 
 {
 }
 
index bf0c845..2b76f78 100644 (file)
@@ -20,7 +20,7 @@ namespace routing {
 
 class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
 
 class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
-  explicit TorusZone(NetZone* father, const char* name);
+  explicit TorusZone(NetZone* father, std::string name);
   void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
   void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
   void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
index 80c785f..9901722 100644 (file)
@@ -57,7 +57,8 @@ static std::vector<double>* getCoordsFromNetpoint(NetPoint* np)
              (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->cname(), np);
   return &coords->coords;
 }
              (np->isNetZone() ? "Netzone" : (np->isHost() ? "Host" : "Router")), np->cname(), np);
   return &coords->coords;
 }
-VivaldiZone::VivaldiZone(NetZone* father, const char* name) : ClusterZone(father, name)
+
+VivaldiZone::VivaldiZone(NetZone* father, std::string name) : ClusterZone(father, name)
 {
 }
 
 {
 }
 
index 83fc6b2..64ea9bd 100644 (file)
@@ -45,7 +45,7 @@ namespace routing {
 
 class XBT_PRIVATE VivaldiZone : public ClusterZone {
 public:
 
 class XBT_PRIVATE VivaldiZone : public ClusterZone {
 public:
-  explicit VivaldiZone(NetZone* father, const char* name);
+  explicit VivaldiZone(NetZone* father, std::string name);
 
   void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
 
   void setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) override;
index 33dbf91..1490c8f 100644 (file)
@@ -23,7 +23,7 @@ simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kern
 simgrid::xbt::signal<void(NetZone&)> NetZone::onCreation;
 simgrid::xbt::signal<void(NetZone&)> NetZone::onSeal;
 
 simgrid::xbt::signal<void(NetZone&)> NetZone::onCreation;
 simgrid::xbt::signal<void(NetZone&)> NetZone::onSeal;
 
-NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
+NetZone::NetZone(NetZone* father, std::string name) : father_(father), name_(name)
 {
   children_ = new std::vector<NetZone*>();
 }
 {
   children_ = new std::vector<NetZone*>();
 }
@@ -38,7 +38,6 @@ NetZone::~NetZone()
   for (auto nz : *children_)
     delete nz;
   delete children_;
   for (auto nz : *children_)
     delete nz;
   delete children_;
-  xbt_free(name_);
 }
 
 std::unordered_map<std::string, std::string>* NetZone::getProperties()
 }
 
 std::unordered_map<std::string, std::string>* NetZone::getProperties()
@@ -64,9 +63,9 @@ std::vector<NetZone*>* NetZone::getChildren()
 {
   return children_;
 }
 {
   return children_;
 }
-char* NetZone::getCname()
+const char* NetZone::getCname()
 {
 {
-  return name_;
+  return name_.c_str();
 }
 NetZone* NetZone::getFather()
 {
 }
 NetZone* NetZone::getFather()
 {
@@ -90,7 +89,7 @@ int NetZone::addComponent(kernel::routing::NetPoint* elm)
 
 void NetZone::addRoute(sg_platf_route_cbarg_t /*route*/)
 {
 
 void NetZone::addRoute(sg_platf_route_cbarg_t /*route*/)
 {
-  xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_);
+  xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
 }
 }
 }; // namespace simgrid::s4u
 }
 }
 }; // namespace simgrid::s4u
index abb66df..4801306 100644 (file)
@@ -159,23 +159,23 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   int rankId=0;
 
   // What an inventive way of initializing the AS that I have as ancestor :-(
   int rankId=0;
 
   // What an inventive way of initializing the AS that I have as ancestor :-(
-  s_sg_platf_AS_cbarg_t AS;
-  AS.id = cluster->id;
+  ZoneCreationArgs zone;
+  zone.id = cluster->id;
   switch (cluster->topology) {
   case SURF_CLUSTER_TORUS:
   switch (cluster->topology) {
   case SURF_CLUSTER_TORUS:
-    AS.routing = A_surfxml_AS_routing_ClusterTorus;
+    zone.routing = A_surfxml_AS_routing_ClusterTorus;
     break;
   case SURF_CLUSTER_DRAGONFLY:
     break;
   case SURF_CLUSTER_DRAGONFLY:
-    AS.routing = A_surfxml_AS_routing_ClusterDragonfly;
+    zone.routing = A_surfxml_AS_routing_ClusterDragonfly;
     break;
   case SURF_CLUSTER_FAT_TREE:
     break;
   case SURF_CLUSTER_FAT_TREE:
-    AS.routing = A_surfxml_AS_routing_ClusterFatTree;
+    zone.routing = A_surfxml_AS_routing_ClusterFatTree;
     break;
   default:
     break;
   default:
-    AS.routing = A_surfxml_AS_routing_Cluster;
+    zone.routing = A_surfxml_AS_routing_Cluster;
     break;
   }
     break;
   }
-  sg_platf_new_AS_begin(&AS);
+  sg_platf_new_Zone_begin(&zone);
   simgrid::kernel::routing::ClusterZone* current_as = static_cast<ClusterZone*>(routing_get_current());
   current_as->parse_specific_arguments(cluster);
 
   simgrid::kernel::routing::ClusterZone* current_as = static_cast<ClusterZone*>(routing_get_current());
   current_as->parse_specific_arguments(cluster);
 
@@ -296,7 +296,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   }
 
   XBT_DEBUG("</AS>");
   }
 
   XBT_DEBUG("</AS>");
-  sg_platf_new_AS_seal();
+  sg_platf_new_Zone_seal();
 
   simgrid::surf::on_cluster(cluster);
   delete cluster->radicals;
 
   simgrid::surf::on_cluster(cluster);
   delete cluster->radicals;
@@ -564,18 +564,16 @@ static void surf_config_models_setup()
 }
 
 /**
 }
 
 /**
- * \brief Add an AS to the platform
+ * \brief Add a Zone to the platform
  *
  *
- * Add a new autonomous system to the platform. Any elements (such as host,
- * router or sub-AS) added after this call and before the corresponding call
- * to sg_platf_new_AS_seal() will be added to this AS.
+ * Add a new autonomous system to the platform. Any elements (such as host, router or sub-Zone) added after this call
+ * and before the corresponding call to sg_platf_new_Zone_seal() will be added to this Zone.
  *
  *
- * Once this function was called, the configuration concerning the used
- * models cannot be changed anymore.
+ * Once this function was called, the configuration concerning the used models cannot be changed anymore.
  *
  *
- * @param AS the parameters defining the AS to build.
+ * @param zone the parameters defining the Zone to build.
  */
  */
-simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
+simgrid::s4u::NetZone* sg_platf_new_Zone_begin(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.
 {
   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.
@@ -593,37 +591,37 @@ simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
                             * any further config now that we created some real content */
 
   /* search the routing model */
                             * any further config now that we created some real content */
 
   /* search the routing model */
-  simgrid::kernel::routing::NetZoneImpl* new_as = nullptr;
-  switch(AS->routing){
+  simgrid::kernel::routing::NetZoneImpl* new_zone = nullptr;
+  switch (zone->routing) {
     case A_surfxml_AS_routing_Cluster:
     case A_surfxml_AS_routing_Cluster:
-      new_as = new simgrid::kernel::routing::ClusterZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_ClusterDragonfly:
       break;
     case A_surfxml_AS_routing_ClusterDragonfly:
-      new_as = new simgrid::kernel::routing::DragonflyZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_ClusterTorus:
       break;
     case A_surfxml_AS_routing_ClusterTorus:
-      new_as = new simgrid::kernel::routing::TorusZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_ClusterFatTree:
       break;
     case A_surfxml_AS_routing_ClusterFatTree:
-      new_as = new simgrid::kernel::routing::FatTreeZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_Dijkstra:
       break;
     case A_surfxml_AS_routing_Dijkstra:
-      new_as = new simgrid::kernel::routing::DijkstraZone(current_routing, AS->id, 0);
+      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, 0);
       break;
     case A_surfxml_AS_routing_DijkstraCache:
       break;
     case A_surfxml_AS_routing_DijkstraCache:
-      new_as = new simgrid::kernel::routing::DijkstraZone(current_routing, AS->id, 1);
+      new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, 1);
       break;
     case A_surfxml_AS_routing_Floyd:
       break;
     case A_surfxml_AS_routing_Floyd:
-      new_as = new simgrid::kernel::routing::FloydZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_Full:
       break;
     case A_surfxml_AS_routing_Full:
-      new_as = new simgrid::kernel::routing::FullZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_None:
       break;
     case A_surfxml_AS_routing_None:
-      new_as = new simgrid::kernel::routing::EmptyZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id);
       break;
     case A_surfxml_AS_routing_Vivaldi:
       break;
     case A_surfxml_AS_routing_Vivaldi:
-      new_as = new simgrid::kernel::routing::VivaldiZone(current_routing, AS->id);
+      new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id);
       break;
     default:
       xbt_die("Not a valid model!");
       break;
     default:
       xbt_die("Not a valid model!");
@@ -633,22 +631,22 @@ simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
   if (current_routing == nullptr) { /* it is the first one */
     xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
                "All defined components must belong to a networking zone.");
   if (current_routing == nullptr) { /* it is the first one */
     xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
                "All defined components must belong to a networking zone.");
-    simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_as;
+    simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_zone;
 
   } else {
     /* set the father behavior */
     if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
       current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
     /* add to the sons dictionary */
 
   } else {
     /* set the father behavior */
     if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
       current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
     /* add to the sons dictionary */
-    current_routing->getChildren()->push_back(static_cast<simgrid::s4u::NetZone*>(new_as));
+    current_routing->getChildren()->push_back(static_cast<simgrid::s4u::NetZone*>(new_zone));
   }
 
   /* set the new current component of the tree */
   }
 
   /* set the new current component of the tree */
-  current_routing = new_as;
+  current_routing = new_zone;
 
 
-  simgrid::s4u::NetZone::onCreation(*new_as); // notify the signal
+  simgrid::s4u::NetZone::onCreation(*new_zone); // notify the signal
 
 
-  return new_as;
+  return new_zone;
 }
 
 /**
 }
 
 /**
@@ -657,7 +655,7 @@ simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
  * Once you've declared all the content of your AS, you have to seal
  * it with this call. Your AS is not usable until you call this function.
  */
  * Once you've declared all the content of your AS, you have to seal
  * it with this call. Your AS is not usable until you call this function.
  */
-void sg_platf_new_AS_seal()
+void sg_platf_new_Zone_seal()
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->seal();
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->seal();
index 384bae6..c977169 100644 (file)
@@ -185,11 +185,11 @@ typedef struct s_sg_platf_process_cbarg {
   e_surf_process_on_failure_t on_failure;
 } s_sg_platf_process_cbarg_t;
 
   e_surf_process_on_failure_t on_failure;
 } s_sg_platf_process_cbarg_t;
 
-typedef struct s_sg_platf_AS_cbarg *sg_platf_AS_cbarg_t;
-typedef struct s_sg_platf_AS_cbarg {
-  const char *id;
+class ZoneCreationArgs {
+public:
+  std::string id;
   int routing;
   int routing;
-} s_sg_platf_AS_cbarg_t;
+};
 
 #define SG_PLATF_AS_INITIALIZER {nullptr,0}
 /* The default current property receiver. Setup in the corresponding opening callbacks. */
 
 #define SG_PLATF_AS_INITIALIZER {nullptr,0}
 /* The default current property receiver. Setup in the corresponding opening callbacks. */
@@ -202,8 +202,8 @@ 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(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_AS_begin(sg_platf_AS_cbarg_t AS); // Begin description of new AS
-XBT_PUBLIC(void) sg_platf_new_AS_seal();                     // That AS is fully described
+XBT_PUBLIC(simgrid::s4u::NetZone*) sg_platf_new_Zone_begin(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 an host   to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
 
 XBT_PUBLIC(void) sg_platf_new_host   (sg_platf_host_cbarg_t   host);   // Add an host   to the currently described AS
 XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
index 2b4ad7c..314c276 100644 (file)
@@ -961,14 +961,16 @@ void STag_surfxml_zone()
 {
   parse_after_config();
   ZONE_TAG                 = 1;
 {
   parse_after_config();
   ZONE_TAG                 = 1;
-  s_sg_platf_AS_cbarg_t AS = {A_surfxml_zone_id, (int)A_surfxml_zone_routing};
+  ZoneCreationArgs zone;
+  zone.id      = A_surfxml_zone_id;
+  zone.routing = static_cast<int>(A_surfxml_zone_routing);
 
 
-  sg_platf_new_AS_begin(&AS);
+  sg_platf_new_Zone_begin(&zone);
 }
 
 void ETag_surfxml_zone()
 {
 }
 
 void ETag_surfxml_zone()
 {
-  sg_platf_new_AS_seal();
+  sg_platf_new_Zone_seal();
 }
 
 void STag_surfxml_config()
 }
 
 void STag_surfxml_config()