Logo AND Algorithmique Numérique Distribuée

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