X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a714f2cc13ccf01d24d8848aafc9085aef8eb6ce..a8c316ac06c17368f52aff8c009e63421103cc24:/src/surf/host_interface.hpp diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index a7c6b51d9a..986bff7db4 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -26,29 +26,6 @@ class XBT_PRIVATE HostModel; class XBT_PRIVATE Host; class XBT_PRIVATE HostAction; -/************* - * Callbacks * - *************/ - -/** @ingroup SURF_callbacks - * @brief Callbacks fired after Host creation. Signature: `void(Host*)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) hostCreatedCallbacks; - -/** @ingroup SURF_callbacks - * @brief Callbacks fired Host destruction. Signature: `void(Host*)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) hostDestructedCallbacks; - -/** @ingroup SURF_callbacks - * @brief Callbacks fired after Host State changed. Signature: `void(Host *, e_surf_resource_state_t old, e_surf_resource_state_t current)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) hostStateChangedCallbacks; - -/** @ingroup SURF_callbacks - * @brief Callbacks fired HostAction State changed. Signature: `void(HostAction *, e_surf_action_state_t old, e_surf_action_state_t current)` - */ -XBT_PUBLIC_DATA(simgrid::surf::signal) hostActionStateChangedCallbacks; } } @@ -70,13 +47,13 @@ namespace surf { * @brief SURF Host model interface class * @details A model is an object which handle the interactions between its Resources and its Actions */ -class HostModel : public Model { +class HostModel : public Model{ public: HostModel() : Model() {} ~HostModel() {} virtual Host *createHost(const char *name, RoutingEdge *net, Cpu *cpu, xbt_dict_t props)=0; - void addTraces(){DIE_IMPOSSIBLE;} + void addTraces() override {DIE_IMPOSSIBLE;} virtual void adjustWeightOfDummyCpuActions(); virtual Action *executeParallelTask(int host_nb, @@ -85,7 +62,7 @@ public: double *bytes_amount, double rate)=0; - bool shareResourcesIsIdempotent() {return true;} + bool shareResourcesIsIdempotent() override {return true;} }; /************ @@ -95,9 +72,17 @@ public: * @brief SURF Host interface class * @details An host represents a machine with a aggregation of a Cpu, a Link and a Storage */ -class Host : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder { +class Host : public simgrid::surf::Resource, + public simgrid::surf::PropertyHolder { +public: + static simgrid::xbt::Extension EXTENSION_ID; + + /* callbacks */ + static simgrid::surf::signal onCreation; /** Called on each newly created object */ + static simgrid::surf::signal onDestruction; /** Called just before destructing an object */ + static simgrid::surf::signal onStateChange; + public: - static simgrid::xbt::FacetLevel LEVEL; static void init(); /** * @brief Host constructor @@ -291,6 +276,8 @@ private: */ class HostAction : public Action { public: + static simgrid::surf::signal onStateChange; + /** * @brief HostAction constructor *