Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add the Storage::read_async and Storage::write_async methods
[simgrid.git] / src / mc / VisitedState.hpp
1 /* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_MC_VISITED_STATE_HPP
7 #define SIMGRID_MC_VISITED_STATE_HPP
8
9 #include "src/mc/mc_state.hpp"
10 #include "src/mc/sosp/mc_snapshot.hpp"
11
12 #include <cstddef>
13 #include <memory>
14
15 namespace simgrid {
16 namespace mc {
17
18 class XBT_PRIVATE VisitedState {
19 public:
20   std::shared_ptr<simgrid::mc::Snapshot> system_state = nullptr;
21   std::size_t heap_bytes_used = 0;
22   int actors_count            = 0;
23   int num          = 0; // unique id of that state in the storage of all stored IDs
24   int original_num = 0; // num field of the VisitedState to which I was declared equal to (used for dot_output)
25
26   explicit VisitedState(unsigned long state_number);
27   ~VisitedState() = default;
28 };
29
30 class XBT_PRIVATE VisitedStates {
31   std::vector<std::unique_ptr<simgrid::mc::VisitedState>> states_;
32 public:
33   void clear() { states_.clear(); }
34   std::unique_ptr<simgrid::mc::VisitedState> addVisitedState(unsigned long state_number, simgrid::mc::State* graph_state, bool compare_snpashots);
35 private:
36   void prune();
37 };
38
39 }
40 }
41
42 #endif