SST/macro
event_heap.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_BACKENDS_NATIVE_event_heap_H_INCLUDED
13 #define SSTMAC_BACKENDS_NATIVE_event_heap_H_INCLUDED
14 
15 #if !SSTMAC_INTEGRATED_SST_CORE
16 
21 
22 #include <queue>
23 #include <vector>
24 
25 namespace sstmac {
26 namespace native {
27 
28 /**
29  * An event manager that relies on the eventcontainer template base class
30  * to manage events with a priority queue template parameter.
31  */
32 class event_heap :
33  public event_container
34 {
35 
36  public:
38 
39  ~event_heap() throw ();
40 
41  /// Clear all events and set time back to a zero of your choice.
42  /// \throw sprockit::illformed_error if the event manager is running.
43  void
44  clear(timestamp zero_time = timestamp(0));
45 
46  bool
47  empty() const {
48  return queue_.empty();
49  }
50 
51  void
52  cancel_all_messages(event_loc_id canceled_loc);
53 
54  protected:
55  typedef std::priority_queue<event*,
56  std::vector<event_queue_entry*>, std::greater<event_queue_entry*> > queue_t;
57 
60 
61  void
63 
64  protected:
65  queue_t queue_;
66 
67 };
68 
69 }
70 } // end of namespace sstmac
71 
72 #endif // !SSTMAC_INTEGRATED_SST_CORE
73 
74 #endif
75 
void cancel_all_messages(event_loc_id canceled_loc)
void clear(timestamp zero_time=timestamp(0))
Clear all events and set time back to a zero of your choice.
An event manager base class using standard containers.
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
An event manager that relies on the eventcontainer template base class to manage events with a priori...
Definition: event_heap.h:32
std::priority_queue< event *, std::vector< event_queue_entry * >, std::greater< event_queue_entry * > > queue_t
Definition: event_heap.h:56
void add_event(event_queue_entry *ev)
Called by schedule. Child class must implement.
Definition: sst_event.h:67
event_queue_entry * pop_next_event()
event_heap(parallel_runtime *rt)
Definition: event_heap.h:37