Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SafetyChecker::run() uses mc_api
[simgrid.git] / src / mc / mc_api.hpp
1 #ifndef SIMGRID_MC_API_HPP
2 #define SIMGRID_MC_API_HPP
3
4 #include <memory>
5 #include <vector>
6
7 #include "simgrid/forward.h"
8 #include "src/mc/mc_forward.hpp"
9 #include "src/mc/mc_request.hpp"
10 #include "src/mc/mc_state.hpp"
11 #include "xbt/base.h"
12
13 namespace simgrid {
14 namespace mc {
15
16 /*
17 ** This class aimes to implement FACADE APIs for simgrid. The FACADE layer sits between the CheckerSide
18 ** (Unfolding_Checker, DPOR, ...) layer and the
19 ** AppSide layer. The goal is to drill down into the entagled details in the CheckerSide layer and break down the
20 ** detailes in a way that the CheckerSide eventually
21 ** be capable to acquire the required information through the FACADE layer rather than the direct access to the AppSide.
22 */
23
24 class mc_api {
25 private:
26   mc_api() = default;
27
28 public:
29   // No copy:
30   mc_api(mc_api const&) = delete;
31   void operator=(mc_api const&) = delete;
32
33   static mc_api& get()
34   {
35     static mc_api mcapi;
36     return mcapi;
37   }
38
39   void initialize(char** argv);
40
41   // ACTOR FUNCTIONS  
42   std::vector<simgrid::mc::ActorInformation>& get_actors() const;
43   bool actor_is_enabled(aid_t pid) const;
44
45   // MODEL_CHECKER FUNCTIONS
46   ModelChecker* get_model_checker() const;
47   void mc_inc_visited_states() const;
48   void mc_inc_executed_trans() const;
49   unsigned long mc_get_visited_states() const;
50   unsigned long mc_get_executed_trans() const;
51   bool mc_check_deadlock() const;
52   void mc_show_deadlock() const;
53   smx_actor_t mc_smx_simcall_get_issuer(s_smx_simcall const* req) const;
54   void mc_assert(bool notNull, const char* message = "") const;
55   bool mc_is_null() const;
56   Checker* mc_get_checker() const;
57   RemoteSimulation& mc_get_remote_simulation() const;
58   void handle_simcall(Transition const& transition) const;
59   void mc_wait_for_requests() const;
60   void mc_exit(int status) const;
61   std::string const& mc_get_host_name(std::string const& hostname) const;
62   PageStore& mc_page_store() const;
63   void mc_dump_record_path() const;
64   smx_simcall_t mc_state_choose_request(simgrid::mc::State* state) const;
65
66   // SIMCALL FUNCTIONS
67   bool request_depend(smx_simcall_t req1, smx_simcall_t req2) const;
68   std::string request_to_string(smx_simcall_t req, int value, RequestType request_type) const;
69   std::string request_get_dot_output(smx_simcall_t req, int value) const;
70   const char *simix_simcall_name(e_smx_simcall_t kind) const;
71
72   // SNAPSHOT FUNCTIONS
73   bool snapshot_equal(const Snapshot* s1, const Snapshot* s2) const;
74
75   // SESSION FUNCTIONS
76   void s_initialize() const;
77   void s_close() const;
78   void s_restore_initial_state() const;
79   void execute(Transition const& transition);
80   void s_log_state() const;
81 };
82
83 } // namespace mc
84 } // namespace simgrid
85
86 #endif