Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add semantic equivalence to UnfoldingEvent
[simgrid.git] / src / mc / explo / udpor / udpor_tests_private.hpp
1 /* Copyright (c) 2007-2023. 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 /** @file udpor_tests_private.hpp
7  *
8  * A private header file for tests involving events in
9  * configurations
10  */
11
12 #ifndef SIMGRID_MC_UDPOR_TEST_PRIVATE_HPP
13 #define SIMGRID_MC_UDPOR_TEST_PRIVATE_HPP
14
15 #include "src/mc/transition/Transition.hpp"
16
17 namespace simgrid::mc::udpor {
18
19 struct IndependentAction : public Transition {
20   IndependentAction() = default;
21   IndependentAction(Type type, aid_t issuer, int times_considered) : Transition(type, issuer, times_considered) {}
22
23   // Independent with everyone else
24   bool depends(const Transition* other) const override { return false; }
25 };
26
27 struct DependentAction : public Transition {
28   DependentAction() = default;
29   DependentAction(Type type, aid_t issuer, int times_considered) : Transition(type, issuer, times_considered) {}
30
31   // Dependent with everyone else (except IndependentAction)
32   bool depends(const Transition* other) const override
33   {
34     return dynamic_cast<const IndependentAction*>(other) == nullptr;
35   }
36 };
37
38 struct ConditionallyDependentAction : public Transition {
39   ConditionallyDependentAction() = default;
40   ConditionallyDependentAction(Type type, aid_t issuer, int times_considered)
41       : Transition(type, issuer, times_considered)
42   {
43   }
44
45   // Dependent only with DependentAction (i.e. not itself)
46   bool depends(const Transition* other) const override
47   {
48     return dynamic_cast<const DependentAction*>(other) != nullptr;
49   }
50 };
51
52 } // namespace simgrid::mc::udpor
53
54 #endif