SST 15.0
Structural Simulation Toolkit
stringEvent.h
1// Copyright 2009-2025 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-2025, 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#include <string>
19
20namespace SST::Interfaces {
21
22/**
23 * Simple event to pass strings between components
24 */
25class StringEvent : public SST::Event
26{
27public:
28 StringEvent() {} // For serialization only
29
30 /** Create a new StringEvent
31 * @param str - The String contents of this event
32 */
33 explicit StringEvent(const std::string& str) :
34 SST::Event(),
35 str(str)
36 {}
37
38 /** Clone a StringEvent */
39 virtual Event* clone() override { return new StringEvent(*this); }
40
41 /** Returns the contents of this Event */
42 const std::string& getString() { return str; }
43
44private:
45 std::string str;
46
47public:
48 void serialize_order(SST::Core::Serialization::serializer& ser) override
49 {
50 Event::serialize_order(ser);
51 SST_SER(str);
52 }
53
54 ImplementSerializable(SST::Interfaces::StringEvent);
55};
56
57} // namespace SST::Interfaces
58
59#endif // SST_CORE_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:45
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
Simple event to pass strings between components.
Definition stringEvent.h:26
const std::string & getString()
Returns the contents of this Event.
Definition stringEvent.h:42
virtual Event * clone() override
Clone a StringEvent.
Definition stringEvent.h:39
StringEvent(const std::string &str)
Create a new StringEvent.
Definition stringEvent.h:33