SST  14.1.0
StructuralSimulationToolkit
serialize_atomic.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_SERIALIZE_ATOMIC_H
13 #define SST_CORE_SERIALIZATION_IMPL_SERIALIZE_ATOMIC_H
14 
15 #ifndef SST_INCLUDING_SERIALIZE_H
16 #warning \
17  "The header file sst/core/serialization/impl/serialize_atomic.h should not be directly included as it is not part of the stable public API. The file is included in sst/core/serialization/serialize.h"
18 #endif
19 
20 #include "sst/core/serialization/serializer.h"
21 
22 #include <atomic>
23 
24 namespace SST {
25 namespace Core {
26 namespace Serialization {
27 
28 template <class T>
29 class serialize_impl<std::atomic<T>>
30 {
31  typedef std::atomic<T> Value;
32 
33 public:
34  void operator()(Value& v, serializer& ser)
35  {
36  switch ( ser.mode() ) {
37  case serializer::SIZER:
38  {
39  T t = v.load();
40  ser& t;
41  // ser.size(t);
42  break;
43  }
44  case serializer::PACK:
45  {
46  T t = v.load();
47  ser& t;
48  break;
49  }
50  case serializer::UNPACK:
51  {
52  T val;
53  ser& val;
54  v.store(val);
55  break;
56  }
57  case serializer::MAP:
58  // The version of function not called in mapping mode
59  break;
60  }
61  }
62 
63  void operator()(Value& UNUSED(v), serializer& UNUSED(ser), const char* UNUSED(name))
64  {
65  // TODO: Add support for mapping mode
66  }
67 };
68 
69 } // namespace Serialization
70 } // namespace Core
71 } // namespace SST
72 
73 #endif // SST_CORE_SERIALIZATION_IMPL_SERIALIZE_VECTOR_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:43
Base serialize class.
Definition: serialize.h:45
Definition: action.cc:18