Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add implementations for EventSet + Configurations
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 16 Feb 2023 09:10:01 +0000 (10:10 +0100)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Mon, 20 Feb 2023 09:43:53 +0000 (10:43 +0100)
src/mc/explo/udpor/EventSet.cpp
src/mc/explo/udpor/EventSet.hpp

index d6431f9..1ec91db 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/mc/explo/udpor/EventSet.hpp"
+#include "src/mc/explo/udpor/Configuration.hpp"
 
 #include <iterator>
 
@@ -19,6 +20,11 @@ void EventSet::subtract(const EventSet& other)
   this->events_ = std::move(subtracting(other).events_);
 }
 
+void EventSet::subtract(const Configuration& config)
+{
+  subtract(config.get_events());
+}
+
 EventSet EventSet::subtracting(const EventSet& other) const
 {
   std::unordered_set<UnfoldingEvent*> result = this->events_;
@@ -29,6 +35,11 @@ EventSet EventSet::subtracting(const EventSet& other) const
   return EventSet(std::move(result));
 }
 
+EventSet EventSet::subtracting(const Configuration& config) const
+{
+  return subtracting(config.get_events());
+}
+
 EventSet EventSet::subtracting(UnfoldingEvent* e) const
 {
   auto result = this->events_;
@@ -38,7 +49,6 @@ EventSet EventSet::subtracting(UnfoldingEvent* e) const
 
 void EventSet::insert(UnfoldingEvent* e)
 {
-  // TODO: Potentially react if the event is already inserted
   this->events_.insert(e);
 }
 
@@ -47,6 +57,11 @@ void EventSet::form_union(const EventSet& other)
   this->events_ = std::move(make_union(other).events_);
 }
 
+void EventSet::form_union(const Configuration& config)
+{
+  form_union(config.get_events());
+}
+
 EventSet EventSet::make_union(UnfoldingEvent* e) const
 {
   auto result = this->events_;
@@ -64,6 +79,11 @@ EventSet EventSet::make_union(const EventSet& other) const
   return EventSet(std::move(result));
 }
 
+EventSet EventSet::make_union(const Configuration& config) const
+{
+  return make_union(config.get_events());
+}
+
 size_t EventSet::size() const
 {
   return this->events_.size();
index 8539e24..9e5cab9 100644 (file)
@@ -28,24 +28,24 @@ public:
   inline auto begin() const { return this->events_.begin(); }
   inline auto end() const { return this->events_.end(); }
 
-  void remove(UnfoldingEvent* e);
-  void subtract(const EventSet& other);
-  void subtract(const Configuration& other);
-  EventSet subtracting(UnfoldingEvent* e) const;
-  EventSet subtracting(const EventSet& e) const;
-  EventSet subtracting(const Configuration& e) const;
-
-  void insert(UnfoldingEvent* e);
+  void remove(UnfoldingEvent*);
+  void subtract(const EventSet&);
+  void subtract(const Configuration&);
+  EventSet subtracting(UnfoldingEvent*) const;
+  EventSet subtracting(const EventSet&) const;
+  EventSet subtracting(const Configuration&) const;
+
+  void insert(UnfoldingEvent*);
   void form_union(const EventSet&);
   void form_union(const Configuration&);
-  EventSet make_union(UnfoldingEvent* e) const;
+  EventSet make_union(UnfoldingEvent*) const;
   EventSet make_union(const EventSet&) const;
-  EventSet make_union(const Configuration& e) const;
+  EventSet make_union(const Configuration&) const;
 
   size_t size() const;
   bool empty() const;
-  bool contains(UnfoldingEvent* e) const;
-  bool is_subset_of(const EventSet& other) const;
+  bool contains(UnfoldingEvent*) const;
+  bool is_subset_of(const EventSet&) const;
 };
 
 } // namespace simgrid::mc::udpor