SST 15.0
Structural Simulation Toolkit
unpacker.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_SERIALIZATION_IMPL_UNPACKER_H
13#define SST_CORE_SERIALIZATION_IMPL_UNPACKER_H
14
15#ifndef SST_INCLUDING_SERIALIZER_H
16#warning \
17 "The header file sst/core/serialization/impl/unpacker.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"
18#endif
19
20#include "sst/core/serialization/impl/ser_buffer_accessor.h"
21
22#include <cstddef>
23#include <string>
24
25namespace SST::Core::Serialization::pvt {
26
27class ser_unpacker : public ser_buffer_accessor
28{
29public:
30 template <class T>
31 void unpack(T& t)
32 {
33 T* bufptr = ser_buffer_accessor::next<T>();
34 t = *bufptr;
35 }
36
37 /**
38 * @brief unpack_buffer
39 * @param buf Must unpack to non-null buffer
40 * @param size Must be non-zero
41 */
42 void unpack_buffer(void* buf, size_t size);
43
44 void unpack_string(std::string& str);
45};
46
47} // namespace SST::Core::Serialization::pvt
48
49#endif // SST_CORE_SERIALIZATION_IMPL_UNPACKER_H
void unpack_buffer(void *buf, size_t size)
unpack_buffer
Definition serializer.cc:23