Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stringify cluster
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 Aug 2017 10:06:14 +0000 (12:06 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 Aug 2017 10:06:14 +0000 (12:06 +0200)
15 files changed:
include/simgrid/s4u/Engine.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/ClusterZone.hpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/DragonflyZone.hpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FatTreeZone.hpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/TorusZone.hpp
src/s4u/s4u_engine.cpp
src/surf/network_ns3.cpp
src/surf/sg_platf.cpp
src/surf/xml/platf.hpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index a42beca..e705bab 100644 (file)
@@ -75,7 +75,7 @@ public:
   simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
 
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
   simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
 
   /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
-  simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(const char* name);
+  simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
   void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
   void netpointRegister(simgrid::kernel::routing::NetPoint * card);
   void netpointUnregister(simgrid::kernel::routing::NetPoint * card);
   void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
   void netpointRegister(simgrid::kernel::routing::NetPoint * card);
   void netpointUnregister(simgrid::kernel::routing::NetPoint * card);
index 4cf5cb9..296f3f8 100644 (file)
@@ -119,9 +119,9 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
   }
 }
 
   }
 }
 
-void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int /*rank*/, int position)
+void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int /*rank*/, int position)
 {
 {
-  std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(id);
+  std::string link_id = cluster->id + "_link_" + std::to_string(id);
 
   LinkCreationArgs link;
   link.id        = link_id;
 
   LinkCreationArgs link;
   link.id        = link_id;
@@ -133,10 +133,8 @@ void ClusterZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id
   surf::LinkImpl *linkUp;
   surf::LinkImpl *linkDown;
   if (link.policy == SURF_LINK_FULLDUPLEX) {
   surf::LinkImpl *linkUp;
   surf::LinkImpl *linkDown;
   if (link.policy == SURF_LINK_FULLDUPLEX) {
-    std::string tmp_link = std::string(link_id) + "_UP";
-    linkUp         = surf::LinkImpl::byName(tmp_link);
-    tmp_link             = std::string(link_id) + "_DOWN";
-    linkDown = surf::LinkImpl::byName(tmp_link);
+    linkUp   = surf::LinkImpl::byName(link_id + "_UP");
+    linkDown = surf::LinkImpl::byName(link_id + "_DOWN");
   } else {
     linkUp   = surf::LinkImpl::byName(link_id);
     linkDown = linkUp;
   } else {
     linkUp   = surf::LinkImpl::byName(link_id);
     linkDown = linkUp;
index 13e6aab..9fe1653 100644 (file)
@@ -72,8 +72,8 @@ public:
   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;
 
-  virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
-  virtual void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+  virtual void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, int position);
+  virtual void parse_specific_arguments(ClusterCreationArgs* cluster)
   {
     /* this routing method does not require any specific argument */
   }
   {
     /* this routing method does not require any specific argument */
   }
index 89a3124..2b76d0b 100644 (file)
@@ -41,7 +41,7 @@ void DragonflyZone::rankId_to_coords(int rankId, unsigned int (*coords)[4])
   (*coords)[3]         = rankId % numNodesPerBlade_;
 }
 
   (*coords)[3]         = rankId % numNodesPerBlade_;
 }
 
-void DragonflyZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 {
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
 {
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
index 760eac3..ceeeda3 100644 (file)
@@ -64,7 +64,7 @@ public:
   ~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;
-  void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
+  void parse_specific_arguments(ClusterCreationArgs* cluster) override;
   void seal() override;
   void generateRouters();
   void generateLinks();
   void seal() override;
   void generateRouters();
   void generateLinks();
@@ -72,7 +72,7 @@ public:
 
 private:
   void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
 
 private:
   void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
-  sg_platf_cluster_cbarg_t cluster_;
+  ClusterCreationArgs* cluster_;
   unsigned int numNodesPerBlade_    = 0;
   unsigned int numBladesPerChassis_ = 0;
   unsigned int numChassisPerGroup_  = 0;
   unsigned int numNodesPerBlade_    = 0;
   unsigned int numBladesPerChassis_ = 0;
   unsigned int numChassisPerGroup_  = 0;
index 9e3cdbc..c6485c8 100644 (file)
@@ -356,7 +356,7 @@ void FatTreeZone::addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeN
   this->links_.push_back(newLink);
 }
 
   this->links_.push_back(newLink);
 }
 
-void FatTreeZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 {
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
 {
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
@@ -441,7 +441,7 @@ void FatTreeZone::generateDotFile(const std::string& filename) const
   file.close();
 }
 
   file.close();
 }
 
-FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, int position)
+FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int position)
     : id(id), level(level), position(position)
 {
   LinkCreationArgs linkTemplate;
     : id(id), level(level), position(position)
 {
   LinkCreationArgs linkTemplate;
@@ -463,7 +463,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, in
   }
 }
 
   }
 }
 
-FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode* downNode, FatTreeNode* upNode)
+FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, FatTreeNode* upNode)
     : upNode(upNode), downNode(downNode)
 {
   static int uniqueId = 0;
     : upNode(upNode), downNode(downNode)
 {
   static int uniqueId = 0;
index e24867f..c08e69e 100644 (file)
@@ -51,7 +51,7 @@ public:
    * instead of passing by an upper level switch.
    */
   surf::LinkImpl* loopback;
    * instead of passing by an upper level switch.
    */
   surf::LinkImpl* loopback;
-  FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, int position);
+  FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int position);
 };
 
 /** \brief Link in a fat tree (@ref FatTreeZone).
 };
 
 /** \brief Link in a fat tree (@ref FatTreeZone).
@@ -61,7 +61,7 @@ public:
  */
 class FatTreeLink {
 public:
  */
 class FatTreeLink {
 public:
-  FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode* source, FatTreeNode* destination);
+  FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
   /** Link going up in the tree */
   surf::LinkImpl* upLink;
   /** Link going down in the tree */
   /** Link going up in the tree */
   surf::LinkImpl* upLink;
   /** Link going down in the tree */
@@ -113,7 +113,7 @@ public:
    *
    * It will also store the cluster for future use.
    */
    *
    * It will also store the cluster for future use.
    */
-  void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
+  void parse_specific_arguments(ClusterCreationArgs* cluster) override;
   void addProcessingNode(int id);
   void generateDotFile(const std::string& filename = "fatTree.dot") const;
 
   void addProcessingNode(int id);
   void generateDotFile(const std::string& filename = "fatTree.dot") const;
 
@@ -129,7 +129,7 @@ private:
   std::vector<FatTreeLink*> links_;
   std::vector<unsigned int> nodesByLevel_;
 
   std::vector<FatTreeLink*> links_;
   std::vector<unsigned int> nodesByLevel_;
 
-  sg_platf_cluster_cbarg_t cluster_ = nullptr;
+  ClusterCreationArgs* cluster_ = nullptr;
 
   void addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort);
   int getLevelPosition(const unsigned int level);
 
   void addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort);
   int getLevelPosition(const unsigned int level);
index cf31241..945fa9e 100644 (file)
@@ -31,7 +31,7 @@ TorusZone::TorusZone(NetZone* father, std::string name) : ClusterZone(father, na
 {
 }
 
 {
 }
 
-void TorusZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position)
+void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, int position)
 {
   /* Create all links that exist in the torus. Each rank creates @a dimensions-1 links */
   int dim_product = 1; // Needed to calculate the next neighbor_id
 {
   /* Create all links that exist in the torus. Each rank creates @a dimensions-1 links */
   int dim_product = 1; // Needed to calculate the next neighbor_id
@@ -74,7 +74,7 @@ void TorusZone::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id,
   rank++;
 }
 
   rank++;
 }
 
-void TorusZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
+void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 {
   std::vector<std::string> dimensions;
   boost::split(dimensions, cluster->topo_parameters, boost::is_any_of(","));
 {
   std::vector<std::string> dimensions;
   boost::split(dimensions, cluster->topo_parameters, boost::is_any_of(","));
index 2b76f78..56d4c70 100644 (file)
@@ -21,9 +21,9 @@ namespace routing {
 class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
   explicit TorusZone(NetZone* father, std::string name);
 class XBT_PRIVATE TorusZone : public ClusterZone {
 public:
   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 create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, int position) override;
   void getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t into, double* latency) 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 parse_specific_arguments(ClusterCreationArgs* cluster) override;
 
 private:
   std::vector<unsigned int> dimensions_;
 
 private:
   std::vector<unsigned int> dimensions_;
index 4c13de0..50d287e 100644 (file)
@@ -126,11 +126,12 @@ NetZone* Engine::getNetzoneByNameOrNull(const char* name)
 }
 
 /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
 }
 
 /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
-simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(const char* name)
+simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(std::string name)
 {
   auto netp = pimpl->netpoints_.find(name);
   return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
 }
 {
   auto netp = pimpl->netpoints_.find(name);
   return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
 }
+
 /** @brief Fill the provided vector with all existing netpoints */
 void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
 {
 /** @brief Fill the provided vector with all existing netpoints */
 void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
 {
index fb0f9cc..a3f621f 100644 (file)
@@ -54,7 +54,7 @@ NetPointNs3::NetPointNs3()
  * Callbacks *
  *************/
 
  * Callbacks *
  *************/
 
-static void clusterCreation_cb(sg_platf_cluster_cbarg_t cluster)
+static void clusterCreation_cb(ClusterCreationArgs* cluster)
 {
   for (int i : *cluster->radicals) {
     // Routers don't create a router on the other end of the private link by themselves.
 {
   for (int i : *cluster->radicals) {
     // Routers don't create a router on the other end of the private link by themselves.
index 1214fd5..474ef71 100644 (file)
@@ -35,8 +35,7 @@ XBT_PRIVATE std::vector<std::string> known_storages;
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::signal<void(sg_platf_cluster_cbarg_t)> on_cluster;
-
+simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
 }
 }
 
 }
 }
 
@@ -100,18 +99,18 @@ void sg_platf_new_host(sg_platf_host_cbarg_t args)
 }
 
 /** @brief Add a "router" to the network element list */
 }
 
 /** @brief Add a "router" to the network element list */
-simgrid::kernel::routing::NetPoint* sg_platf_new_router(const char* name, const char* coords)
+simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const char* coords)
 {
   simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current();
 
   if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
     current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
   xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
 {
   simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current();
 
   if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
     current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
   xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
-             "Refusing to create a router named '%s': this name already describes a node.", name);
+             "Refusing to create a router named '%s': this name already describes a node.", name.c_str());
 
   simgrid::kernel::routing::NetPoint* netpoint =
       new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router, current_routing);
 
   simgrid::kernel::routing::NetPoint* netpoint =
       new simgrid::kernel::routing::NetPoint(name, simgrid::kernel::routing::NetPoint::Type::Router, current_routing);
-  XBT_DEBUG("Router '%s' has the id %u", name, netpoint->id());
+  XBT_DEBUG("Router '%s' has the id %u", name.c_str(), netpoint->id());
 
   if (coords && strcmp(coords, ""))
     new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords);
 
   if (coords && strcmp(coords, ""))
     new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords);
@@ -149,7 +148,7 @@ void sg_platf_new_link(LinkCreationArgs* link)
   }
 }
 
   }
 }
 
-void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
+void sg_platf_new_cluster(ClusterCreationArgs* cluster)
 {
   using simgrid::kernel::routing::ClusterZone;
   using simgrid::kernel::routing::DragonflyZone;
 {
   using simgrid::kernel::routing::ClusterZone;
   using simgrid::kernel::routing::DragonflyZone;
@@ -272,8 +271,8 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
 
   // Add a router.
   XBT_DEBUG(" ");
 
   // Add a router.
   XBT_DEBUG(" ");
-  XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
-  if (not cluster->router_id || not strcmp(cluster->router_id, "")) {
+  XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
+  if (cluster->router_id.empty()) {
     std::string newid   = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
     current_as->router_ = sg_platf_new_router(newid.c_str(), NULL);
   } else {
     std::string newid   = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
     current_as->router_ = sg_platf_new_router(newid.c_str(), NULL);
   } else {
index 159aa1a..17c6f9e 100644 (file)
@@ -23,10 +23,10 @@ XBT_PUBLIC(void) surf_parse_warn(std::string msg);
 
 XBT_PUBLIC(double) surf_parse_get_double(std::string s);
 XBT_PUBLIC(int) surf_parse_get_int(std::string s);
 
 XBT_PUBLIC(double) surf_parse_get_double(std::string s);
 XBT_PUBLIC(int) surf_parse_get_int(std::string s);
-XBT_PUBLIC(double) surf_parse_get_time(const char *string, const char *entity_kind, const char *name);
-XBT_PUBLIC(double) surf_parse_get_size(const char *string, const char *entity_kind, const char *name);
-XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name);
-XBT_PUBLIC(double) surf_parse_get_speed(const char *string, const char *entity_kind, const char *name);
+XBT_PUBLIC(double) surf_parse_get_time(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC(double) surf_parse_get_size(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC(double) surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC(double) surf_parse_get_speed(const char* string, const char* entity_kind, std::string name);
 
 XBT_PUBLIC(int) surf_parse(); /* Entry-point to the parser */
 
 
 XBT_PUBLIC(int) surf_parse(); /* Entry-point to the parser */
 
index 03e3ed1..565fbe4 100644 (file)
@@ -93,28 +93,28 @@ typedef struct s_sg_platf_route_cbarg {
   std::vector<simgrid::surf::LinkImpl*>* link_list;
 } s_sg_platf_route_cbarg_t;
 
   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;
-typedef struct s_sg_platf_cluster_cbarg {
-  const char* id;
-  const char* prefix;
-  const char* suffix;
-  std::vector<int>* radicals;
+class ClusterCreationArgs {
+public:
+  std::string id;
+  std::string prefix;
+  std::string suffix;
+  std::vector<int>* radicals = nullptr;
   std::vector<double> speeds;
   std::vector<double> speeds;
-  int core_amount;
-  double bw;
-  double lat;
-  double bb_bw;
-  double bb_lat;
-  double loopback_bw;
-  double loopback_lat;
-  double limiter_link;
+  int core_amount     = 0;
+  double bw           = 0;
+  double lat          = 0;
+  double bb_bw        = 0;
+  double bb_lat       = 0;
+  double loopback_bw  = 0;
+  double loopback_lat = 0;
+  double limiter_link = 0;
   e_surf_cluster_topology_t topology;
   e_surf_cluster_topology_t topology;
-  const char* topo_parameters;
+  std::string topo_parameters;
   std::map<std::string, std::string>* properties;
   std::map<std::string, std::string>* properties;
-  const char* router_id;
+  std::string router_id;
   e_surf_link_sharing_policy_t sharing_policy;
   e_surf_link_sharing_policy_t bb_sharing_policy;
   e_surf_link_sharing_policy_t sharing_policy;
   e_surf_link_sharing_policy_t bb_sharing_policy;
-} s_sg_platf_cluster_cbarg_t;
+};
 
 class CabinetCreationArgs {
 public:
 
 class CabinetCreationArgs {
 public:
@@ -208,10 +208,10 @@ XBT_PUBLIC(void) sg_platf_new_host(sg_platf_host_cbarg_t host);        // Add a
 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_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(sg_platf_cluster_cbarg_t clust); // Add a cluster   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(simgrid::kernel::routing::NetPoint*)                        // Add a router    to the current Zone
 XBT_PUBLIC(void) sg_platf_new_cabinet(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(const char* name, const char* coords);
+sg_platf_new_router(std::string, const char* coords);
 
 XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route
 XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); // Add a bypassRoute
 
 XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route
 XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); // Add a bypassRoute
@@ -246,8 +246,7 @@ SG_END_DECL()
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
-extern XBT_PRIVATE simgrid::xbt::signal<void(sg_platf_cluster_cbarg_t)> on_cluster;
-
+extern XBT_PRIVATE simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
 }
 }
 
 }
 }
 
index 53a931d..0178db7 100644 (file)
@@ -144,8 +144,9 @@ struct unit_scale {
 };
 
 /* Note: field `unit' for the last element of parameter `units' should be nullptr. */
 };
 
 /* Note: field `unit' for the last element of parameter `units' should be nullptr. */
-static double surf_parse_get_value_with_unit(const char *string, const struct unit_scale *units,
-    const char *entity_kind, const char *name, const char *error_msg, const char *default_unit)
+static double surf_parse_get_value_with_unit(const char* string, const struct unit_scale* units,
+                                             const char* entity_kind, std::string name, const char* error_msg,
+                                             const char* default_unit)
 {
   char* ptr;
   int i;
 {
   char* ptr;
   int i;
@@ -159,7 +160,7 @@ static double surf_parse_get_value_with_unit(const char *string, const struct un
     if (res == 0)
       return res; // Ok, 0 can be unit-less
 
     if (res == 0)
       return res; // Ok, 0 can be unit-less
 
-    XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s",string, entity_kind, name, error_msg);
+    XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s", string, entity_kind, name.c_str(), error_msg);
     ptr = (char*)default_unit;
   }
   for (i = 0; units[i].unit != nullptr && strcmp(ptr, units[i].unit) != 0; i++);
     ptr = (char*)default_unit;
   }
   for (i = 0; units[i].unit != nullptr && strcmp(ptr, units[i].unit) != 0; i++);
@@ -171,7 +172,7 @@ static double surf_parse_get_value_with_unit(const char *string, const struct un
   return res;
 }
 
   return res;
 }
 
-double surf_parse_get_time(const char *string, const char *entity_kind, const char *name)
+double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
 {
   const struct unit_scale units[] = {
     { "w",  7 * 24 * 60 * 60 },
 {
   const struct unit_scale units[] = {
     { "w",  7 * 24 * 60 * 60 },
@@ -189,7 +190,7 @@ double surf_parse_get_time(const char *string, const char *entity_kind, const ch
       "Append 's' to your time to get seconds", "s");
 }
 
       "Append 's' to your time to get seconds", "s");
 }
 
-double surf_parse_get_size(const char *string, const char *entity_kind, const char *name)
+double surf_parse_get_size(const char* string, const char* entity_kind, std::string name)
 {
   const struct unit_scale units[] = {
     { "EiB", pow(1024, 6) },
 {
   const struct unit_scale units[] = {
     { "EiB", pow(1024, 6) },
@@ -224,7 +225,7 @@ double surf_parse_get_size(const char *string, const char *entity_kind, const ch
       "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
 }
 
       "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B");
 }
 
-double surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name)
+double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name)
 {
   const struct unit_scale units[] = {
     { "EiBps", pow(1024, 6) },
 {
   const struct unit_scale units[] = {
     { "EiBps", pow(1024, 6) },
@@ -257,7 +258,7 @@ double surf_parse_get_bandwidth(const char *string, const char *entity_kind, con
       "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps");
 }
 
       "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps");
 }
 
-double surf_parse_get_speed(const char *string, const char *entity_kind, const char *name)
+double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name)
 {
   const struct unit_scale units[] = {
     { "yottaflops", 1e24 },
 {
   const struct unit_scale units[] = {
     { "yottaflops", 1e24 },
@@ -284,7 +285,8 @@ double surf_parse_get_speed(const char *string, const char *entity_kind, const c
       "Append 'f' or 'flops' to your speed to get flop per second", "f");
 }
 
       "Append 'f' or 'flops' to your speed to get flop per second", "f");
 }
 
-static std::vector<double> surf_parse_get_all_speeds(char* speeds, const char* entity_kind, const char* id){
+static std::vector<double> surf_parse_get_all_speeds(char* speeds, const char* entity_kind, std::string id)
+{
 
   std::vector<double> speed_per_pstate;
 
 
   std::vector<double> speed_per_pstate;
 
@@ -555,9 +557,8 @@ void STag_surfxml_router(){
 }
 
 void ETag_surfxml_cluster(){
 }
 
 void ETag_surfxml_cluster(){
-  s_sg_platf_cluster_cbarg_t cluster;
-  memset(&cluster,0,sizeof(cluster));
-  cluster.properties = current_property_set;
+  ClusterCreationArgs cluster;
+  cluster.properties   = current_property_set;
   current_property_set = nullptr;
 
   cluster.id          = A_surfxml_cluster_id;
   current_property_set = nullptr;
 
   cluster.id          = A_surfxml_cluster_id;