Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move all network models to the kernel::resource namespace
[simgrid.git] / src / surf / xml / surfxml_sax_cb.cpp
index 7a9d017..db18b63 100644 (file)
@@ -5,15 +5,16 @@
 
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/surf_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
+#include "surf/surf.hpp"
 #include "xbt/file.hpp"
 
-#include "src/surf/xml/platf_private.hpp"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
-#include <initializer_list>
 #include <string>
 #include <tuple>
 #include <unordered_map>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
 
-extern "C" {
-
 #include "simgrid_dtd.c"
 
 static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
-std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of current list link of a route */
+std::vector<simgrid::kernel::resource::LinkImpl*>
+    parsed_link_list; /* temporary store of current list link of a route */
 
 /*
  * Helping functions
@@ -61,17 +61,17 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri
   std::vector<simgrid::kernel::routing::NetPoint*> list;
   simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
   std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
-    return a->getName() < b->getName();
+    return a->get_name() < b->get_name();
   });
   bool first = true;
   for (auto const& np : list) {
-    if (np->isNetZone())
+    if (np->is_netzone())
       continue;
 
     if (not first)
       msg += ",";
     first = false;
-    msg += "'" + np->getName() + "'";
+    msg += "'" + np->get_name() + "'";
     if (msg.length() > 4096) {
       msg.pop_back(); // remove trailing quote
       msg += "...(list truncated)......";
@@ -100,7 +100,6 @@ int surf_parse_get_int(std::string s)
     return -1;
   }
 }
-}
 
 namespace {
 
@@ -199,8 +198,6 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
 }
 }
 
-extern "C" {
-
 double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
 {
   static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
@@ -612,17 +609,17 @@ void ETag_surfxml_link(){
 
 void STag_surfxml_link___ctn()
 {
-  simgrid::surf::LinkImpl* link = nullptr;
+  simgrid::kernel::resource::LinkImpl* link = nullptr;
   switch (A_surfxml_link___ctn_direction) {
   case AU_surfxml_link___ctn_direction:
   case A_surfxml_link___ctn_direction_NONE:
-    link = simgrid::surf::LinkImpl::byName(A_surfxml_link___ctn_id);
+    link = simgrid::kernel::resource::LinkImpl::byName(A_surfxml_link___ctn_id);
     break;
   case A_surfxml_link___ctn_direction_UP:
-    link = simgrid::surf::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_UP");
+    link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_UP");
     break;
   case A_surfxml_link___ctn_direction_DOWN:
-    link = simgrid::surf::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_DOWN");
+    link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_DOWN");
     break;
   default:
     surf_parse_error(std::string("Invalid direction for link ") + A_surfxml_link___ctn_id);
@@ -654,7 +651,7 @@ void ETag_surfxml_backbone(){
   link.policy = SURF_LINK_SHARED;
 
   sg_platf_new_link(&link);
-  routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(A_surfxml_backbone_id));
+  routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(A_surfxml_backbone_id));
 }
 
 void STag_surfxml_route(){
@@ -994,4 +991,3 @@ int surf_parse()
 {
   return surf_parse_lex();
 }
-}