Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add implementations for EventSet + Configurations
[simgrid.git] / src / mc / explo / udpor / EventSet.hpp
1 /* Copyright (c) 2007-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 #ifndef SIMGRID_MC_UDPOR_EVENT_SET_HPP
7 #define SIMGRID_MC_UDPOR_EVENT_SET_HPP
8
9 #include "src/mc/explo/udpor/udpor_forward.hpp"
10
11 #include <cstddef>
12 #include <unordered_set>
13
14 namespace simgrid::mc::udpor {
15
16 class EventSet {
17 private:
18   std::unordered_set<UnfoldingEvent*> events_;
19   explicit EventSet(std::unordered_set<UnfoldingEvent*>&& raw_events) : events_(raw_events) {}
20
21 public:
22   EventSet()                           = default;
23   EventSet(const EventSet&)            = default;
24   EventSet& operator=(const EventSet&) = default;
25   EventSet& operator=(EventSet&&)      = default;
26   EventSet(EventSet&&)                 = default;
27
28   inline auto begin() const { return this->events_.begin(); }
29   inline auto end() const { return this->events_.end(); }
30
31   void remove(UnfoldingEvent*);
32   void subtract(const EventSet&);
33   void subtract(const Configuration&);
34   EventSet subtracting(UnfoldingEvent*) const;
35   EventSet subtracting(const EventSet&) const;
36   EventSet subtracting(const Configuration&) const;
37
38   void insert(UnfoldingEvent*);
39   void form_union(const EventSet&);
40   void form_union(const Configuration&);
41   EventSet make_union(UnfoldingEvent*) const;
42   EventSet make_union(const EventSet&) const;
43   EventSet make_union(const Configuration&) const;
44
45   size_t size() const;
46   bool empty() const;
47   bool contains(UnfoldingEvent*) const;
48   bool is_subset_of(const EventSet&) const;
49 };
50
51 } // namespace simgrid::mc::udpor
52 #endif