1 /* Copyright (c) 2007-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_UDPOR_UNFOLDING_EVENT_HPP
7 #define SIMGRID_MC_UDPOR_UNFOLDING_EVENT_HPP
9 #include "src/mc/explo/udpor/EventSet.hpp"
10 #include "src/mc/explo/udpor/udpor_forward.hpp"
11 #include "src/mc/transition/Transition.hpp"
16 namespace simgrid::mc::udpor {
18 class UnfoldingEvent {
20 UnfoldingEvent(std::shared_ptr<Transition> transition, EventSet immediate_causes, unsigned long event_id = 0);
22 UnfoldingEvent(const UnfoldingEvent&) = default;
23 UnfoldingEvent& operator=(UnfoldingEvent const&) = default;
24 UnfoldingEvent(UnfoldingEvent&&) = default;
26 EventSet get_history() const;
27 bool in_history_of(const UnfoldingEvent* otherEvent) const;
29 bool conflicts_with(const UnfoldingEvent* otherEvent) const;
30 bool conflicts_with(const Configuration& config) const;
31 bool immediately_conflicts_with(const UnfoldingEvent* otherEvt) const;
33 Transition* get_transition() const { return this->associated_transition.get(); }
35 bool operator==(const UnfoldingEvent&) const;
39 * @brief The transition that UDPOR "attaches" to this
40 * specific event for later use while computing e.g. extension
43 * The transition points to that of a particular actor
44 * in the state reached by the configuration C (recall
45 * this is denoted `state(C)`) that excludes this event.
46 * In other words, this transition was the "next" event
47 * of the actor that executes it in `state(C)`.
49 std::shared_ptr<Transition> associated_transition;
52 * @brief The "immediate" causes of this event.
54 * An event `e` is an immediate cause of an event `e'` if
57 * 2. There is no event `e''` in E such that
58 * `e < e''` and `e'' < e'`
60 * Intuitively, an immediate cause "happened right before"
61 * this event was executed. It is sufficient to store
62 * only the immediate causes of any event `e`, as any indirect
63 * causes of that event would either be an indirect cause
64 * or an immediate cause of the immediate causes of `e`, and
67 EventSet immediate_causes;
69 unsigned long event_id = 0;
72 } // namespace simgrid::mc::udpor