Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move the PageStore from ModelChecker to RemoteApp
[simgrid.git] / src / mc / VisitedState.hpp
1 /* Copyright (c) 2007-2023. 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/api/State.hpp"
10 #include "src/mc/sosp/Snapshot.hpp"
11
12 #include <cstddef>
13 #include <memory>
14
15 namespace simgrid::mc {
16
17 class XBT_PRIVATE VisitedState {
18 public:
19   std::shared_ptr<simgrid::mc::Snapshot> system_state_ = nullptr;
20   std::size_t heap_bytes_used_                         = 0;
21   int actor_count_;
22   long num_;               // unique id of that state in the storage of all stored IDs
23   long original_num_ = -1; // num field of the VisitedState to which I was declared equal to (used for dot_output)
24
25   explicit VisitedState(unsigned long state_number, unsigned int actor_count, RemoteApp& remote_app);
26 };
27
28 class XBT_PRIVATE VisitedStates {
29   std::vector<std::unique_ptr<simgrid::mc::VisitedState>> states_;
30 public:
31   void clear() { states_.clear(); }
32   std::unique_ptr<simgrid::mc::VisitedState> addVisitedState(unsigned long state_number,
33                                                              simgrid::mc::State* graph_state, RemoteApp& remote_app);
34
35 private:
36   void prune();
37 };
38
39 } // namespace simgrid::mc
40
41 #endif