Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 14 Feb 2017 00:14:29 +0000 (01:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 14 Feb 2017 00:45:30 +0000 (01:45 +0100)
src/surf/network_interface.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp

index 9d32237..507de16 100644 (file)
 
 #include <unordered_map>
 
-#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"
 
 /***********
index 8911c85..35b61cb 100644 (file)
@@ -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){
index dad5cb0..3a37bcc 100644 (file)
@@ -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;
index 573d6c5..ac4897a 100644 (file)
@@ -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_;