X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7f3eef41bb31d243caddaa36f1612cb0d0febfd8..c04075c49b6bc68df4f37240b4ac53e7a108abaa:/include/simgrid/s4u/Host.hpp diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index e745232277..b59ec85d10 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -54,18 +54,23 @@ public: protected: virtual ~Host(); // Call destroy() instead of manually deleting it. Host* set_netpoint(kernel::routing::NetPoint* netpoint); -#endif -public: - /** Called on each newly created host */ static xbt::signal on_creation; - /** Called when the machine is turned on or off (called AFTER the change) */ + static xbt::signal on_destruction; + +public: + static xbt::signal on_speed_change; static xbt::signal on_state_change; - /** Called when the speed of the machine is changed (called AFTER the change) +#endif + /** Add a callback fired on each newly created host */ + static void on_creation_cb(const std::function& cb) { on_creation.connect(cb); } + /** Add a callback fired when the machine is turned on or off (called AFTER the change) */ + static void on_state_change_cb(const std::function& cb) { on_state_change.connect(cb); } + /** Add a callback fired when the speed of the machine is changed (called AFTER the change) * (either because of a pstate switch or because of an external load event coming from the profile) */ - static xbt::signal on_speed_change; - /** Called just before destructing a host */ - static xbt::signal on_destruction; + static void on_speed_change_cb(const std::function& cb) { on_speed_change.connect(cb); } + /** Add a callback fired just before destructing a host */ + static void on_destruction_cb(const std::function& cb) { on_destruction.connect(cb); } virtual void destroy(); #ifndef DOXYGEN