Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to set configuration items without parsing the value
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 3 Mar 2020 22:40:32 +0000 (23:40 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 3 Mar 2020 22:56:43 +0000 (23:56 +0100)
Also in documentation: publicize the fact that our actor should not
return any value (expected return type: void) and hide the legacy
prototype with expected return type: int.

docs/find-missing.ignore
docs/source/app_s4u.rst
include/simgrid/s4u/Engine.hpp
src/s4u/s4u_Engine.cpp

index 76933b7..cce9236 100644 (file)
@@ -13,6 +13,12 @@ It is only used by find-missing, that will not report any definition linked here
 .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< Link * > &links, double *latency)
 .. autodoxymethod:: simgrid::s4u::Host::route_to(const Host *dest, std::vector< kernel::resource::LinkImpl * > &links, double *latency)
 
+# The fact that actors can return an int is a legacy behavior for MSG
+.. autodoxymethod:: simgrid::s4u::Engine::register_default(const kernel::actor::ActorCodeFactory &factory)
+.. autodoxymethod:: simgrid::s4u::Engine::register_default(int(*code)(int, char **))
+.. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, const kernel::actor::ActorCodeFactory &factory)
+.. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, int(*code)(int, char **))
+
 
 # These could be hidden as private things, eg in s4u_Exec.cpp
 .. autodoxymethod:: simgrid::s4u::ExecPar::get_remaining()
index 0d96ba5..fdb8c90 100644 (file)
@@ -760,14 +760,18 @@ Initialization
       .. autodoxymethod:: simgrid::s4u::Engine::is_initialized()
       .. autodoxymethod:: simgrid::s4u::Engine::shutdown()
       .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &str)
+      .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &name, bool value)
+      .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &name, double value)
+      .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &name, int value)
+      .. autodoxymethod:: simgrid::s4u::Engine::set_config(const std::string &name, std::string value)
 
       .. autodoxymethod:: simgrid::s4u::Engine::load_deployment(const std::string &deploy)
       .. autodoxymethod:: simgrid::s4u::Engine::load_platform(const std::string &platf)
       .. autodoxymethod:: simgrid::s4u::Engine::register_actor(const std::string &name)
       .. autodoxymethod:: simgrid::s4u::Engine::register_actor(const std::string &name, F code)
-      .. autodoxymethod:: simgrid::s4u::Engine::register_default(int(*code)(int, char **))
-      .. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, int(*code)(int, char **))
+      .. autodoxymethod:: simgrid::s4u::Engine::register_default(void(*code)(int, char **))
       .. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, void(*code)(std::vector< std::string >))
+      .. autodoxymethod:: simgrid::s4u::Engine::register_function(const std::string &name, void(*code)(int, char **))
 
    .. group-tab:: Python
    
index c35db1d..39aa01f 100644 (file)
@@ -160,6 +160,10 @@ public:
    * e->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, std::string value);
 
   /** Callback fired when the platform is created (ie, the xml file parsed),
    * right before the actual simulation starts. */
index b0b12b5..c4ecd81 100644 (file)
@@ -401,6 +401,23 @@ void Engine::set_config(const std::string& str)
 {
   config::set_parse(str);
 }
+void Engine::set_config(const std::string& name, int value)
+{
+  config::set_value(name.c_str(), value);
+}
+void Engine::set_config(const std::string& name, double value)
+{
+  config::set_value(name.c_str(), value);
+}
+void Engine::set_config(const std::string& name, bool value)
+{
+  config::set_value(name.c_str(), value);
+}
+void Engine::set_config(const std::string& name, std::string value)
+{
+  config::set_value(name.c_str(), value);
+}
+
 } // namespace s4u
 } // namespace simgrid