Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
include cleanups (mostly surf/surf.hpp)
[simgrid.git] / src / kernel / routing / NetZoneImpl.cpp
index cd0cc7e..0b875ed 100644 (file)
@@ -3,10 +3,11 @@
 /* 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. */
 
-#include "simgrid/kernel/routing/NetZoneImpl.hpp"
-#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Host.hpp"
+#include <simgrid/kernel/routing/NetPoint.hpp>
+#include <simgrid/kernel/routing/NetZoneImpl.hpp>
+#include <simgrid/s4u/Engine.hpp>
+#include <simgrid/s4u/Host.hpp>
+
 #include "src/include/simgrid/sg_config.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/resource/DiskImpl.hpp"
@@ -14,7 +15,6 @@
 #include "src/surf/SplitDuplexLinkImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
-#include "surf/surf.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
 
@@ -72,12 +72,13 @@ xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kernel::routi
 
 NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
 {
+  auto* engine = s4u::Engine::get_instance();
   /* workaroud: first netzoneImpl will be the root netzone.
    * Without globals and with current surf_*_model_description init functions, we need
    * the root netzone to exist when creating the models.
    * This was usually done at sg_platf.cpp, during XML parsing */
-  if (not s4u::Engine::get_instance()->get_netzone_root()) {
-    s4u::Engine::get_instance()->set_netzone_root(&piface_);
+  if (not engine->get_netzone_root()) {
+    engine->set_netzone_root(&piface_);
     /* root netzone set, initialize models */
     simgrid::s4u::Engine::on_platform_creation();
 
@@ -91,10 +92,10 @@ NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
     surf_config_models_setup();
   }
 
-  xbt_assert(nullptr == s4u::Engine::get_instance()->netpoint_by_name_or_null(get_name()),
+  xbt_assert(nullptr == engine->netpoint_by_name_or_null(get_name()),
              "Refusing to create a second NetZone called '%s'.", get_cname());
   netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone);
-  XBT_DEBUG("NetZone '%s' created with the id '%u'", get_cname(), netpoint_->id());
+  XBT_DEBUG("NetZone '%s' created with the id '%lu'", get_cname(), netpoint_->id());
   _sg_cfg_init_status = 2; /* HACK: direct access to the global controlling the level of configuration to prevent
                             * any further config now that we created some real content */
   simgrid::s4u::NetZone::on_creation(piface_); // notify the signal
@@ -195,7 +196,8 @@ NetPoint* NetZoneImpl::create_router(const std::string& name)
 
   return (new NetPoint(name, NetPoint::Type::Router))->set_englobing_zone(this);
 }
-int NetZoneImpl::add_component(NetPoint* elm)
+
+unsigned long NetZoneImpl::add_component(NetPoint* elm)
 {
   vertices_.push_back(elm);
   return vertices_.size() - 1; // The rank of the newly created object