SST  14.0.0
StructuralSimulationToolkit
stringEvent.h
1 // Copyright 2009-2024 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-2024, 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/event.h"
16 #include "sst/core/sst_types.h"
17 
18 namespace SST {
19 namespace Interfaces {
20 
21 /**
22  * Simple event to pass strings between components
23  */
25 {
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) : SST::Event(), str(str) {}
33 
34  /** Clone a StringEvent */
35  virtual Event* clone() override { return new StringEvent(*this); }
36 
37  /** Returns the contents of this Event */
38  const std::string& getString(void) { return str; }
39 
40 private:
41  std::string str;
42 
43 public:
44  void serialize_order(SST::Core::Serialization::serializer& ser) override
45  {
46  Event::serialize_order(ser);
47  ser& str;
48  }
49 
50  ImplementSerializable(SST::Interfaces::StringEvent);
51 };
52 
53 } // namespace Interfaces
54 } // namespace SST
55 
56 #endif // SST_CORE_INTERFACES_STRINGEVENT_H
virtual Event * clone() override
Clone a StringEvent.
Definition: stringEvent.h:35
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:24
const std::string & getString(void)
Returns the contents of this Event.
Definition: stringEvent.h:38
Definition: action.cc:18
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:34
Definition: serializable.h:138