Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
8f7e0cc2e6f70dc9822d85bba26f190cf597f051
[simgrid.git] / src / mc / Checker.hpp
1 /* Copyright (c) 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_CHECKER_HPP
8 #define SIMGRID_MC_CHECKER_HPP
9
10 #include <functional>
11 #include <memory>
12 #include <string>
13
14 #include "src/mc/mc_forward.hpp"
15 #include "src/mc/mc_record.h"
16 #include "src/mc/Session.hpp"
17
18 namespace simgrid {
19 namespace mc {
20
21 /** A model-checking algorithm
22  *
23  *  The goal is to move the data/state/configuration of a model-checking
24  *  algorihms in subclasses. Implementing this interface will probably
25  *  not be really mandatory, you might be able to write your
26  *  model-checking algorithm as plain imperative code instead.
27  *
28  *  It works by manipulating a model-checking Session.
29  */
30 // abstract
31 class Checker {
32   Session* session_;
33 public:
34   Checker(Session& session);
35
36   // No copy:
37   Checker(Checker const&) = delete;
38   Checker& operator=(Checker const&) = delete;
39
40   virtual ~Checker();
41   virtual int run() = 0;
42
43   // Give me your internal state:
44
45   /** Show the current trace/stack
46    *
47    *  Could this be handled in the Session/ModelChecker instead?
48    */
49   virtual RecordTrace getRecordTrace();
50   virtual std::vector<std::string> getTextualTrace();
51
52 protected:
53   Session& getSession() { return *session_; }
54 };
55
56 XBT_PUBLIC() Checker* createLivenessChecker(Session& session);
57 XBT_PUBLIC() Checker* createSafetyChecker(Session& session);
58 XBT_PUBLIC() Checker* createCommunicationDeterminismChecker(Session& session);
59
60 }
61 }
62
63 #endif