1 /* Copyright (c) 2016-2019. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef SIMGRID_MC_CHECKER_HPP
8 #define SIMGRID_MC_CHECKER_HPP
14 #include "src/mc/Session.hpp"
15 #include "src/mc/mc_forward.hpp"
16 #include "src/mc/mc_record.hpp"
21 /** A model-checking algorithm
23 * This is an abstract base class used to group the data, state, configuration
24 * of a model-checking algorithm.
26 * Implementing this interface will probably not be really mandatory,
27 * you might be able to write your model-checking algorithm as plain
28 * imperative code instead.
30 * It is expected to interact with the model-checking core through the
31 * `Session` interface (but currently the `Session` interface does not
32 * have all the necessary features). */
37 explicit Checker(Session& session);
40 Checker(Checker const&) = delete;
41 Checker& operator=(Checker const&) = delete;
43 virtual ~Checker() = default;
45 /** Main function of this algorithm */
46 virtual void run() = 0;
48 /* These methods are callbacks called by the model-checking engine
49 * to get and display information about the current state of the
50 * model-checking algorithm: */
52 /** Show the current trace/stack
54 * Could this be handled in the Session/ModelChecker instead? */
55 virtual RecordTrace getRecordTrace() = 0;
57 /** Generate a textual execution trace of the simulated application */
58 virtual std::vector<std::string> getTextualTrace() = 0;
60 /** Log additional information about the state of the model-checker */
61 virtual void logState() = 0;
64 Session& getSession() { return *session_; }
67 XBT_PUBLIC Checker* createLivenessChecker(Session& session);
68 XBT_PUBLIC Checker* createSafetyChecker(Session& session);
69 XBT_PUBLIC Checker* createCommunicationDeterminismChecker(Session& session);