Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
spellcheck mc. Don't ask why
[simgrid.git] / src / mc / Checker.hpp
index 478665a..70a9031 100644 (file)
@@ -9,8 +9,11 @@
 
 #include <functional>
 #include <memory>
+#include <string>
 
 #include "src/mc/mc_forward.hpp"
+#include "src/mc/mc_record.h"
+#include "src/mc/Session.hpp"
 
 namespace simgrid {
 namespace mc {
@@ -18,7 +21,7 @@ namespace mc {
 /** A model-checking algorithm
  *
  *  The goal is to move the data/state/configuration of a model-checking
- *  algorihms in subclasses. Implementing this interface will probably
+ *  algorithms in subclasses. Implementing this interface will probably
  *  not be really mandatory, you might be able to write your
  *  model-checking algorithm as plain imperative code instead.
  *
@@ -28,7 +31,7 @@ namespace mc {
 class Checker {
   Session* session_;
 public:
-  Checker(Session& session) : session_(&session) {}
+  Checker(Session& session);
 
   // No copy:
   Checker(Checker const&) = delete;
@@ -37,20 +40,23 @@ public:
   virtual ~Checker();
   virtual int run() = 0;
 
+  // Give me your internal state:
+
+  /** Show the current trace/stack
+   *
+   *  Could this be handled in the Session/ModelChecker instead?
+   */
+  virtual RecordTrace getRecordTrace();
+  virtual std::vector<std::string> getTextualTrace();
+  virtual void logState();
+
 protected:
   Session& getSession() { return *session_; }
 };
 
-/** Adapt a std::function to a checker */
-class FunctionalChecker : public Checker {
-  Session* session_;
-  std::function<int(Session& session)> function_;
-public:
-  FunctionalChecker(Session& session, std::function<int(Session& session)> f)
-    : Checker(session), function_(std::move(f)) {}
-  ~FunctionalChecker();
-  int run() override;
-};
+XBT_PUBLIC() Checker* createLivenessChecker(Session& session);
+XBT_PUBLIC() Checker* createSafetyChecker(Session& session);
+XBT_PUBLIC() Checker* createCommunicationDeterminismChecker(Session& session);
 
 }
 }