SST  8.0.0
StructuralSimulationToolkit
stringEvent.h
1 // Copyright 2009-2018 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-2018, 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 INTERFACES_STRINGEVENT_H
13 #define INTERFACES_STRINGEVENT_H
14 
15 #include <sst/core/sst_types.h>
16 
17 #include <sst/core/event.h>
18 
19 namespace SST {
20 namespace Interfaces {
21 
22 /**
23  * Simple event to pass strings between components
24  */
26 public:
27  StringEvent() {} // For serialization only
28 
29  /** Create a new StringEvent
30  * @param str - The String contents of this event
31  */
32  StringEvent(const std::string &str) :
33  SST::Event(), str(str)
34  { }
35 
36  /** Copies an existing StringEvent */
37  StringEvent(const StringEvent &me) : SST::Event()
38  {
39  str = me.str;
40  setDeliveryLink(me.getLinkId(), NULL);
41  }
42 
43  /** Copies an existing StringEvent */
44  StringEvent(const StringEvent *me) : SST::Event()
45  {
46  str = me->str;
47  setDeliveryLink(me->getLinkId(), NULL);
48  }
49 
50  /** Returns the contents of this Event */
51  const std::string& getString(void) { return str; }
52 
53 private:
54  std::string str;
55 
56 public:
57  void serialize_order(SST::Core::Serialization::serializer &ser) override {
58  Event::serialize_order(ser);
59  ser & str;
60  }
61 
62  ImplementSerializable(SST::Interfaces::StringEvent);
63 };
64 
65 } //namespace Interfaces
66 } //namespace SST
67 
68 #endif /* INTERFACES_STRINGEVENT_H */
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
LinkId_t getLinkId(void) const
Gets the link id associated with this event.
Definition: event.h:76
Simple event to pass strings between components.
Definition: stringEvent.h:25
const std::string & getString(void)
Returns the contents of this Event.
Definition: stringEvent.h:51
StringEvent(const StringEvent *me)
Copies an existing StringEvent.
Definition: stringEvent.h:44
StringEvent(const StringEvent &me)
Copies an existing StringEvent.
Definition: stringEvent.h:37
void setDeliveryLink(LinkId_t id, Link *link)
Sets the link id used for delivery.
Definition: event.h:56
StringEvent(const std::string &str)
Create a new StringEvent.
Definition: stringEvent.h:32
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:31
Definition: serializable.h:130