From cd42089e037bc9108a5b8a049433e680a2f94029 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 16 Nov 2016 00:16:23 +0100 Subject: [PATCH] let's do standard C++ here --- src/surf/surf_interface.cpp | 25 +++++++------------------ src/surf/surf_interface.hpp | 7 ------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index b2cedc19f9..1d3c71eecc 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -591,14 +591,13 @@ void surf_action_lmm_update_index_heap(void *action, int i) { namespace simgrid { namespace surf { -void Action::initialize(simgrid::surf::Model *model, double cost, bool failed, - lmm_variable_t var) -{ - remains_ = cost; - start_ = surf_get_clock(); - cost_ = cost; - model_ = model; - variable_ = var; +Action::Action(simgrid::surf::Model* model, double cost, bool failed) : Action(model, cost, failed, nullptr) +{ +} + +Action::Action(simgrid::surf::Model* model, double cost, bool failed, lmm_variable_t var) + : remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var) +{ if (failed) stateSet_ = getModel()->getFailedActionSet(); else @@ -607,16 +606,6 @@ void Action::initialize(simgrid::surf::Model *model, double cost, bool failed, stateSet_->push_back(*this); } -Action::Action(simgrid::surf::Model *model, double cost, bool failed) -{ - initialize(model, cost, failed); -} - -Action::Action(simgrid::surf::Model *model, double cost, bool failed, lmm_variable_t var) -{ - initialize(model, cost, failed, var); -} - Action::~Action() { xbt_free(category_); } diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 998d260167..cdd4d58fcf 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -114,13 +114,6 @@ public: not_in_the_system /**< Not in the system anymore. Why did you ask ? */ }; -private: - /** - * @brief Common initializations for the constructors - */ - void initialize(simgrid::surf::Model *model, double cost, bool failed, - lmm_variable_t var = nullptr); - public: /** * @brief Action constructor -- 2.20.1