Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / kernel / resource / profile / FutureEvtSet.hpp
1 /* Copyright (c) 2004-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 #ifndef FUTUREEVTSET_HPP
7 #define FUTUREEVTSET_HPP
8
9 #include "simgrid/forward.h"
10 #include <queue>
11
12 namespace simgrid {
13 namespace kernel {
14 namespace profile {
15
16 /** @brief Future Event Set (collection of iterators over the traces)
17  * That's useful to quickly know which is the next occurring event in a set of traces. */
18 class XBT_PUBLIC FutureEvtSet {
19 public:
20   FutureEvtSet();
21   FutureEvtSet(const FutureEvtSet&) = delete;
22   FutureEvtSet& operator=(const FutureEvtSet&) = delete;
23   virtual ~FutureEvtSet();
24   double next_date() const;
25   Event* pop_leq(double date, double* value, resource::Resource** resource);
26   void add_event(double date, Event* evt);
27
28 private:
29   using Qelt = std::pair<double, Event*>;
30   std::priority_queue<Qelt, std::vector<Qelt>, std::greater<>> heap_;
31 };
32
33 // FIXME: kill that singleton
34 extern XBT_PRIVATE simgrid::kernel::profile::FutureEvtSet future_evt_set;
35
36 } // namespace profile
37 } // namespace kernel
38 } // namespace simgrid
39
40 #endif