SST  11.0.0
StructuralSimulationToolkit
timeVortexPQ.h
1 // Copyright 2009-2021 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2021, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
13 #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
14 
15 #include <functional>
16 #include <queue>
17 #include <vector>
18 
19 #include "sst/core/timeVortex.h"
20 #include "sst/core/eli/elementinfo.h"
21 
22 namespace SST {
23 
24 class Output;
25 
26 namespace IMPL {
27 
28 
29 /**
30  * Primary Event Queue
31  */
32 class TimeVortexPQ : public TimeVortex {
33 
34 public:
35  SST_ELI_REGISTER_DERIVED(
36  TimeVortex,
38  "sst",
39  "timevortex.priority_queue",
40  SST_ELI_ELEMENT_VERSION(1,0,0),
41  "TimeVortex based on std::priority_queue.")
42 
43 
44 public:
45  // TimeVortexPQ();
46  TimeVortexPQ(Params& params);
47  ~TimeVortexPQ();
48 
49  bool empty() override;
50  int size() override;
51  void insert(Activity* activity) override;
52  Activity* pop() override;
53  Activity* front() override;
54 
55  /** Print the state of the TimeVortex */
56  void print(Output &out) const override;
57 
58  uint64_t getCurrentDepth() const override { return current_depth; }
59  uint64_t getMaxDepth() const override { return max_depth; }
60 
61 private:
62 #ifdef SST_ENFORCE_EVENT_ORDERING
63  typedef std::priority_queue<Activity*, std::vector<Activity*>, Activity::pq_less_time_priority_order> dataType_t;
64 #else
65  typedef std::priority_queue<Activity*, std::vector<Activity*>, Activity::pq_less_time_priority> dataType_t;
66 #endif
67  dataType_t data;
68  uint64_t insertOrder;
69 
70  uint64_t current_depth;
71  uint64_t max_depth;
72 
73 };
74 
75 } // namespace IMPL
76 } //namespace SST
77 
78 #endif // SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H
79 
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:54
void print(Output &out) const override
Print the state of the TimeVortex.
Definition: timeVortexPQ.cc:77
Activity * pop() override
Remove and return the next activity.
Definition: timeVortexPQ.cc:62
Base class for all Activities in the SST Event Queue.
Definition: activity.h:52
void insert(Activity *activity) override
Insert a new activity into the queue.
Definition: timeVortexPQ.cc:52
Primary Event Queue.
Definition: timeVortex.h:25
Primary Event Queue.
Definition: timeVortexPQ.h:32
int size() override
Returns the number of activities in the queue.
Definition: timeVortexPQ.cc:47
Activity * front() override
Returns the next activity.
Definition: timeVortexPQ.cc:72
To use with STL priority queues, that order in reverse.
Definition: activity.h:95
Parameter store.
Definition: params.h:44
To use with STL priority queues, that order in reverse.
Definition: activity.h:154
bool empty() override
Returns true if the queue is empty.
Definition: timeVortexPQ.cc:42