Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify the prototype of CpuAction::onStateChange
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 16 Jan 2016 14:18:46 +0000 (15:18 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 16 Jan 2016 14:18:50 +0000 (15:18 +0100)
I'm not sure of how to export it to the user.

src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/plugins/energy.cpp

index 4be4445..5b31783 100644 (file)
@@ -345,12 +345,12 @@ void CpuAction::setAffinity(Cpu *cpu, unsigned long mask)
   XBT_OUT();
 }
 
   XBT_OUT();
 }
 
-simgrid::xbt::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> CpuAction::onStateChange;
+simgrid::xbt::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t)> CpuAction::onStateChange;
 
 void CpuAction::setState(e_surf_action_state_t state){
 
 void CpuAction::setState(e_surf_action_state_t state){
-  e_surf_action_state_t old = getState();
+  e_surf_action_state_t previous = getState();
   Action::setState(state);
   Action::setState(state);
-  onStateChange(this, old, state);
+  onStateChange(this, previous);
 }
 
 }
 }
 
 }
index 066670c..4ba92de 100644 (file)
@@ -175,9 +175,9 @@ 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 *
 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)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t previous)`
  */
  */
-  static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> onStateChange;
+  static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t)> onStateChange;
 
   /** @brief CpuAction constructor */
   CpuAction(simgrid::surf::Model *model, double cost, bool failed)
 
   /** @brief CpuAction constructor */
   CpuAction(simgrid::surf::Model *model, double cost, bool failed)
index bbbb065..5823df6 100644 (file)
@@ -201,8 +201,7 @@ static void onCreation(simgrid::s4u::Host& host) {
   host.extension_set(new HostEnergy(&host));
 }
 
   host.extension_set(new HostEnergy(&host));
 }
 
-static void onActionStateChange(simgrid::surf::CpuAction *action,
-    e_surf_action_state_t old, e_surf_action_state_t cur) {
+static void onActionStateChange(simgrid::surf::CpuAction *action, e_surf_action_state_t previous) {
   const char *name = getActionCpu(action)->getName();
   simgrid::surf::Host *host = sg_host_by_name(name)->extension<simgrid::surf::Host>();
   simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);
   const char *name = getActionCpu(action)->getName();
   simgrid::surf::Host *host = sg_host_by_name(name)->extension<simgrid::surf::Host>();
   simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);