12 #ifndef SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H 13 #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H 15 #include "sst/core/threadsafe.h" 21 #include <sst/core/timeVortex.h> 40 for (
auto x : pool ) {
48 pool.push_back(
new T());
50 auto ret = pool.back();
55 void insert(T* item) { pool.push_back(item); }
71 std::vector<Activity*> activities;
84 for (
auto x : activities ) {
89 inline SimTime_t getSortTime() {
return sort_time; }
90 inline void setSortTime(SimTime_t time) { sort_time = time; }
96 if ( TS ) tu_lock.lock();
97 activities.push_back(act);
99 if ( TS ) tu_lock.unlock();
105 if ( 0 == activities.size() )
return nullptr;
106 if ( !sorted ) sort();
107 auto ret = activities.back();
108 activities.pop_back();
115 if ( 0 == activities.size() )
return nullptr;
116 if ( !sorted ) sort();
117 return activities.back();
122 inline bool operator<(
const TimeUnit& rhs) {
return this->sort_time < rhs.sort_time; }
129 inline bool operator()(
const TimeUnit* lhs,
const TimeUnit* rhs) {
return lhs->sort_time > rhs->sort_time; }
132 inline bool operator()(
const TimeUnit& lhs,
const TimeUnit& rhs) {
return lhs.sort_time > rhs.sort_time; }
141 bool empty()
override;
151 uint64_t getCurrentDepth()
const override {
return current_depth; }
152 uint64_t getMaxDepth()
const override {
return max_depth; }
156 void getContents(std::vector<Activity*>& UNUSED(activities))
const override {}
161 TimeUnit* current_time_unit;
163 using mapType_t = std::map<SimTime_t, TimeUnit*>;
167 std::conditional_t<TS, std::atomic<uint64_t>, uint64_t> insertOrder;
168 std::conditional_t<TS, std::atomic<uint64_t>, uint64_t> current_depth;
180 #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:57
bool operator()(const TimeUnit *lhs, const TimeUnit *rhs)
Compare pointers.
Definition: timeVortexBinnedMap.h:129
Definition: timeVortexBinnedMap.h:32
bool empty() override
Returns true if the queue is empty.
Definition: timeVortexBinnedMap.cc:63
Base class for all Activities in the SST Event Queue.
Definition: activity.h:47
void print(Output &out) const override
Print the state of the TimeVortex.
Definition: timeVortexBinnedMap.cc:166
Primary Event Queue.
Definition: timeVortex.h:31
To use with STL priority queues, that order in reverse.
Definition: timeVortexBinnedMap.h:125
int size() override
Returns the number of activities in the queue.
Definition: timeVortexBinnedMap.cc:73
Primary Event Queue.
Definition: timeVortexBinnedMap.h:62
void insert(Activity *activity) override
Insert a new activity into the queue.
Definition: timeVortexBinnedMap.cc:80
Activity * pop() override
Remove and return the next activity.
Definition: timeVortexBinnedMap.cc:127
Activity * front() override
Returns the next activity.
Definition: timeVortexBinnedMap.cc:151
Definition: threadsafe.h:135
bool operator()(const TimeUnit &lhs, const TimeUnit &rhs)
Compare references.
Definition: timeVortexBinnedMap.h:132
Parameter store.
Definition: params.h:63