SST  11.0.0
StructuralSimulationToolkit
stringEvent.h
1 // Copyright 2009-2021 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-2021, 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_INTERFACES_STRINGEVENT_H
13 #define SST_CORE_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  /** Clone a StringEvent */
37  virtual Event* clone() override {
38  return new StringEvent(*this);
39  }
40 
41  /** Returns the contents of this Event */
42  const std::string& getString(void) { return str; }
43 
44 private:
45  std::string str;
46 
47 public:
48  void serialize_order(SST::Core::Serialization::serializer &ser) override {
49  Event::serialize_order(ser);
50  ser & str;
51  }
52 
53  ImplementSerializable(SST::Interfaces::StringEvent);
54 };
55 
56 } //namespace Interfaces
57 } //namespace SST
58 
59 #endif /* INTERFACES_STRINGEVENT_H */
virtual Event * clone() override
Clone a StringEvent.
Definition: stringEvent.h:37
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
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:42
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:132