Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
EvtSetTools::pushBack() implemented
[simgrid.git] / src / mc / udpor_global.cpp
1 /* Copyright (c) 2008-2021. 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 #include "udpor_global.hpp"
7 #include "xbt/log.h"
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_udpor_global, mc, "udpor_global");
10
11 namespace simgrid {
12 namespace mc {
13
14 void EvtSetTools::pushBack(EventSet& events, UnfoldingEvent* e)
15 {
16   if (!EvtSetTools::contains(events, e))
17     events.push_back(e);
18 }
19
20 bool EvtSetTools::contains(const EventSet events, const UnfoldingEvent* e)
21 {
22   for (auto evt : events)
23     if (*evt == *e)
24       return true;
25   return false;
26 }
27
28 } // namespace mc
29 } // namespace simgrid