1 /* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved. */
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. */
6 #include "src/mc/transition/TransitionAny.hpp"
7 #include "xbt/asserts.h"
8 #include <simgrid/config.h>
10 #include "src/mc/ModelChecker.hpp"
11 #include "src/mc/Session.hpp"
12 #include "src/mc/api/State.hpp"
17 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_trans_any, mc_transition, "Logging specific to MC WaitAny / TestAny transitions");
22 TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream)
23 : Transition(Type::TESTANY, issuer, times_considered)
26 xbt_assert(stream >> size);
27 for (int i = 0; i < size; i++) {
28 Transition* t = deserialize_transition(issuer, 0, stream);
29 XBT_DEBUG("TestAny received a transition %s", t->to_string(true).c_str());
30 transitions_.push_back(t);
33 std::string TestAnyTransition::to_string(bool verbose) const
35 auto res = xbt::string_printf("%ld: TestAny{ ", aid_);
36 for (auto const* t : transitions_)
37 res += t->to_string(verbose);
41 bool TestAnyTransition::depends(const Transition* other) const
43 return transitions_[times_considered_]->depends(other);
45 WaitAnyTransition::WaitAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream)
46 : Transition(Type::WAITANY, issuer, times_considered)
49 xbt_assert(stream >> size);
50 for (int i = 0; i < size; i++) {
51 Transition* t = deserialize_transition(issuer, 0, stream);
52 transitions_.push_back(t);
55 std::string WaitAnyTransition::to_string(bool verbose) const
57 auto res = xbt::string_printf("%ld: WaitAny{ ", aid_);
58 for (auto const* t : transitions_)
59 res += t->to_string(verbose);
63 bool WaitAnyTransition::depends(const Transition* other) const
65 return transitions_[times_considered_]->depends(other);
69 } // namespace simgrid