X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2a105483866fd7f38290441de92d168596f83cc7..669d793c17f7ff44ba4b111d36d1f63512f64195:/src/mc/explo/udpor/Unfolding.cpp diff --git a/src/mc/explo/udpor/Unfolding.cpp b/src/mc/explo/udpor/Unfolding.cpp index 84ad822cfe..6a81ff205e 100644 --- a/src/mc/explo/udpor/Unfolding.cpp +++ b/src/mc/explo/udpor/Unfolding.cpp @@ -9,12 +9,20 @@ namespace simgrid::mc::udpor { +void Unfolding::remove(const EventSet& events) +{ + for (const auto e : events) { + remove(e); + } +} + void Unfolding::remove(const UnfoldingEvent* e) { if (e == nullptr) { throw std::invalid_argument("Expected a non-null pointer to an event, but received NULL"); } this->global_events_.erase(e); + this->event_handles.remove(e); } void Unfolding::insert(std::unique_ptr e) @@ -29,6 +37,7 @@ void Unfolding::insert(std::unique_ptr e) } // Map the handle to its owner + this->event_handles.insert(handle); this->global_events_[handle] = std::move(e); } @@ -36,7 +45,7 @@ bool Unfolding::contains_event_equivalent_to(const UnfoldingEvent* e) const { // Notice the use of `==` equality here. `e` may not be contained in the // unfolding; but some event which is "equivalent" to it could be. - for (const auto& [event, _] : global_events_) { + for (const auto event : *this) { if (*event == *e) { return true; } @@ -44,4 +53,17 @@ bool Unfolding::contains_event_equivalent_to(const UnfoldingEvent* e) const return false; } +EventSet Unfolding::get_immediate_conflicts_of(const UnfoldingEvent* e) const +{ + EventSet immediate_conflicts; + + for (const auto event : *this) { + if (event->immediately_conflicts_with(e)) { + immediate_conflicts.insert(e); + } + } + + return immediate_conflicts; +} + } // namespace simgrid::mc::udpor