Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Add documentation and fix some things
[simgrid.git] / src / mc / SafetyChecker.hpp
1 /* Copyright (c) 2008-2016. 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_SAFETY_CHECKER_HPP
8 #define SIMGRID_MC_SAFETY_CHECKER_HPP
9
10 #include <list>
11 #include <memory>
12 #include <string>
13 #include <vector>
14
15 #include "src/mc/mc_forward.hpp"
16 #include "src/mc/Checker.hpp"
17 #include "src/mc/VisitedState.hpp"
18
19 namespace simgrid {
20 namespace mc {
21
22 class XBT_PRIVATE SafetyChecker : public Checker {
23   simgrid::mc::ReductionMode reductionMode_ = simgrid::mc::ReductionMode::unset;
24 public:
25   SafetyChecker(Session& session);
26   ~SafetyChecker();
27   int run() override;
28   RecordTrace getRecordTrace() override;
29   std::vector<std::string> getTextualTrace() override;
30   void logState() override;
31 private:
32   // Temp
33   void init();
34   bool checkNonTermination(simgrid::mc::State* current_state);
35   int backtrack();
36   void restoreState();
37 private:
38   /** Stack representing the position in the exploration graph */
39   std::list<std::unique_ptr<simgrid::mc::State>> stack_;
40   simgrid::mc::VisitedStates visitedStates_;
41   std::unique_ptr<simgrid::mc::VisitedState> visitedState_;
42   unsigned long expandedStatesCount_ = 0;
43 };
44
45 }
46 }
47
48 #endif