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