Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / src / surf / xml / surfxml_parseplatf.cpp
index 8446b10..1a0e0ad 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2020. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -62,7 +62,7 @@ void parse_platform_file(const std::string& file)
 {
   const char* cfile = file.c_str();
   int len           = strlen(cfile);
-  int is_lua        = len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a';
+  bool is_lua       = len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a';
 
   sg_platf_init();
 
@@ -103,7 +103,7 @@ void parse_platform_file(const std::string& file)
     auto profile = traces_set_list.at(elm.first);
 
     auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
-    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"HOST_AVAIL\">: Host ")+elm.second+" undefined.");
+    surf_parse_assert(host, std::string("<trace_connect kind=\"HOST_AVAIL\">: Host ") + elm.second + " undefined.");
     host->set_state_profile(profile);
   }
 
@@ -112,7 +112,7 @@ void parse_platform_file(const std::string& file)
     auto profile = traces_set_list.at(elm.first);
 
     auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
-    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"SPEED\">: Host ")+elm.second+" undefined.");
+    surf_parse_assert(host, std::string("<trace_connect kind=\"SPEED\">: Host ") + elm.second + " undefined.");
     host->set_speed_profile(profile);
   }
 
@@ -120,8 +120,8 @@ void parse_platform_file(const std::string& file)
     surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Trace ")+elm.first+" undefined.");
     auto profile = traces_set_list.at(elm.first);
 
-    auto link = simgrid::s4u::Link::by_name(elm.second);
-    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Link ")+elm.second+" undefined.");
+    auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+    surf_parse_assert(link, std::string("<trace_connect kind=\"LINK_AVAIL\">: Link ") + elm.second + " undefined.");
     link->set_state_profile(profile);
   }
 
@@ -129,8 +129,8 @@ void parse_platform_file(const std::string& file)
     surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Trace ")+elm.first+" undefined.");
     auto profile = traces_set_list.at(elm.first);
 
-    auto link                             = simgrid::s4u::Link::by_name(elm.second);
-    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Link ")+elm.second+" undefined.");
+    auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+    surf_parse_assert(link, std::string("<trace_connect kind=\"BANDWIDTH\">: Link ") + elm.second + " undefined.");
     link->set_bandwidth_profile(profile);
   }
 
@@ -138,8 +138,8 @@ void parse_platform_file(const std::string& file)
     surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Trace ")+elm.first+" undefined.");
     auto profile = traces_set_list.at(elm.first);
 
-    auto link    = simgrid::s4u::Link::by_name(elm.second);
-    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Link ")+elm.second+" undefined.");
+    auto link = simgrid::s4u::Link::by_name_or_null(elm.second);
+    surf_parse_assert(link, std::string("<trace_connect kind=\"LATENCY\">: Link ") + elm.second + " undefined.");
     link->set_latency_profile(profile);
   }