SST  12.0.1
StructuralSimulationToolkit
threadSyncQueue.h
1 // Copyright 2009-2022 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-2022, 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_SYNC_THREADSYNCQUEUE_H
13 #define SST_CORE_SYNC_THREADSYNCQUEUE_H
14 
15 #include "sst/core/activityQueue.h"
16 #include "sst/core/simulation.h"
17 
18 namespace SST {
19 
20 /** Base Class for a queue of Activities
21  */
23 {
24 public:
26  ~ThreadSyncQueue() {}
27 
28  /** Returns true if the queue is empty */
29  bool empty() override { return activities.empty(); }
30 
31  /** Returns the number of activities in the queue */
32  int size() override { return activities.size(); }
33 
34  /** Not supported */
35  Activity* pop() override
36  {
37  // Need to fatal
38  return nullptr;
39  }
40 
41  /** Insert a new activity into the queue */
42  void insert(Activity* activity) override
43  {
44  // Remove #include of simulation.h when removing
45  activities.push_back(activity);
46  }
47 
48  /** Not supported */
49  Activity* front() override
50  {
51  // Need to fatal
52  return nullptr;
53  }
54 
55  void clear() { activities.clear(); }
56 
57  std::vector<Activity*>& getVector() { return activities; }
58 
59 private:
60  std::vector<Activity*> activities;
61 };
62 
63 } // namespace SST
64 
65 #endif // SST_CORE_SYNC_THREADSYNCQUEUE_H
Base class for all Activities in the SST Event Queue.
Definition: activity.h:46
int size() override
Returns the number of activities in the queue.
Definition: threadSyncQueue.h:32
bool empty() override
Returns true if the queue is empty.
Definition: threadSyncQueue.h:29
Activity * pop() override
Not supported.
Definition: threadSyncQueue.h:35
void insert(Activity *activity) override
Insert a new activity into the queue.
Definition: threadSyncQueue.h:42
Base Class for a queue of Activities.
Definition: threadSyncQueue.h:22
Activity * front() override
Not supported.
Definition: threadSyncQueue.h:49
Base Class for a queue of Activities.
Definition: activityQueue.h:21