12 #ifndef SST_CORE_CORE_EVENT_H
13 #define SST_CORE_CORE_EVENT_H
15 #include <sst/core/sst_types.h>
21 #include <sst/core/activity.h>
42 #if __SST_DEBUG_EVENT_TRACKING__
57 #ifdef SST_ENFORCE_EVENT_ORDERING
58 enforce_link_order = id;
77 #ifdef SST_ENFORCE_EVENT_ORDERING
78 return enforce_link_order;
97 template <
typename classT,
typename argT =
void>
100 typedef void (classT::*PtrMember)(
Event*, argT);
102 const PtrMember member;
111 Handler( classT*
const object, PtrMember member, argT data ) :
118 (
object->*member)(event,data);
126 template <
typename classT>
129 typedef void (classT::*PtrMember)(
Event*);
130 const PtrMember member;
138 Handler( classT*
const object, PtrMember member ) :
144 (
object->*member)(event);
149 virtual void print(
const std::string& header,
Output &out)
const override {
150 out.
output(
"%s Generic Event to be delivered at %" PRIu64
" with priority %d\n",
154 #ifdef __SST_DEBUG_EVENT_TRACKING__
156 virtual void printTrackingInfo(
const std::string& header,
Output &out)
const {
157 out.
output(
"%s Event first sent from: %s:%s (type: %s) and last received by %s:%s (type: %s)\n", header.c_str(),
158 first_comp.c_str(),first_port.c_str(),first_type.c_str(),
159 last_comp.c_str(),last_port.c_str(),last_type.c_str());
162 const std::string& getFirstComponentName() {
return first_comp; }
163 const std::string& getFirstComponentType() {
return first_type; }
164 const std::string& getFirstPort() {
return first_port; }
165 const std::string& getLastComponentName() {
return last_comp; }
166 const std::string& getLastComponentType() {
return last_type; }
167 const std::string& getLastPort() {
return last_port; }
169 void addSendComponent(
const std::string& comp,
const std::string& type,
const std::string& port) {
170 if ( first_comp ==
"" ) {
176 void addRecvComponent(
const std::string& comp,
const std::string& type,
const std::string& port) {
185 Activity::serialize_order(ser);
186 #ifndef SST_ENFORCE_EVENT_ORDERING
189 #ifdef __SST_DEBUG_EVENT_TRACKING__
210 static std::atomic<uint64_t> id_counter;
213 #ifndef SST_ENFORCE_EVENT_ORDERING
217 #ifdef __SST_DEBUG_EVENT_TRACKING__
218 std::string first_comp;
219 std::string first_type;
220 std::string first_port;
221 std::string last_comp;
222 std::string last_type;
223 std::string last_port;
239 virtual void print(
const std::string& header,
Output &out)
const override {
240 out.
output(
"%s NullEvent to be delivered at %" PRIu64
" with priority %d\n",
252 #endif // SST_CORE_EVENT_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:54
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
void operator()(Event *event)
Handler function.
Definition: event.h:143
LinkId_t getLinkId(void) const
Gets the link id associated with this event.
Definition: event.h:76
Base class for all Activities in the SST Event Queue.
Definition: activity.h:54
Handler(classT *const object, PtrMember member)
Constructor.
Definition: event.h:138
void operator()(Event *event)
Handler function.
Definition: event.h:117
virtual void operator()(Event *)=0
Handler function.
Null Event.
Definition: event.h:232
Link * delivery_link
Link used for delivery.
Definition: event.h:202
void execute(void) override
Cause this event to fire.
Definition: event.cc:28
Link * getDeliveryLink()
Gets the link id used for delivery.
Definition: event.h:66
Event Handler class with user-data argument.
Definition: event.h:98
std::pair< uint64_t, int > id_type
Type definition of unique identifiers.
Definition: event.h:35
void setPriority(int priority)
Set the priority of the Activity.
Definition: activity.h:340
static const id_type NO_ID
Constant, default value for id_types.
Definition: event.h:37
SimTime_t getDeliveryTime() const
Return the time at which this Activity will be delivered.
Definition: activity.h:207
void setDeliveryLink(LinkId_t id, Link *link)
Sets the link id used for delivery.
Definition: event.h:56
void output(uint32_t line, const char *file, const char *func, const char *format,...) const
Output the message with formatting as specified by the format parameter.
Definition: output.h:184
void execute(void) override
Cause this event to fire.
Definition: event.cc:46
virtual void print(const std::string &header, Output &out) const override
Virtual function to "pretty-print" this event.
Definition: event.h:239
int getPriority() const
Return the Priority of this Activity.
Definition: activity.h:212
void setRemoteEvent()
For use by SST Core only.
Definition: event.h:71
Functor classes for Event handling.
Definition: event.h:86
id_type generateUniqueId()
Generates an ID that is unique across ranks, components and events.
Definition: event.cc:40
virtual void print(const std::string &header, Output &out) const override
Virtual function to "pretty-print" this event.
Definition: event.h:149
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31
Handler(classT *const object, PtrMember member, argT data)
Constructor.
Definition: event.h:111
Link between two components.
Definition: link.h:33
virtual Event * clone()
Clones the event in for the case of a broadcast.
Definition: event.cc:33
Definition: serializable.h:130