Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Start moving classes into the mc/api directory
[simgrid.git] / src / mc / api / Transition.cpp
1 /* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "src/mc/api/Transition.hpp"
7 #include "xbt/asserts.h"
8 #include <simgrid/config.h>
9 #if SIMGRID_HAVE_MC
10 #include "src/mc/ModelChecker.hpp"
11 #endif
12
13 #include <sstream>
14
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_transition, mc, "Logging specific to MC transitions");
16
17 namespace simgrid {
18 namespace mc {
19 unsigned long Transition::executed_transitions_ = 0;
20 unsigned long Transition::replayed_transitions_ = 0;
21
22 Transition::~Transition() {
23 } // Make sure that we have a vtable for Transition by putting this virtual function out of the header
24
25 std::string Transition::to_string(bool verbose)
26 {
27   return textual_;
28 }
29 const char* Transition::to_cstring(bool verbose)
30 {
31   to_string();
32   return textual_.c_str();
33 }
34 void Transition::init(aid_t aid, int times_considered)
35 {
36   aid_              = aid;
37   times_considered_ = times_considered;
38 }
39 void Transition::replay() const
40 {
41   replayed_transitions_++;
42
43 #if SIMGRID_HAVE_MC
44   mc_model_checker->handle_simcall(*this, false);
45   mc_model_checker->wait_for_requests();
46 #endif
47 }
48
49 } // namespace mc
50 } // namespace simgrid