SST  14.1.0
StructuralSimulationToolkit
packer.h
1 // Copyright 2009-2024 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-2024, 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_PACKER_H
13 #define SST_CORE_SERIALIZATION_IMPL_PACKER_H
14 
15 #ifndef SST_INCLUDING_SERIALIZER_H
16 #warning \
17  "The header file sst/core/serialization/impl/packer.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 <string>
23 
24 namespace SST {
25 namespace Core {
26 namespace Serialization {
27 namespace pvt {
28 
30 {
31 public:
32  template <class T>
33  void pack(T& t)
34  {
35  T* buf = ser_buffer_accessor::next<T>();
36  DISABLE_WARN_MAYBE_UNINITIALIZED
37  *buf = t;
38  REENABLE_WARNING
39  }
40 
41  /**
42  * @brief pack_buffer
43  * @param buf Must be non-null
44  * @param size Must be non-zero
45  */
46  void pack_buffer(void* buf, int size);
47 
48  void pack_string(std::string& str);
49 };
50 
51 } // namespace pvt
52 } // namespace Serialization
53 } // namespace Core
54 } // namespace SST
55 
56 #endif // SST_CORE_SERIALIZATION_IMPL_PACKER_H
Definition: action.cc:18
void pack_buffer(void *buf, int size)
pack_buffer
Definition: serializer.cc:39
Definition: ser_buffer_accessor.h:40