Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let's do standard C++ here
[simgrid.git] / src / surf / surf_interface.cpp
index b2cedc1..1d3c71e 100644 (file)
@@ -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_);
 }