Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove a level of indirection in sd::Global.
[simgrid.git] / src / simdag / simdag_private.hpp
index b5e52f0..e452c3b 100644 (file)
@@ -1,14 +1,13 @@
-/* Copyright (c) 2006-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "simgrid/simdag.h"
+#include "surf/surf.hpp"
 #include <set>
 #include <string>
 #include <vector>
-#include "simgrid/simdag.h"
-#include "surf/surf.h"
 
 #ifndef SIMDAG_PRIVATE_HPP
 #define SIMDAG_PRIVATE_HPP
@@ -20,25 +19,21 @@ namespace simgrid{
 namespace sd{
 class Global {
 public:
-  explicit Global();
-  Global(const Global&) = delete;
-  ~Global();
-  bool watch_point_reached;      /* has a task just reached a watch point? */
-  std::set<SD_task_t> *initial_tasks;
-  std::set<SD_task_t> *runnable_tasks;
-  std::set<SD_task_t> *completed_tasks;
-  std::set<SD_task_t> *return_set;
+  bool watch_point_reached = false; /* has a task just reached a watch point? */
+  std::set<SD_task_t> initial_tasks;
+  std::set<SD_task_t> runnable_tasks;
+  std::set<SD_task_t> completed_tasks;
+  std::set<SD_task_t> return_set;
 };
 
 std::set<SD_task_t>* simulate (double how_long);
 }
 }
 
-SG_BEGIN_DECL()
 extern XBT_PRIVATE simgrid::sd::Global *sd_global;
 
 /* Task */
-typedef struct SD_task {
+struct s_SD_task_t {
   e_SD_task_state_t state;
   void *data;                   /* user data */
   char *name;
@@ -47,12 +42,12 @@ typedef struct SD_task {
   double alpha;          /* used by typed parallel tasks */
   double start_time;
   double finish_time;
-  surf_action_t surf_action;
+  simgrid::kernel::resource::Action* surf_action;
   unsigned short watch_points;  /* bit field xor()ed with masks */
 
-  int marked;                   /* used to check if the task DAG has some cycle*/
+  bool marked = false; /* used to check if the task DAG has some cycle*/
 
-  /* dependencies */
+  /* dependencies -- cannot be embedded in the struct since it's not handled as a real C++ class */
   std::set<SD_task_t> *inputs;
   std::set<SD_task_t> *outputs;
   std::set<SD_task_t> *predecessors;
@@ -63,7 +58,7 @@ typedef struct SD_task {
   double *flops_amount;
   double *bytes_amount;
   double rate;
-} s_SD_task_t;
+};
 
 /* SimDag private functions */
 XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state);
@@ -71,5 +66,4 @@ XBT_PRIVATE void SD_task_run(SD_task_t task);
 XBT_PRIVATE bool acyclic_graph_detail(xbt_dynar_t dag);
 XBT_PRIVATE void uniq_transfer_task_name(SD_task_t task);
 XBT_PRIVATE const char *__get_state_name(e_SD_task_state_t state);
-SG_END_DECL()
 #endif