explicit EventSet(std::unordered_set<UnfoldingEvent*>&& raw_events) : events_(raw_events) {}
explicit EventSet(std::initializer_list<UnfoldingEvent*> event_list) : events_(std::move(event_list)) {}
- inline auto begin() const { return this->events_.begin(); }
- inline auto end() const { return this->events_.end(); }
+ auto begin() const { return this->events_.begin(); }
+ auto end() const { return this->events_.end(); }
+ auto cbegin() const { return this->events_.cbegin(); }
+ auto cend() const { return this->events_.cend(); }
void remove(UnfoldingEvent*);
void subtract(const EventSet&);
* dependency graph for all events in this history
*/
EventSet get_all_events() const;
-
- EventSet get_event_diff_with(const EventSet& event_set) const;
EventSet get_event_diff_with(const Configuration& config) const;
};
{
}
-bool UnfoldingEvent::operator==(const UnfoldingEvent&) const
+bool UnfoldingEvent::operator==(const UnfoldingEvent& other) const
{
- // TODO: Implement semantic equality
- return false;
+ const bool same_actor = associated_transition->aid_ == other.associated_transition->aid_;
+ if (!same_actor)
+ return false;
+
+ // TODO: Add in information to determine which step in the sequence this actor was executed
+
+ // All unfolding event objects are created in reference to
+ // an Unfolding object which owns them. Hence, the references
+ // they contain to other events in the unvolding can
+ // be used as intrinsic identities (i.e. we don't need to
+ // recursively check if each of our causes has a `==` in
+ // the other event's causes)
+ return this->immediate_causes == other.immediate_causes;
}
} // namespace simgrid::mc::udpor
bool conflicts_with(const Configuration& config) const;
bool immediately_conflicts_with(const UnfoldingEvent* otherEvt) 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;