Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc_api::set_checker() defined and called in Checker()
authorEhsan Azimi <eazimi@ehsan.irisa.fr>
Fri, 11 Dec 2020 12:32:12 +0000 (13:32 +0100)
committerEhsan Azimi <eazimi@ehsan.irisa.fr>
Fri, 11 Dec 2020 12:32:12 +0000 (13:32 +0100)
src/mc/checker/Checker.cpp [deleted file]
src/mc/checker/Checker.hpp
src/mc/mc_api.cpp
src/mc/mc_api.hpp
tools/cmake/DefinePackages.cmake

diff --git a/src/mc/checker/Checker.cpp b/src/mc/checker/Checker.cpp
deleted file mode 100644 (file)
index 12c1281..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2016-2020. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "src/mc/checker/Checker.hpp"
-#include "src/mc/ModelChecker.hpp"
-#include "xbt/asserts.h"
-
-namespace simgrid {
-namespace mc {
-
-Checker::Checker()
-{
-  xbt_assert(mc_model_checker);
-  xbt_assert(mc_model_checker->getChecker() == nullptr);
-  mc_model_checker->setChecker(this);
-}
-
-} // namespace mc
-} // namespace simgrid
index 75a3866..eca11f4 100644 (file)
@@ -7,9 +7,7 @@
 #ifndef SIMGRID_MC_CHECKER_HPP
 #define SIMGRID_MC_CHECKER_HPP
 
-//#include "src/mc/Session.hpp"
-#include "src/mc/mc_forward.hpp"
-#include "src/mc/mc_record.hpp"
+#include "src/mc/mc_api.hpp"
 
 namespace simgrid {
 namespace mc {
@@ -29,7 +27,7 @@ namespace mc {
 // abstract
 class Checker {
 public:
-  explicit Checker();
+  inline explicit Checker() { mc_api::get().set_checker(this); }
 
   // No copy:
   Checker(Checker const&) = delete;
index 4b27ad2..c6286dd 100644 (file)
@@ -5,7 +5,6 @@
 #include "src/mc/Session.hpp"
 #include "src/mc/mc_comm_pattern.hpp"
 #include "src/mc/mc_private.hpp"
-#include "src/mc/mc_record.hpp"
 #include "src/mc/mc_smx.hpp"
 #include "src/mc/remote/RemoteSimulation.hpp"
 #include "src/mc/mc_pattern.hpp"
@@ -417,6 +416,13 @@ Checker* mc_api::mc_get_checker() const
   return mc_model_checker->getChecker();
 }
 
+void mc_api::set_checker(Checker* const checker) const
+{
+  xbt_assert(mc_model_checker);
+  xbt_assert(mc_model_checker->getChecker() == nullptr);
+  mc_model_checker->setChecker(checker);
+}
+
 RemoteSimulation& mc_api::mc_get_remote_simulation() const
 {
   return mc_model_checker->get_remote_simulation();
index f539343..4606f75 100644 (file)
@@ -8,6 +8,7 @@
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_request.hpp"
 #include "src/mc/mc_state.hpp"
+#include "src/mc/mc_record.hpp"
 #include "xbt/automaton.hpp"
 #include "xbt/base.h"
 
@@ -83,6 +84,7 @@ public:
   void mc_show_deadlock() const;
   bool mc_is_null() const;
   Checker* mc_get_checker() const;
+  void set_checker(Checker* const checker) const;
   RemoteSimulation& mc_get_remote_simulation() const;
   void handle_simcall(Transition const& transition) const;
   void mc_wait_for_requests() const;
index ecf6006..7ef9b69 100644 (file)
@@ -599,7 +599,6 @@ set(MC_SRC_BASE
   )
 
 set(MC_SRC
-  src/mc/checker/Checker.cpp
   src/mc/checker/Checker.hpp
   src/mc/checker/CommunicationDeterminismChecker.cpp
   src/mc/checker/CommunicationDeterminismChecker.hpp