From: Martin Quinson Date: Sun, 20 Dec 2015 22:15:09 +0000 (+0100) Subject: rename host callbacks X-Git-Tag: v3_13~1421 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a8c316ac06c17368f52aff8c009e63421103cc24 rename host callbacks --- diff --git a/src/surf/callbacks.cpp b/src/surf/callbacks.cpp index 78705cbfad..07b63df115 100644 --- a/src/surf/callbacks.cpp +++ b/src/surf/callbacks.cpp @@ -12,7 +12,7 @@ void surf_on_host_created(void (*callback)(sg_host_t)) { - simgrid::surf::Host::creationCallbacks.connect([callback](simgrid::surf::Host* host) { + simgrid::surf::Host::onCreation.connect([callback](simgrid::surf::Host* host) { const char* id = host->getName(); sg_host_t h = sg_host_by_name(id); xbt_assert(h != NULL, "Host not found for name %s", id); diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index e7014c2ba0..3d08ac4e44 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -75,9 +75,9 @@ void HostModel::adjustWeightOfDummyCpuActions() /************ * Resource * ************/ -simgrid::surf::signal Host::creationCallbacks; -simgrid::surf::signal Host::destructionCallbacks; -simgrid::surf::signal Host::stateChangeCallbacks; +simgrid::surf::signal Host::onCreation; +simgrid::surf::signal Host::onDestruction; +simgrid::surf::signal Host::onStateChange; void Host::init() { @@ -107,7 +107,7 @@ Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_ void Host::onDie() { - destructionCallbacks(this); + onDestruction(this); Resource::onDie(); } @@ -122,13 +122,13 @@ void Host::attach(simgrid::Host* host) xbt_die("Already attached to host %s", host->id().c_str()); host->extension_set(this); p_host = host; - creationCallbacks(this); + onCreation(this); } void Host::setState(e_surf_resource_state_t state){ e_surf_resource_state_t old = Resource::getState(); Resource::setState(state); - stateChangeCallbacks(this, old, state); + onStateChange(this, old, state); p_cpu->setState(state); } @@ -372,12 +372,12 @@ void Host::setParams(vm_params_t params) /********** * Action * **********/ -simgrid::surf::signal HostAction::stateChangeCallbacks; +simgrid::surf::signal HostAction::onStateChange; void HostAction::setState(e_surf_action_state_t state){ e_surf_action_state_t old = getState(); Action::setState(state); - stateChangeCallbacks(this, old, state); + onStateChange(this, old, state); } } diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index fa34643ec9..986bff7db4 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -78,9 +78,9 @@ public: static simgrid::xbt::Extension EXTENSION_ID; /* callbacks */ - static simgrid::surf::signal creationCallbacks; /** Called on each newly created object */ - static simgrid::surf::signal destructionCallbacks; /** Called just before destructing an object */ - static simgrid::surf::signal stateChangeCallbacks; + 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 void init(); @@ -276,7 +276,7 @@ private: */ class HostAction : public Action { public: - static simgrid::surf::signal stateChangeCallbacks; + static simgrid::surf::signal onStateChange; /** * @brief HostAction constructor diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 9f045db18f..77488ace5a 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -27,7 +27,7 @@ void surf_network_model_init_Constant() routing_model_create(NULL); - simgrid::surf::Host::creationCallbacks.connect([](simgrid::surf::Host*) { + simgrid::surf::Host::onCreation.connect([](simgrid::surf::Host*) { host_number_int++; }); sg_platf_link_add_cb(netcste_parse_nolink); diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 86db6aa05b..bf1390bdcb 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -99,7 +99,7 @@ void surf_network_model_init_IB(void) xbt_dynar_push(all_existing_models, &surf_network_model); networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback); networkCommunicateCallbacks.connect(IB_action_init_callback); - simgrid::surf::Host::creationCallbacks.connect(IB_create_host_callback); + simgrid::surf::Host::onCreation.connect(IB_create_host_callback); xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index cbfde2c015..d7bf6db890 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -143,12 +143,12 @@ void sg_energy_plugin_init() { simgrid::energy::surf_energy = new std::map(); simgrid::surf::VMCreatedCallbacks.connect(energyVMCreatedCallback); - simgrid::surf::Host::creationCallbacks.connect(energyHostCreatedCallback); - simgrid::surf::Host::destructionCallbacks.connect(energyHostDestructedCallback); + simgrid::surf::Host::onCreation.connect(energyHostCreatedCallback); + simgrid::surf::Host::onDestruction.connect(energyHostDestructedCallback); simgrid::surf::cpuActionStateChangedCallbacks.connect( energyCpuActionStateChangedCallback); simgrid::surf::surfExitCallbacks.connect(sg_energy_plugin_exit); - simgrid::surf::Host::stateChangeCallbacks.connect( + simgrid::surf::Host::onStateChange.connect( energyStateChangedCallback); } }