Logo AND Algorithmique Numérique Distribuée

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