Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
One less global variable: session_singleton.
[simgrid.git] / src / mc / api.hpp
index 1134b94..f11f70f 100644 (file)
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "simgrid/forward.h"
+#include "src/mc/Session.hpp"
 #include "src/mc/api/State.hpp"
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_record.hpp"
@@ -21,18 +22,6 @@ namespace mc {
 
 XBT_DECLARE_ENUM_CLASS(CheckerAlgorithm, Safety, UDPOR, Liveness, CommDeterminism);
 
-/**
- * @brief Maintains the transition's information.
- */
-struct s_transition_detail {
-  simgrid::simix::Simcall call_ = simgrid::simix::Simcall::NONE;
-  long issuer_id                = -1;
-  RemotePtr<kernel::activity::MailboxImpl> mbox_remote_addr {}; // used to represent mailbox remote address for isend and ireceive transitions
-  RemotePtr<kernel::activity::ActivityImpl> comm_remote_addr {}; // the communication this transition concerns (to be used only for isend, ireceive, wait and test)
-};
-
-using transition_detail_t = std::unique_ptr<s_transition_detail>;
-
 /*
 ** This class aimes to implement FACADE APIs for simgrid. The FACADE layer sits between the CheckerSide
 ** (Unfolding_Checker, DPOR, ...) layer and the
@@ -52,6 +41,8 @@ private:
     }
   };
 
+  std::unique_ptr<simgrid::mc::Session> session_;
+
 public:
   // No copy:
   Api(Api const&) = delete;
@@ -63,16 +54,12 @@ public:
     return api;
   }
 
-  simgrid::mc::Checker* initialize(char** argv, simgrid::mc::CheckerAlgorithm algo) const;
+  simgrid::mc::Exploration* initialize(char** argv, simgrid::mc::CheckerAlgorithm algo);
 
   // ACTOR APIs
   std::vector<simgrid::mc::ActorInformation>& get_actors() const;
   unsigned long get_maxpid() const;
 
-  // COMMUNICATION APIs
-  xbt::string const& get_actor_name(smx_actor_t actor) const;
-  xbt::string const& get_actor_host_name(smx_actor_t actor) const;
-
   // REMOTE APIs
   std::size_t get_remote_heap_bytes() const;
 
@@ -89,12 +76,11 @@ public:
   simgrid::mc::Snapshot* take_snapshot(long num_state) const;
 
   // SESSION APIs
-  void s_close() const;
+  simgrid::mc::Session const& get_session() { return *session_; }
+  void s_close();
 
-// AUTOMATION APIs
-#if SIMGRID_HAVE_MC
+  // AUTOMATION APIs
   void automaton_load(const char* file) const;
-#endif
   std::vector<int> automaton_propositional_symbol_evaluate() const;
   std::vector<xbt_automaton_state_t> get_automaton_state() const;
   int compare_automaton_exp_label(const xbt_automaton_exp_label* l) const;
@@ -103,10 +89,6 @@ public:
   {
     return DerefAndCompareByActorsCountAndUsedHeap();
   }
-  inline int automaton_state_compare(const_xbt_automaton_state_t const& s1, const_xbt_automaton_state_t const& s2) const
-  {
-    return xbt_automaton_state_compare(s1, s2);
-  }
   xbt_automaton_exp_label_t get_automaton_transition_label(xbt_dynar_t const& dynar, int index) const;
   xbt_automaton_state_t get_automaton_transition_dst(xbt_dynar_t const& dynar, int index) const;
 };