From: Martin Quinson Date: Tue, 3 Mar 2020 22:40:32 +0000 (+0100) Subject: Allow to set configuration items without parsing the value X-Git-Tag: v3.26~842 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/813829e7b90c3c0106dd63c3b7aee378efc22aa6 Allow to set configuration items without parsing the value 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. --- diff --git a/docs/find-missing.ignore b/docs/find-missing.ignore index 76933b7dea..cce9236018 100644 --- a/docs/find-missing.ignore +++ b/docs/find-missing.ignore @@ -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() diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 0d96ba5291..fdb8c905ac 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -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 diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index c35db1d78c..39aa01f11d 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -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. */ diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index b0b12b55e9..c4ecd81f73 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -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