1 /* Copyright (c) 2016-2022. 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
10 #include "src/mc/api.hpp"
12 namespace simgrid::mc {
14 /** A model-checking exploration algorithm
16 * This is an abstract base class used to group the data, state, configuration
17 * of a model-checking algorithm.
19 * Implementing this interface will probably not be really mandatory,
20 * you might be able to write your model-checking algorithm as plain
21 * imperative code instead.
23 * It is expected to interact with the model-checking core through the
24 * `Session` interface (but currently the `Session` interface does not
25 * have all the necessary features). */
27 class Exploration : public xbt::Extendable<Exploration> {
31 explicit Exploration(Session* session) : session_(session) {}
34 Exploration(Exploration const&) = delete;
35 Exploration& operator=(Exploration const&) = delete;
37 virtual ~Exploration() = default;
39 /** Main function of this algorithm */
40 virtual void run() = 0;
42 /* These methods are callbacks called by the model-checking engine
43 * to get and display information about the current state of the
44 * model-checking algorithm: */
46 /** Show the current trace/stack
48 * Could this be handled in the Session/ModelChecker instead? */
49 virtual RecordTrace get_record_trace() = 0;
51 /** Generate a textual execution trace of the simulated application */
52 virtual std::vector<std::string> get_textual_trace() = 0;
54 /** Log additional information about the state of the model-checker */
55 virtual void log_state() = 0;
57 Session& get_session() { return *session_; }
60 // External constructors so that the types (and the types of their content) remain hidden
61 XBT_PUBLIC Exploration* create_liveness_checker(Session* session);
62 XBT_PUBLIC Exploration* create_dfs_exploration(Session* session);
63 XBT_PUBLIC Exploration* create_communication_determinism_checker(Session* session);
64 XBT_PUBLIC Exploration* create_udpor_checker(Session* session);
66 } // namespace simgrid::mc