Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Inline a function of mc::api
[simgrid.git] / src / mc / Transition.cpp
index 5167e2273eb510f3e8c372a0404c2ec7825112ba..134452e310efdcf3f5e75ea9ecff0c00ed28fb09 100644 (file)
@@ -4,25 +4,48 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/mc/Transition.hpp"
-#include "src/mc/ModelChecker.hpp"
-#include "src/mc/Session.hpp"
+#include "src/mc/TransitionComm.hpp"
 #include "xbt/asserts.h"
+#include <simgrid/config.h>
+#if SIMGRID_HAVE_MC
+#include "src/mc/ModelChecker.hpp"
+#endif
+
+#include <sstream>
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_transition, mc, "Logging specific to MC transitions");
 
 namespace simgrid {
 namespace mc {
 unsigned long Transition::executed_transitions_ = 0;
+unsigned long Transition::replayed_transitions_ = 0;
 
-std::string Transition::to_string()
-{
-  xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
+Transition::~Transition() {
+} // Make sure that we have a vtable for Transition by putting this virtual function out of the header
 
+std::string Transition::to_string(bool verbose)
+{
   return textual_;
 }
-RemotePtr<simgrid::kernel::actor::SimcallObserver> Transition::execute()
+const char* Transition::to_cstring(bool verbose)
 {
-  textual_ = mc_model_checker->simcall_to_string(aid_, times_considered_);
-  executed_transitions_++;
-  return session_singleton->execute(*this);
+  to_string();
+  return textual_.c_str();
 }
+void Transition::init(aid_t aid, int times_considered)
+{
+  aid_              = aid;
+  times_considered_ = times_considered;
+}
+void Transition::replay() const
+{
+  replayed_transitions_++;
+
+#if SIMGRID_HAVE_MC
+  mc_model_checker->handle_simcall(*this, false);
+  mc_model_checker->wait_for_requests();
+#endif
+}
+
 } // namespace mc
 } // namespace simgrid