1 /* Copyright (c) 2016-2021. 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"
15 /** A model-checking algorithm
17 * This is an abstract base class used to group the data, state, configuration
18 * of a model-checking algorithm.
20 * Implementing this interface will probably not be really mandatory,
21 * you might be able to write your model-checking algorithm as plain
22 * imperative code instead.
24 * It is expected to interact with the model-checking core through the
25 * `Session` interface (but currently the `Session` interface does not
26 * have all the necessary features). */
32 explicit Checker(Session* session) : session_(session) {}
35 Checker(Checker const&) = delete;
36 Checker& operator=(Checker const&) = delete;
38 virtual ~Checker() = default;
40 /** Main function of this algorithm */
41 virtual void run() = 0;
43 /* These methods are callbacks called by the model-checking engine
44 * to get and display information about the current state of the
45 * model-checking algorithm: */
47 /** Show the current trace/stack
49 * Could this be handled in the Session/ModelChecker instead? */
50 virtual RecordTrace get_record_trace() = 0;
52 /** Generate a textual execution trace of the simulated application */
53 virtual std::vector<std::string> get_textual_trace() = 0;
55 /** Log additional information about the state of the model-checker */
56 virtual void log_state() = 0;
58 Session* get_session() { return session_; }
61 // External constructors so that the types (and the types of their content) remain hidden
62 XBT_PUBLIC Checker* createLivenessChecker(Session* session);
63 XBT_PUBLIC Checker* createSafetyChecker(Session* session);
64 XBT_PUBLIC Checker* createCommunicationDeterminismChecker(Session* session);
65 XBT_PUBLIC Checker* createUdporChecker(Session* session);
68 } // namespace simgrid