12#ifndef SST_CORE_SERIALIZATION_IMPL_SERIALIZE_STRING_H
13#define SST_CORE_SERIALIZATION_IMPL_SERIALIZE_STRING_H
15#ifndef SST_INCLUDING_SERIALIZE_H
17 "The header file sst/core/serialization/impl/serialize_string.h should not be directly included as it is not part of the stable public API. The file is included in sst/core/serialization/serialize.h"
20#include "sst/core/serialization/serializer.h"
25namespace SST::Core::Serialization {
38 void*
getAddr()
override {
return addr_; }
40 std::string
get()
override {
return *addr_; }
42 void set_impl(
const std::string& value)
override { *addr_ = value; }
62 ObjectMapString& operator=(
const ObjectMapString&) =
delete;
64 ~ObjectMapString()
override =
default;
68class serialize_impl<T, std::enable_if_t<std::is_same_v<std::remove_pointer_t<T>, std::string>>>
70 void operator()(T& str,
serializer& ser, ser_opt_t options)
73 const auto& sPtr = get_ptr(str);
74 const auto mode = ser.mode();
75 if ( mode == serializer::MAP ) {
76 if ( options & SerOption::map_read_only ) {
77 ser.mapper().setNextObjectReadOnly();
79 ser.mapper().map_primitive(ser.getMapName(),
new ObjectMapString(sPtr));
82 if constexpr ( std::is_pointer_v<T> ) {
83 if ( mode == serializer::UNPACK ) str =
new std::string();
89 SST_FRIEND_SERIALIZE();
Definition serialize_string.h:28
ObjectMapString(const ObjectMapString &)=delete
Disallow copying and assignment.
std::string getType() override
Get the type of the variable represented by the ObjectMap.
Definition serialize_string.h:46
virtual bool isFundamental() override
Check to see if this ObjectMap represents a fundamental or a class treated as a fundamental.
Definition serialize_string.h:44
void * getAddr() override
Get the address of the represented object.
Definition serialize_string.h:38
std::string get() override
Get the value of the variable as a string.
Definition serialize_string.h:40
ObjectMap()=default
Default constructor primarily used for the "top" object in the hierarchy.
Base serialize class.
Definition serialize.h:110
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:45