Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Delegate some part of Session::logState() to Checker::logState()
[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 private:
37   /** Stack representing the position in the exploration graph */
38   std::list<std::unique_ptr<simgrid::mc::State>> stack_;
39   simgrid::mc::VisitedStates visitedStates_;
40   std::unique_ptr<simgrid::mc::VisitedState> visitedState_;
41 };
42
43 }
44 }
45
46 #endif