Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
88f4b82dc7f132d121c78030fda10ef09f0b8d5b
[simgrid.git] / src / mc / explo / udpor / UnfoldingEvent.cpp
1 /* Copyright (c) 2008-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 #include "src/mc/explo/udpor/UnfoldingEvent.hpp"
7 #include "src/mc/explo/udpor/History.hpp"
8
9 namespace simgrid::mc::udpor {
10
11 UnfoldingEvent::UnfoldingEvent(std::initializer_list<const UnfoldingEvent*> init_list)
12     : UnfoldingEvent(EventSet(std::move(init_list)))
13 {
14 }
15
16 UnfoldingEvent::UnfoldingEvent(EventSet immediate_causes, std::shared_ptr<Transition> transition)
17     : associated_transition(std::move(transition)), immediate_causes(std::move(immediate_causes))
18 {
19 }
20
21 bool UnfoldingEvent::operator==(const UnfoldingEvent& other) const
22 {
23   const bool same_actor = associated_transition->aid_ == other.associated_transition->aid_;
24   if (!same_actor)
25     return false;
26
27   // TODO: Add in information to determine which step in the sequence this actor was executed
28
29   // All unfolding event objects are created in reference to
30   // an Unfolding object which owns them. Hence, the references
31   // they contain to other events in the unfolding can
32   // be used as intrinsic identities (i.e. we don't need to
33   // recursively check if each of our causes has a `==` in
34   // the other event's causes)
35   return this->immediate_causes == other.immediate_causes;
36 }
37
38 EventSet UnfoldingEvent::get_history() const
39 {
40   return History(this).get_all_events();
41 }
42
43 } // namespace simgrid::mc::udpor