SST/macro
sst_event.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_SSTEVENT_H_INCLUDED
13 #define SSTMAC_BACKENDS_NATIVE_SSTEVENT_H_INCLUDED
14 
21 #if SSTMAC_INTEGRATED_SST_CORE
22 #include <sst/core/event.h>
23 #include <sst/core/output.h>
24 #endif
25 
26 namespace sstmac {
27 
28 class event :
29 #if SSTMAC_INTEGRATED_SST_CORE
30  public SST::Event
31 #else
33 #endif
34 {
35  public:
36  virtual std::string
37  to_string() const = 0;
38 
39  void
41 
42  /** convenience methods */
43  virtual bool
44  is_packet() const {
45  return false;
46  }
47 
48  virtual bool
49  is_credit() const {
50  return false;
51  }
52 
53  virtual bool
54  is_failure() const {
55  return false;
56  }
57 
58  template <class T>
59  T*
61  T* t = dynamic_cast<T*>(this);
62  return t;
63  }
64 
65 };
66 
69  : public SST::Event
70 #endif
71 {
73  public:
74  virtual ~event_queue_entry() {}
75 
76  virtual void
77  execute() = 0;
78 
79  virtual std::string
80  to_string() const = 0;
81 
82 #if SSTMAC_INTEGRATED_SST_CORE
84  event_loc_id src)
85  {
86  //simply ignore parameters - not needed
87  }
88 #else
90  event_loc_id src) :
91  dst_loc_(dst),
92  src_loc_(src),
93  seqnum_(0)
94  {
95  }
96 
97  timestamp
98  time() const {
99  return time_;
100  }
101 
102  void
103  set_time(const timestamp& t) {
104  time_ = t;
105  }
106 
107  void
108  set_seqnum(uint32_t seqnum) {
109  seqnum_ = seqnum;
110  }
111 
112  uint32_t
113  seqnum() const {
114  return seqnum_;
115  }
116 
118  event_location() const {
119  return dst_loc_;
120  }
121 
123  src_location() const {
124  return src_loc_;
125  }
126 
127 #if SSTMAC_HAVE_EVENT_CALENDAR
128  event* next;
129 #endif
130 
131  protected:
135  /** A unique sequence number from the source */
136  uint32_t seqnum_;
137 #endif
138 
139 };
140 
142  public event_queue_entry
143 {
144 
145  public:
147 
149  event_handler* hand,
150  event_loc_id src_loc);
151 
152  virtual std::string
153  to_string() const;
154 
155  void
156  execute();
157 
158  protected:
160 
162 
163 };
164 
165 class callback :
166  public event_queue_entry
167 {
168  protected:
170  event_queue_entry(local, local)
171  {
172  }
173 };
174 
175 
176 } // end of namespace sstmac
177 
178 #endif
179 
void set_seqnum(uint32_t seqnum)
Definition: sst_event.h:108
virtual bool is_failure() const
Definition: sst_event.h:54
uint32_t seqnum() const
Definition: sst_event.h:113
timestamp time_
Definition: sst_event.h:132
event_loc_id dst_loc_
Definition: sst_event.h:133
virtual ~handler_event_queue_entry()
Definition: sst_event.h:146
Definition: sst_event.h:141
event_loc_id event_location() const
Definition: sst_event.h:118
void set_time(const timestamp &t)
Definition: sst_event.h:103
virtual bool is_packet() const
convenience methods
Definition: sst_event.h:44
virtual std::string to_string() const =0
timestamp time() const
Definition: sst_event.h:98
void serialize_order(serializer &ser)
Definition: sst_event.h:40
The main interface for something that can respond to an event (sst_message).
Definition: event_handler.h:24
NotSerializable(event_queue_entry) public
Definition: sst_event.h:72
callback(event_loc_id local)
Definition: sst_event.h:169
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:33
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...
event_queue_entry(event_loc_id dst, event_loc_id src)
Definition: sst_event.h:89
virtual bool is_credit() const
Definition: sst_event.h:49
#define SSTMAC_INTEGRATED_SST_CORE
uint32_t seqnum_
A unique sequence number from the source.
Definition: sst_event.h:136
event * ev_to_deliver_
Definition: sst_event.h:159
event_handler * handler_
Definition: sst_event.h:161
event_loc_id src_location() const
Definition: sst_event.h:123
Definition: sst_event.h:67
T * interface()
Definition: sst_event.h:60
event_loc_id src_loc_
Definition: sst_event.h:134