Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / mc / explo / udpor / UnfoldingEvent.hpp
index 1a9bae5..aeb4902 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/mc/explo/udpor/udpor_forward.hpp"
 #include "src/mc/transition/Transition.hpp"
 
+#include <initializer_list>
 #include <memory>
 #include <string>
 
@@ -17,24 +18,36 @@ namespace simgrid::mc::udpor {
 
 class UnfoldingEvent {
 public:
-  UnfoldingEvent(std::shared_ptr<Transition> transition = std::make_unique<Transition>(),
-                 EventSet immediate_causes = EventSet(), unsigned long event_id = 0);
+  explicit UnfoldingEvent(std::initializer_list<const UnfoldingEvent*> init_list);
+  UnfoldingEvent(EventSet immediate_causes              = EventSet(),
+                 std::shared_ptr<Transition> transition = std::make_unique<Transition>());
 
   UnfoldingEvent(const UnfoldingEvent&)            = default;
   UnfoldingEvent& operator=(UnfoldingEvent const&) = default;
   UnfoldingEvent(UnfoldingEvent&&)                 = default;
 
   EventSet get_history() const;
-  bool in_history_of(const UnfoldingEvent* otherEvent) const;
+  bool in_history_of(const UnfoldingEvent* other) const;
+  bool related_to(const UnfoldingEvent* other) const;
 
-  bool conflicts_with(const UnfoldingEvent* otherEvent) const;
+  /// @brief Whether or not this event is in conflict with
+  /// the given one (i.e. whether `this # other`)
+  bool conflicts_with(const UnfoldingEvent* other) const;
+
+  /// @brief Whether or not this event is in conflict with
+  /// any event in the given configuration
   bool conflicts_with(const Configuration& config) const;
-  bool immediately_conflicts_with(const UnfoldingEvent* otherEvt) const;
+
+  /// @brief Computes "this #ⁱ other"
+  bool immediately_conflicts_with(const UnfoldingEvent* other) const;
+  bool is_dependent_with(const Transition*) const;
+  bool is_dependent_with(const UnfoldingEvent* other) const;
 
   const EventSet& get_immediate_causes() const { return this->immediate_causes; }
   Transition* get_transition() const { return this->associated_transition.get(); }
 
   bool operator==(const UnfoldingEvent&) const;
+  bool operator!=(const UnfoldingEvent& other) const { return not(*this == other); }
 
 private:
   /**
@@ -67,8 +80,6 @@ private:
    * so on.
    */
   EventSet immediate_causes;
-
-  unsigned long event_id = 0;
 };
 
 } // namespace simgrid::mc::udpor