SST  14.0.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_SERIALIZE_ATOMIC_H
13 #define SST_CORE_SERIALIZATION_SERIALIZE_ATOMIC_H
14 
15 #include "sst/core/serialization/serializer.h"
16 
17 #include <atomic>
18 
19 namespace SST {
20 namespace Core {
21 namespace Serialization {
22 
23 template <class T>
24 class serialize<std::atomic<T>>
25 {
26  typedef std::atomic<T> Value;
27 
28 public:
29  void operator()(Value& v, serializer& ser)
30  {
31  switch ( ser.mode() ) {
32  case serializer::SIZER:
33  {
34  T t = v.load();
35  ser& t;
36  // ser.size(t);
37  break;
38  }
39  case serializer::PACK:
40  {
41  T t = v.load();
42  ser& t;
43  break;
44  }
45  case serializer::UNPACK:
46  {
47  T val;
48  ser& val;
49  v.store(val);
50  break;
51  }
52  }
53  }
54 };
55 
56 } // namespace Serialization
57 } // namespace Core
58 } // namespace SST
59 
60 #endif // SST_CORE_SERIALIZATION_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:35
Definition: action.cc:18
Serialization "gateway" object.
Definition: serialize.h:110