Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'Adrien.Gougeon/simgrid-master'
[simgrid.git] / include / simgrid / s4u / Engine.hpp
index 58e0e8f..764bc08 100644 (file)
@@ -7,10 +7,8 @@
 #define SIMGRID_S4U_ENGINE_HPP
 
 #include <xbt/base.h>
-#include <xbt/functional.hpp>
 
 #include <simgrid/forward.h>
-#include <simgrid/simix.hpp>
 
 #include <simgrid/s4u/NetZone.hpp>
 
@@ -65,22 +63,22 @@ public:
   template <class F> void register_actor(const std::string& name)
   {
     kernel::actor::ActorCodeFactory code_factory = [](std::vector<std::string> args) {
-      return kernel::actor::ActorCode([args] {
+      return kernel::actor::ActorCode([args = std::move(args)]() mutable {
         F code(std::move(args));
         code();
       });
     };
-    register_function(name, std::move(code_factory));
+    register_function(name, code_factory);
   }
   template <class F> void register_actor(const std::string& name, F code)
   {
     kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
-      return kernel::actor::ActorCode([code, args] { code(std::move(args)); });
+      return kernel::actor::ActorCode([code, args = std::move(args)]() mutable { code(std::move(args)); });
     };
-    register_function(name, std::move(code_factory));
+    register_function(name, code_factory);
   }
 
-  void load_deployment(const std::string& deploy);
+  void load_deployment(const std::string& deploy) const;
 
 protected:
 #ifndef DOXYGEN
@@ -159,13 +157,13 @@ public:
    * @endrst
    *
    * Example:
-   * e->set_config("host/model:ptask_L07");
+   * simgrid::s4u::Engine::set_config("host/model:ptask_L07");
    */
-  void set_config(const std::string& str);
-  void set_config(const std::string& name, int value);
-  void set_config(const std::string& name, bool value);
-  void set_config(const std::string& name, double value);
-  void set_config(const std::string& name, const std::string& value);
+  static void set_config(const std::string& str);
+  static void set_config(const std::string& name, int value);
+  static void set_config(const std::string& name, bool value);
+  static void set_config(const std::string& name, double value);
+  static void set_config(const std::string& name, const std::string& value);
 
   /** Callback fired when the platform is created (ie, the xml file parsed),
    * right before the actual simulation starts. */
@@ -198,7 +196,7 @@ XBT_PRIVATE void get_filtered_netzones_recursive(const s4u::NetZone* current, st
                 "Filtering netzones is only possible for subclasses of kernel::routing::NetZoneImpl");
   for (auto const& elem : current->get_children()) {
     get_filtered_netzones_recursive(elem, whereto);
-    T* elem_impl = dynamic_cast<T*>(elem->get_impl());
+    auto* elem_impl = dynamic_cast<T*>(elem->get_impl());
     if (elem_impl != nullptr)
       whereto->push_back(elem_impl);
   }