X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e27e197d20bda6dec2518d1aebd51dda39844ba7..c01e4bd2bda6eef36cba3a20241b6f8cff23f102:/src/mc/udpor_global.cpp diff --git a/src/mc/udpor_global.cpp b/src/mc/udpor_global.cpp index b06b02a277..bd38ee7b74 100644 --- a/src/mc/udpor_global.cpp +++ b/src/mc/udpor_global.cpp @@ -5,11 +5,31 @@ #include "udpor_global.hpp" #include "xbt/log.h" +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_udpor_global, mc, "udpor_global"); namespace simgrid { namespace mc { +EventSet EvtSetTools::makeUnion(const EventSet& s1, const EventSet& s2) +{ + EventSet res = s1; + for (auto evt : s2) + EvtSetTools::pushBack(res, evt); + return res; +} + +void EvtSetTools::pushBack(EventSet& events, UnfoldingEvent* e) +{ + if (!EvtSetTools::contains(events, e)) + events.push_back(e); +} + +bool EvtSetTools::contains(const EventSet& events, const UnfoldingEvent* e) +{ + return std::any_of(events.begin(), events.end(), [e](const UnfoldingEvent* evt) { return *evt == *e; }); +} + } // namespace mc } // namespace simgrid