12 #ifndef SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H
13 #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H
17 #include <sst/core/timeVortex.h>
36 for (
auto x : pool ) {
43 if ( pool.empty() ) { pool.push_back(
new T()); }
44 auto ret = pool.back();
49 void insert(T* item) { pool.push_back(item); }
65 std::vector<Activity*> activities;
72 TimeUnit() : sorted(
false) {}
76 for (
auto x : activities ) {
81 inline SimTime_t getSortTime() {
return sort_time; }
82 inline void setSortTime(SimTime_t time) { sort_time = time; }
88 if ( TS ) tu_lock.lock();
89 activities.push_back(act);
91 if ( TS ) tu_lock.unlock();
97 if ( 0 == activities.size() )
return nullptr;
98 if ( !sorted ) sort();
99 auto ret = activities.back();
100 activities.pop_back();
107 if ( 0 == activities.size() )
return nullptr;
108 if ( !sorted ) sort();
109 return activities.back();
114 inline bool operator<(
const TimeUnit& rhs) {
return this->sort_time < rhs.sort_time; }
121 inline bool operator()(
const TimeUnit* lhs,
const TimeUnit* rhs) {
return lhs->sort_time > rhs->sort_time; }
124 inline bool operator()(
const TimeUnit& lhs,
const TimeUnit& rhs) {
return lhs.sort_time > rhs.sort_time; }
133 bool empty()
override;
143 uint64_t getCurrentDepth()
const override {
return current_depth; }
144 uint64_t getMaxDepth()
const override {
return max_depth; }
149 TimeUnit* current_time_unit;
151 typedef std::map<SimTime_t, TimeUnit*> mapType_t;
155 typename std::conditional<TS, std::atomic<uint64_t>, uint64_t>::type insertOrder;
157 typename std::conditional<TS, std::atomic<uint64_t>, uint64_t>::type current_depth;
169 #endif // SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:51
bool operator()(const TimeUnit *lhs, const TimeUnit *rhs)
Compare pointers.
Definition: timeVortexBinnedMap.h:121
Definition: timeVortexBinnedMap.h:28
bool empty() override
Returns true if the queue is empty.
Definition: timeVortexBinnedMap.cc:67
Base class for all Activities in the SST Event Queue.
Definition: activity.h:48
void print(Output &out) const override
Print the state of the TimeVortex.
Definition: timeVortexBinnedMap.cc:168
Primary Event Queue.
Definition: timeVortex.h:25
To use with STL priority queues, that order in reverse.
Definition: timeVortexBinnedMap.h:117
int size() override
Returns the number of activities in the queue.
Definition: timeVortexBinnedMap.cc:77
Primary Event Queue.
Definition: timeVortexBinnedMap.h:56
void insert(Activity *activity) override
Insert a new activity into the queue.
Definition: timeVortexBinnedMap.cc:84
Activity * pop() override
Remove and return the next activity.
Definition: timeVortexBinnedMap.cc:129
Activity * front() override
Returns the next activity.
Definition: timeVortexBinnedMap.cc:153
Definition: threadsafe.h:121
bool operator()(const TimeUnit &lhs, const TimeUnit &rhs)
Compare references.
Definition: timeVortexBinnedMap.h:124
Parameter store.
Definition: params.h:43