Logo AND Algorithmique Numérique Distribuée

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