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