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_HPP
7 #define SIMGRID_MC_UDPOR_UNFOLDING_HPP
9 #include "src/mc/explo/udpor/UnfoldingEvent.hpp"
10 #include "src/mc/explo/udpor/udpor_forward.hpp"
13 #include <unordered_map>
15 namespace simgrid::mc::udpor {
20 * @brief All of the events that are currently are a part of the unfolding
22 * @invariant Each unfolding event maps itself to the owner of that event,
23 * i.e. the unique pointer that owns the address. The Unfolding owns all
24 * of the addresses that are referenced by EventSet instances and Configuration
25 * instances. UDPOR guarantees that events are persisted for as long as necessary
27 std::unordered_map<const UnfoldingEvent*, std::unique_ptr<UnfoldingEvent>> global_events_;
30 Unfolding() = default;
31 Unfolding& operator=(Unfolding&&) = default;
32 Unfolding(Unfolding&&) = default;
34 void remove(const UnfoldingEvent* e);
35 void insert(std::unique_ptr<UnfoldingEvent> e);
36 bool contains_event_equivalent_to(const UnfoldingEvent* e) const;
38 size_t size() const { return this->global_events_.size(); }
39 bool empty() const { return this->global_events_.empty(); }
42 } // namespace simgrid::mc::udpor