Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sst/core/baseComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ SerializeBaseComponentHelper::unpack_basecomponent(serializable_base*& s, serial
}

void
SerializeBaseComponentHelper::map_basecomponent(serializable_base*& s, serializer& ser, const char* name)
SerializeBaseComponentHelper::map_basecomponent(serializable_base*& s, serializer& ser, const std::string& name)
{
if ( nullptr == s ) return;

Expand Down
10 changes: 2 additions & 8 deletions src/sst/core/baseComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ class SerializeBaseComponentHelper

static void unpack_basecomponent(serializable_base*& s, serializer& ser);

static void map_basecomponent(serializable_base*& s, serializer& ser, const char* name);
static void map_basecomponent(serializable_base*& s, serializer& ser, const std::string& name);
};

} // namespace pvt
Expand All @@ -1149,17 +1149,11 @@ class serialize_impl<T*, std::enable_if_t<std::is_base_of_v<SST::BaseComponent,
pvt::SerializeBaseComponentHelper::unpack_basecomponent(sp, ser);
break;
case serializer::MAP:
// Add your code here
pvt::SerializeBaseComponentHelper::map_basecomponent(sp, ser, ser.getMapName());
break;
}
s = static_cast<T*>(sp);
}

void operator()(T*& s, serializer& ser, const char* name)
{
serializable_base* sp = static_cast<serializable_base*>(s);
pvt::SerializeBaseComponentHelper::map_basecomponent(sp, ser, name);
}
};

} // namespace Core::Serialization
Expand Down
21 changes: 21 additions & 0 deletions src/sst/core/from_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@ from_string(const std::string& input)
return T(input);
}

template <class T>
std::enable_if_t<std::is_enum_v<T>, T>
from_string(const std::string& input)
{
return static_cast<T>(from_string<std::underlying_type_t<T>>(input));
}

template <class T>
std::enable_if_t<!std::is_enum_v<T>, std::string>
to_string(const T& input)
{
return std::to_string(input);
}

template <class T>
std::enable_if_t<std::is_enum_v<T>, std::string>
to_string(const T& input)
{
return std::to_string(static_cast<std::underlying_type_t<T>>(input));
}

} // end namespace SST::Core

#endif // SST_CORE_FROM_STRING_H
11 changes: 2 additions & 9 deletions src/sst/core/link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace SST {

void
SST::Core::Serialization::serialize_impl<Link*>::operator()(Link*& s, SST::Core::Serialization::serializer& ser)
SST::Core::Serialization::serialize_impl<Link*>::operator()(Link*& s, serializer& ser)
{
// Need to treat Links and SelfLinks differently
bool self_link;
Expand Down Expand Up @@ -559,18 +559,11 @@ SST::Core::Serialization::serialize_impl<Link*>::operator()(Link*& s, SST::Core:
}
break;
case serializer::MAP:
// This version of the function is not called in mapping mode.
// TODO: Implement Link mapping mode
break;
}
}

void
SST::Core::Serialization::serialize_impl<Link*>::operator()(
Link*& UNUSED(s), SST::Core::Serialization::serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Implement Link mapping mode
}

/**
* Null Event. Used when nullptr is passed into any of the send
* functions. On delivery, it will delete itself and return nullptr.
Expand Down
1 change: 0 additions & 1 deletion src/sst/core/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class SST::Core::Serialization::serialize_impl<Link*>
friend class serialize;
// Function implemented in link.cc
void operator()(Link*& s, SST::Core::Serialization::serializer& ser);
void operator()(Link*& s, SST::Core::Serialization::serializer& ser, const char* name);
};


Expand Down
35 changes: 14 additions & 21 deletions src/sst/core/serialization/impl/serialize_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ raw_ptr(TPtr*& ptr)
Version of serialize that works for statically allocated arrays of
fundamental types and enums.
*/
template <class T, int N>
template <class T, size_t N>
class serialize_impl<T[N], std::enable_if_t<std::is_fundamental_v<T> || std::is_enum_v<T>>>
{
template <class A>
friend class serialize;
void operator()(T arr[N], serializer& ser) { ser.array<T, N>(arr); }

void operator()(T UNUSED(arr[N]), serializer& UNUSED(ser), const char* UNUSED(name))
void operator()(T arr[N], serializer& ser)
{
ser.array<T, N>(arr);

// TODO: Implement mapping mode
}
};
Expand All @@ -98,7 +98,7 @@ class serialize_impl<T[N], std::enable_if_t<std::is_fundamental_v<T> || std::is_
Version of serialize that works for statically allocated arrays of
non base types.
*/
template <class T, int N>
template <class T, size_t N>
class serialize_impl<T[N], std::enable_if_t<!std::is_fundamental_v<T> && !std::is_enum_v<T>>>
{
template <class A>
Expand All @@ -108,10 +108,7 @@ class serialize_impl<T[N], std::enable_if_t<!std::is_fundamental_v<T> && !std::i
for ( int i = 0; i < N; i++ ) {
ser& arr[i];
}
}

void operator()(T UNUSED(arr[N]), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Implement mapping mode
}
};
Expand All @@ -128,10 +125,10 @@ class serialize_impl<
{
template <class A>
friend class serialize;
void operator()(pvt::ser_array_wrapper<T, IntType> arr, serializer& ser) { ser.binary(arr.bufptr, arr.sizeptr); }

void operator()(pvt::ser_array_wrapper<T, IntType> UNUSED(arr), serializer& UNUSED(ser), const char* UNUSED(name))
void operator()(pvt::ser_array_wrapper<T, IntType> arr, serializer& ser)
{
ser.binary(arr.bufptr, arr.sizeptr);

// TODO: Implement mapping mode
}
};
Expand All @@ -152,10 +149,7 @@ class serialize_impl<
for ( int i = 0; i < arr.sizeptr; i++ ) {
ser& arr[i];
}
}

void operator()(pvt::ser_array_wrapper<T, IntType> UNUSED(arr), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Implement mapping mode
}
};
Expand All @@ -169,11 +163,10 @@ class serialize_impl<pvt::ser_array_wrapper<void, IntType>>
{
template <class A>
friend class serialize;
void operator()(pvt::ser_array_wrapper<void, IntType> arr, serializer& ser) { ser.binary(arr.bufptr, arr.sizeptr); }

void
operator()(pvt::ser_array_wrapper<void, IntType> UNUSED(arr), serializer& UNUSED(ser), const char* UNUSED(name))
void operator()(pvt::ser_array_wrapper<void, IntType> arr, serializer& ser)
{
ser.binary(arr.bufptr, arr.sizeptr);

// TODO: Implement mapping mode
}
};
Expand All @@ -191,10 +184,10 @@ class serialize_impl<pvt::raw_ptr_wrapper<TPtr>>
{
template <class A>
friend class serialize;
void operator()(pvt::raw_ptr_wrapper<TPtr> ptr, serializer& ser) { ser.primitive(ptr.bufptr); }

void operator()(pvt::raw_ptr_wrapper<TPtr> UNUSED(ptr), serializer& UNUSED(ser), const char* UNUSED(name))
void operator()(pvt::raw_ptr_wrapper<TPtr> ptr, serializer& ser)
{
ser.primitive(ptr.bufptr);

// TODO: Implement mapping mode
}
};
Expand Down
9 changes: 3 additions & 6 deletions src/sst/core/serialization/impl/serialize_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,11 @@ class serialize_impl<std::atomic<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Value& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
9 changes: 3 additions & 6 deletions src/sst/core/serialization/impl/serialize_deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ class serialize_impl<std::deque<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Deque& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
9 changes: 3 additions & 6 deletions src/sst/core/serialization/impl/serialize_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ class serialize_impl<std::list<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(List& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
18 changes: 6 additions & 12 deletions src/sst/core/serialization/impl/serialize_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ class serialize_impl<std::map<Key, Value>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Map& UNUSED(m), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down Expand Up @@ -136,14 +133,11 @@ class serialize<std::unordered_map<Key, Value>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Map& UNUSED(m), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
9 changes: 3 additions & 6 deletions src/sst/core/serialization/impl/serialize_multiset.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,11 @@ class serialize<std::unordered_multiset<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(MultiSet& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
9 changes: 3 additions & 6 deletions src/sst/core/serialization/impl/serialize_priority_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@ class serialize<std::priority_queue<T, S, C>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Pqueue& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
18 changes: 6 additions & 12 deletions src/sst/core/serialization/impl/serialize_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,11 @@ class serialize<std::set<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Set& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down Expand Up @@ -123,14 +120,11 @@ class serialize<std::unordered_set<T>>
break;
}
case serializer::MAP:
// The version of function not called in mapping mode
{
// TODO: Add support for mapping mode
break;
}
}

void operator()(Set& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
{
// TODO: Add support for mapping mode
}
}
};

Expand Down
22 changes: 13 additions & 9 deletions src/sst/core/serialization/impl/serialize_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ template <>
class serialize_impl<std::string>
{
public:
void operator()(std::string& str, serializer& ser) { ser.string(str); }
void operator()(std::string& str, serializer& ser, const char* name)
void operator()(std::string& str, serializer& ser)
{
ObjectMapString* obj_map = new ObjectMapString(&str);
ser.mapper().map_primitive(name, obj_map);
if ( ser.mode() == serializer::MAP ) {
ObjectMapString* obj_map = new ObjectMapString(&str);
ser.mapper().map_primitive(ser.getMapName(), obj_map);
return;
}
ser.string(str);
}
};

Expand All @@ -78,16 +81,17 @@ class serialize_impl<std::string*>
public:
void operator()(std::string*& str, serializer& ser)
{
if ( ser.mode() == serializer::MAP ) {
ObjectMapString* obj_map = new ObjectMapString(str);
ser.mapper().map_primitive(ser.getMapName(), obj_map);
return;
}

// Nullptr is checked for in serialize<T>(), so just serialize
// as if it was non-pointer
if ( ser.mode() == serializer::UNPACK ) { str = new std::string(); }
ser.string(*str);
}
void operator()(std::string*& str, serializer& ser, const char* name)
{
ObjectMapString* obj_map = new ObjectMapString(str);
ser.mapper().map_primitive(name, obj_map);
}
};

} // namespace SST::Core::Serialization
Expand Down
Loading
Loading