Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
clang-format broke my commit
[simgrid.git] / src / mc / checker / 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/VisitedState.hpp"
16 #include "src/mc/checker/Checker.hpp"
17 #include "src/mc/mc_forward.hpp"
18 #include "src/mc/mc_safety.h"
19
20 namespace simgrid {
21 namespace mc {
22
23 class XBT_PRIVATE SafetyChecker : public Checker {
24   simgrid::mc::ReductionMode reductionMode_ = simgrid::mc::ReductionMode::unset;
25 public:
26   SafetyChecker(Session& session);
27   ~SafetyChecker();
28   void run() override;
29   RecordTrace getRecordTrace() override;
30   std::vector<std::string> getTextualTrace() override;
31   void logState() override;
32 private:
33   void checkNonTermination(simgrid::mc::State* current_state);
34   void backtrack();
35   void restoreState();
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   unsigned long expandedStatesCount_ = 0;
42 };
43
44 }
45 }
46
47 #endif