1 /* Copyright (c) 2015-2023. 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 #ifndef SIMGRID_MC_TRANSITION_ANY_HPP
7 #define SIMGRID_MC_TRANSITION_ANY_HPP
9 #include "src/kernel/actor/SimcallObserver.hpp"
10 #include "src/mc/transition/Transition.hpp"
11 #include "src/mc/transition/TransitionComm.hpp"
17 namespace simgrid::mc {
19 class TestAnyTransition : public Transition {
20 std::vector<Transition*> transitions_;
23 TestAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream);
24 std::string to_string(bool verbose) const override;
25 bool depends(const Transition* other) const override;
26 bool reversible_race(const Transition* other) const override;
28 Transition* get_current_transition() const { return transitions_.at(times_considered_); }
31 return std::any_of(begin(transitions_), end(transitions_), [](const Transition* transition) {
32 const auto* tested_transition = static_cast<const CommTestTransition*>(transition);
33 return (tested_transition->get_sender() != -1 && tested_transition->get_receiver() != -1);
38 class WaitAnyTransition : public Transition {
39 std::vector<Transition*> transitions_;
42 WaitAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream);
43 std::string to_string(bool verbose) const override;
44 bool depends(const Transition* other) const override;
45 bool reversible_race(const Transition* other) const override;
47 Transition* get_current_transition() const { return transitions_.at(times_considered_); }
50 } // namespace simgrid::mc