Logo AND Algorithmique Numérique Distribuée

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