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_EVENT_SET_HPP
7 #define SIMGRID_MC_UDPOR_EVENT_SET_HPP
9 #include "src/mc/explo/udpor/udpor_forward.hpp"
12 #include <initializer_list>
13 #include <unordered_set>
15 namespace simgrid::mc::udpor {
19 std::unordered_set<UnfoldingEvent*> events_;
23 EventSet(const EventSet&) = default;
24 EventSet& operator=(const EventSet&) = default;
25 EventSet& operator=(EventSet&&) = default;
26 EventSet(EventSet&&) = default;
27 explicit EventSet(std::unordered_set<UnfoldingEvent*>&& raw_events) : events_(raw_events) {}
28 explicit EventSet(std::initializer_list<UnfoldingEvent*> event_list) : events_(std::move(event_list)) {}
30 auto begin() const { return this->events_.begin(); }
31 auto end() const { return this->events_.end(); }
32 auto cbegin() const { return this->events_.cbegin(); }
33 auto cend() const { return this->events_.cend(); }
35 void remove(UnfoldingEvent*);
36 void subtract(const EventSet&);
37 void subtract(const Configuration&);
38 EventSet subtracting(UnfoldingEvent*) const;
39 EventSet subtracting(const EventSet&) const;
40 EventSet subtracting(const Configuration&) const;
42 void insert(UnfoldingEvent*);
43 void form_union(const EventSet&);
44 void form_union(const Configuration&);
45 EventSet make_union(UnfoldingEvent*) const;
46 EventSet make_union(const EventSet&) const;
47 EventSet make_union(const Configuration&) const;
51 bool contains(UnfoldingEvent*) const;
52 bool is_subset_of(const EventSet&) const;
54 bool operator==(const EventSet& other) const { return this->events_ == other.events_; }
55 bool operator!=(const EventSet& other) const { return this->events_ != other.events_; }
58 } // namespace simgrid::mc::udpor