Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / surf / xml / surfxml_sax_cb.cpp
index 72e5825..c348cd5 100644 (file)
@@ -65,7 +65,7 @@ void surf_parse_assert_netpoint(char* hostname, const char* pre, const char* pos
   msg += " Existing netpoints: \n";
 
   std::vector<simgrid::kernel::routing::NetPoint*> list;
-  simgrid::s4u::Engine::instance()->netpointList(&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->name() < b->name();
@@ -329,19 +329,17 @@ xbt_dict_t random_data_list = nullptr;
 YY_BUFFER_STATE surf_input_buffer;
 FILE *surf_file_to_parse = nullptr;
 
-/*
- * Stuff relative to storage
- */
+/* Stuff relative to storage */
 void STag_surfxml_storage()
 {
   ZONE_TAG = 0;
   XBT_DEBUG("STag_surfxml_storage");
   xbt_assert(current_property_set == nullptr, "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)");
 }
+
 void ETag_surfxml_storage()
 {
-  s_sg_platf_storage_cbarg_t storage;
-  memset(&storage,0,sizeof(storage));
+  StorageCreationArgs storage;
 
   storage.properties   = current_property_set;
   current_property_set = nullptr;
@@ -349,8 +347,8 @@ void ETag_surfxml_storage()
   storage.id           = A_surfxml_storage_id;
   storage.type_id      = A_surfxml_storage_typeId;
   storage.content      = A_surfxml_storage_content;
-
   storage.attach       = A_surfxml_storage_attach;
+
   sg_platf_new_storage(&storage);
 }
 void STag_surfxml_storage___type()
@@ -378,14 +376,15 @@ void ETag_surfxml_storage___type()
         "size of storage type", storage_type.id);
   sg_platf_new_storage_type(&storage_type);
 }
+
 void STag_surfxml_mount()
 {
   XBT_DEBUG("STag_surfxml_mount");
 }
+
 void ETag_surfxml_mount()
 {
-  s_sg_platf_mount_cbarg_t mount;
-  memset(&mount,0,sizeof(mount));
+  MountCreationArgs mount;
 
   mount.name      = A_surfxml_mount_name;
   mount.storageId = A_surfxml_mount_storageId;
@@ -519,7 +518,7 @@ void STag_surfxml_prop()
 {
   if (ZONE_TAG) { // We need to retrieve the most recently opened zone
     XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
-    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::instance()->netzoneByNameOrNull(A_surfxml_zone_id);
+    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
 
     netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
   }
@@ -666,12 +665,12 @@ void STag_surfxml_cabinet(){
 
 void STag_surfxml_peer(){
   parse_after_config();
-  s_sg_platf_peer_cbarg_t peer;
-  memset(&peer,0,sizeof(peer));
-  peer.id          = A_surfxml_peer_id;
-  peer.speed       = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id);
-  peer.bw_in       = surf_parse_get_bandwidth(A_surfxml_peer_bw___in, "bw_in of peer", peer.id);
-  peer.bw_out      = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id);
+  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());
+  peer.bw_in       = surf_parse_get_bandwidth(A_surfxml_peer_bw___in, "bw_in of peer", peer.id.c_str());
+  peer.bw_out      = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id.c_str());
   peer.coord       = A_surfxml_peer_coordinates;
   peer.speed_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : nullptr;
   peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : nullptr;
@@ -1138,11 +1137,10 @@ void surf_parse_close()
   }
 }
 
-/* Call the lexer to parse the currently opened file. This pointer to function enables bypassing of the parser */
-static int _surf_parse() {
+/* Call the lexer to parse the currently opened file */
+int surf_parse()
+{
   return surf_parse_lex();
 }
 
-int_f_void_t surf_parse = &_surf_parse;
-
 SG_END_DECL()