From 10c02c776839657b86a6f1bdbb9817a8268bc397 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 16 Jan 2016 15:18:46 +0100 Subject: [PATCH 1/1] simplify the prototype of CpuAction::onStateChange I'm not sure of how to export it to the user. --- src/surf/cpu_interface.cpp | 6 +++--- src/surf/cpu_interface.hpp | 4 ++-- src/surf/plugins/energy.cpp | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 4be4445e2f..5b31783685 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -345,12 +345,12 @@ void CpuAction::setAffinity(Cpu *cpu, unsigned long mask) XBT_OUT(); } -simgrid::xbt::signal CpuAction::onStateChange; +simgrid::xbt::signal CpuAction::onStateChange; 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); - onStateChange(this, old, state); + onStateChange(this, previous); } } diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 066670c7bd..4ba92de8bc 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -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 * - * @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 onStateChange; + static simgrid::xbt::signal onStateChange; /** @brief CpuAction constructor */ CpuAction(simgrid::surf::Model *model, double cost, bool failed) diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index bbbb065afc..5823df6d5a 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -201,8 +201,7 @@ static void onCreation(simgrid::s4u::Host& 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::VirtualMachine *vm = dynamic_cast(host); -- 2.20.1