12 #ifndef SST_CORE_SERIALIZATION_IMPL_SIZER_H 13 #define SST_CORE_SERIALIZATION_IMPL_SIZER_H 15 #ifndef SST_INCLUDING_SERIALIZER_H 17 "The header file sst/core/serialization/impl/sizer.h should not be directly included as it is not part of the stable public API. The file is included in sst/core/serialization/serializer.h" 20 #include "sst/core/serialization/impl/get_array_size.h" 21 #include "sst/core/serialization/impl/ser_shared_ptr_tracker.h" 27 #include <type_traits> 34 std::set<uintptr_t> pointer_set;
45 template <
typename T,
typename SIZE_T>
46 void size_buffer(
const T* buffer, SIZE_T size)
48 if ( buffer !=
nullptr )
49 get_array_size(size,
"Serialization Error: Size in SST::Core::Serialization:pvt::size_buffer() cannot fit " 50 "inside size_t. size_t should be used for sizes.\n");
53 using ELEM_T = std::conditional_t<std::is_void_v<T>, char, T>;
54 size_ +=
sizeof(size) + size *
sizeof(ELEM_T);
57 void size_string(std::string& str) { size_ +=
sizeof(size_t) + str.size(); }
58 void add(
size_t s) { size_ += s; }
59 size_t size()
const {
return size_; }
60 bool check_pointer_sizer(uintptr_t ptr) {
return !pointer_set.insert(ptr).second; }
65 #endif // SST_CORE_SERIALIZATION_IMPL_SIZER_H Definition: ser_shared_ptr_tracker.h:30
Definition: baseComponent.cc:1107