-/* Copyright (c) 2016. The SimGrid Team.
+/* Copyright (c) 2016-2021. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#ifndef SIMGRID_MC_CHECKER_HPP
#define SIMGRID_MC_CHECKER_HPP
-#include <functional>
-#include <memory>
-#include <string>
-
-#include "src/mc/mc_forward.hpp"
-#include "src/mc/mc_record.h"
-#include "src/mc/Session.hpp"
+#include "src/mc/api.hpp"
namespace simgrid {
namespace mc {
* have all the necessary features). */
// abstract
class Checker {
- Session* session_;
public:
- explicit Checker(Session& session);
+ inline explicit Checker() { Api::get().set_checker(this); }
// No copy:
Checker(Checker const&) = delete;
Checker& operator=(Checker const&) = delete;
- virtual ~Checker();
+ virtual ~Checker() = default;
/** Main function of this algorithm */
virtual void run() = 0;
/** Show the current trace/stack
*
* Could this be handled in the Session/ModelChecker instead? */
- virtual RecordTrace getRecordTrace();
+ virtual RecordTrace get_record_trace() = 0;
/** Generate a textual execution trace of the simulated application */
- virtual std::vector<std::string> getTextualTrace();
+ virtual std::vector<std::string> get_textual_trace() = 0;
/** Log additional information about the state of the model-checker */
- virtual void logState();
-
-protected:
- Session& getSession() { return *session_; }
+ virtual void log_state() = 0;
};
-XBT_PUBLIC() Checker* createLivenessChecker(Session& session);
-XBT_PUBLIC() Checker* createSafetyChecker(Session& session);
-XBT_PUBLIC() Checker* createCommunicationDeterminismChecker(Session& session);
+// External constructors so that the types (and the types of their content) remain hidden
+XBT_PUBLIC Checker* createLivenessChecker();
+XBT_PUBLIC Checker* createSafetyChecker();
+XBT_PUBLIC Checker* createCommunicationDeterminismChecker();
+XBT_PUBLIC Checker* createUdporChecker();
-}
-}
+} // namespace mc
+} // namespace simgrid
#endif