Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename callback cpuActionStateChangedCallbacks into CpuAction::onStateChange
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 22 Dec 2015 21:28:49 +0000 (22:28 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 22 Dec 2015 21:28:49 +0000 (22:28 +0100)
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/plugins/energy.cpp

index f9f6a12..51b1d1e 100644 (file)
@@ -330,10 +330,12 @@ void CpuAction::setAffinity(Cpu *cpu, unsigned long mask)
   XBT_OUT();
 }
 
+simgrid::surf::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> CpuAction::onStateChange;
+
 void CpuAction::setState(e_surf_action_state_t state){
   e_surf_action_state_t old = getState();
   Action::setState(state);
-  cpuActionStateChangedCallbacks(this, old, state);
+  onStateChange(this, old, state);
 }
 
 }
index ff5b3c1..12a8e00 100644 (file)
@@ -27,12 +27,6 @@ class CpuPlugin;
  *************/
 XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 
-/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
- */
-XBT_PUBLIC_DATA(simgrid::surf::signal<void(CpuAction*, e_surf_action_state_t, e_surf_action_state_t)>) cpuActionStateChangedCallbacks;
-
 XBT_PUBLIC(void) cpu_add_traces();
 
 /*********
@@ -182,6 +176,11 @@ public:
 XBT_PUBLIC_CLASS CpuAction : public simgrid::surf::Action {
 friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 public:
+/** @brief Callbacks handler which emit the callbacks after CpuAction State changed *
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ */
+  static simgrid::surf::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> onStateChange;
+
   /** @brief CpuAction constructor */
   CpuAction(simgrid::surf::Model *model, double cost, bool failed)
     : Action(model, cost, failed) {} //FIXME:REMOVE
index d7bf6db..d1c16ea 100644 (file)
@@ -145,7 +145,7 @@ void sg_energy_plugin_init() {
     simgrid::surf::VMCreatedCallbacks.connect(energyVMCreatedCallback);
     simgrid::surf::Host::onCreation.connect(energyHostCreatedCallback);
     simgrid::surf::Host::onDestruction.connect(energyHostDestructedCallback);
-    simgrid::surf::cpuActionStateChangedCallbacks.connect(
+    simgrid::surf::CpuAction::onStateChange.connect(
       energyCpuActionStateChangedCallback);
     simgrid::surf::surfExitCallbacks.connect(sg_energy_plugin_exit);
     simgrid::surf::Host::onStateChange.connect(