From: Martin Quinson Date: Tue, 14 Feb 2017 00:14:29 +0000 (+0100) Subject: cosmetics X-Git-Tag: v3_15~395 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d8922a8d878de620b312b601417e286113135ae2 cosmetics --- diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 9d3223775b..507de1662a 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -11,12 +11,10 @@ #include -#include "xbt/fifo.h" -#include "xbt/dict.h" -#include "surf_interface.hpp" #include "src/surf/PropertyHolder.hpp" +#include "src/surf/surf_interface.hpp" +#include "xbt/fifo.h" -#include "simgrid/link.h" #include "simgrid/s4u/Link.hpp" /*********** diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 8911c8500a..35b61cb1a3 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -143,21 +143,22 @@ double surf_solve(double max_date) /********* * MODEL * *********/ - -surf_action_t surf_model_extract_done_action_set(surf_model_t model){ - if (model->getDoneActionSet()->empty()) +static surf_action_t ActionListExtract(simgrid::surf::ActionList* list) +{ + if (list->empty()) return nullptr; - surf_action_t res = &model->getDoneActionSet()->front(); - model->getDoneActionSet()->pop_front(); + surf_action_t res = &list->front(); + list->pop_front(); return res; } +surf_action_t surf_model_extract_done_action_set(surf_model_t model) +{ + return ActionListExtract(model->getDoneActionSet()); +} + surf_action_t surf_model_extract_failed_action_set(surf_model_t model){ - if (model->getFailedActionSet()->empty()) - return nullptr; - surf_action_t res = &model->getFailedActionSet()->front(); - model->getFailedActionSet()->pop_front(); - return res; + return ActionListExtract(model->getFailedActionSet()); } int surf_model_running_action_set_size(surf_model_t model){ diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index dad5cb0d5d..3a37bcc055 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -647,13 +647,13 @@ void Action::finish() { Action::State Action::getState() { - if (stateSet_ == getModel()->getReadyActionSet()) + if (stateSet_ == model_->getReadyActionSet()) return Action::State::ready; - if (stateSet_ == getModel()->getRunningActionSet()) + if (stateSet_ == model_->getRunningActionSet()) return Action::State::running; - if (stateSet_ == getModel()->getFailedActionSet()) + if (stateSet_ == model_->getFailedActionSet()) return Action::State::failed; - if (stateSet_ == getModel()->getDoneActionSet()) + if (stateSet_ == model_->getDoneActionSet()) return Action::State::done; return Action::State::not_in_the_system; } @@ -663,16 +663,16 @@ void Action::setState(Action::State state) stateSet_->erase(stateSet_->iterator_to(*this)); switch (state) { case Action::State::ready: - stateSet_ = getModel()->getReadyActionSet(); + stateSet_ = model_->getReadyActionSet(); break; case Action::State::running: - stateSet_ = getModel()->getRunningActionSet(); + stateSet_ = model_->getRunningActionSet(); break; case Action::State::failed: - stateSet_ = getModel()->getFailedActionSet(); + stateSet_ = model_->getFailedActionSet(); break; case Action::State::done: - stateSet_ = getModel()->getDoneActionSet(); + stateSet_ = model_->getDoneActionSet(); break; default: stateSet_ = nullptr; diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 573d6c5e03..ac4897a75d 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -216,7 +216,7 @@ public: s_xbt_swag_hookup_t stateHookup_ = {nullptr,nullptr}; - simgrid::surf::Model *getModel() {return model_;} + simgrid::surf::Model* getModel() { return model_; } protected: ActionList* stateSet_;