Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use std::unique_ptr for States
[simgrid.git] / src / mc / mc_state.h
index f607996..94c7201 100644 (file)
@@ -7,6 +7,9 @@
 #ifndef SIMGRID_MC_STATE_H
 #define SIMGRID_MC_STATE_H
 
+#include <list>
+#include <memory>
+
 #include <xbt/base.h>
 #include <xbt/dynar.h>
 
@@ -14,8 +17,6 @@
 #include "src/simix/smx_private.h"
 #include "src/mc/mc_snapshot.h"
 
-extern XBT_PRIVATE mc_global_t initial_global_state;
-
 /* Possible exploration status of a process in a state */
 typedef enum {
   MC_NOT_INTERLEAVE=0,      /* Do not interleave (do not execute) */
@@ -34,6 +35,8 @@ typedef struct mc_procstate{
 namespace simgrid {
 namespace mc {
 
+extern XBT_PRIVATE std::unique_ptr<s_mc_global_t> initial_global_state;
+
 /* An exploration state.
  *
  *  The `executed_state` is sometimes transformed into another `internal_req`.
@@ -48,7 +51,7 @@ struct XBT_PRIVATE State {
   s_smx_simcall_t executed_req;         /* The executed request of the state */
   int req_num = 0;                      /* The request number (in the case of a
                                        multi-request like waitany ) */
-  simgrid::mc::Snapshot* system_state = 0;      /* Snapshot of system state */
+  std::shared_ptr<simgrid::mc::Snapshot> system_state = nullptr;      /* Snapshot of system state */
   int num = 0;
   int in_visited_states = 0;
   // comm determinism verification (xbt_dynar_t<xbt_dynar_t<mc_comm_pattern_t>):
@@ -59,6 +62,8 @@ struct XBT_PRIVATE State {
   ~State();
 };
 
+XBT_PRIVATE void replay(std::list<std::unique_ptr<simgrid::mc::State>> const& stack);
+
 }
 }