SST  12.0.1
StructuralSimulationToolkit
serialize_packer.h
1 // Copyright 2009-2022 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-2022, 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_SERIALIZE_PACKER_H
13 #define SST_CORE_SERIALIZATION_SERIALIZE_PACKER_H
14 
15 #include "sst/core/serialization/serialize_buffer_accessor.h"
16 
17 #include <string>
18 
19 namespace SST {
20 namespace Core {
21 namespace Serialization {
22 namespace pvt {
23 
25 {
26 public:
27  template <class T>
28  void pack(T& t)
29  {
30  T* buf = ser_buffer_accessor::next<T>();
31  *buf = t;
32  }
33 
34  /**
35  * @brief pack_buffer
36  * @param buf Must be non-null
37  * @param size Must be non-zero
38  */
39  void pack_buffer(void* buf, int size);
40 
41  void pack_string(std::string& str);
42 };
43 
44 } // namespace pvt
45 } // namespace Serialization
46 } // namespace Core
47 } // namespace SST
48 
49 #endif // SERIALIZE_PACKER_H
Definition: serialize_packer.h:24
void pack_buffer(void *buf, int size)
pack_buffer
Definition: serializer.cc:39
Definition: serialize_buffer_accessor.h:35