From: Martin Quinson Date: Mon, 24 Apr 2017 12:46:28 +0000 (+0200) Subject: New function xbt_replay_action_get(): Retrieve the function previously associated... X-Git-Tag: v3.16~316 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fca6c6f4d442bde9453073545e8d2c640a50aea9 New function xbt_replay_action_get(): Retrieve the function previously associated to an event type. --- diff --git a/ChangeLog b/ChangeLog index 8cd98cee3c..0f6fda80d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ SimDag SMPI - New algorithm to privatize globals: dlopen, with dynamic loading tricks + XBT/Replay: + - New function xbt_replay_action_get(): + Retrieve the function previously associated to an event type. + -- Release target: June 21 2017 -- Da SimGrid team SimGrid (3.15) stable; urgency=low diff --git a/include/xbt/replay.hpp b/include/xbt/replay.hpp index be41b1c99a..b20852b150 100644 --- a/include/xbt/replay.hpp +++ b/include/xbt/replay.hpp @@ -31,6 +31,7 @@ SG_BEGIN_DECL() typedef void (*action_fun)(const char* const* args); XBT_PUBLIC(void) xbt_replay_action_register(const char* action_name, action_fun function); +XBT_PUBLIC(action_fun) xbt_replay_action_get(const char* action_name); SG_END_DECL() diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index 4e9f9fca24..408c7f4a13 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -180,3 +180,14 @@ void xbt_replay_action_register(const char* action_name, action_fun function) { simgrid::xbt::action_funs.insert({std::string(action_name), function}); } + +/** + * \ingroup XBT_replay + * \brief Get the function that was previously registered to handle a kind of action + * + * This can be useful if you want to override and extend an existing action. + */ +action_fun xbt_replay_action_get(const char* action_name) +{ + return simgrid::xbt::action_funs.at(std::string(action_name)); +}