atomic_serialization.h
Go to the documentation of this file.
1 
27 #ifndef TESSERACT_COMMON_ATOMIC_SERIALIZATION_H
28 #define TESSERACT_COMMON_ATOMIC_SERIALIZATION_H
29 
32 #include <boost/serialization/serialization.hpp>
33 #include <boost/serialization/split_free.hpp>
34 #include <boost/serialization/nvp.hpp>
35 #include <atomic>
37 
39 namespace boost::serialization
40 {
41 template <class Archive, class T>
42 inline void save(Archive& ar, const std::atomic<T>& t, const unsigned int)
43 {
44  const T value = t.load();
45  ar& BOOST_SERIALIZATION_NVP(value);
46 }
47 
48 template <class Archive, class T>
49 inline void load(Archive& ar, std::atomic<T>& t, const unsigned int)
50 {
51  T value;
52  ar& BOOST_SERIALIZATION_NVP(value);
53  t = value;
54 }
55 
56 template <class Archive, class T>
57 inline void serialize(Archive& ar, std::atomic<T>& t, const unsigned int version)
58 {
59  boost::serialization::split_free(ar, t, version);
60 }
61 } // namespace boost::serialization
62 #endif // TESSERACT_COMMON_ATOMIC_SERIALIZATION_H
boost::serialization::load
void load(Archive &ar, std::atomic< T > &t, const unsigned int)
Definition: atomic_serialization.h:49
boost::serialization::serialize
void serialize(Archive &ar, std::atomic< T > &t, const unsigned int version)
Definition: atomic_serialization.h:57
macros.h
Common Tesseract Macros.
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
boost::serialization
Definition: allowed_collision_matrix.h:14
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: macros.h:72
boost::serialization::save
void save(Archive &ar, const std::atomic< T > &t, const unsigned int)
Definition: atomic_serialization.h:42


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40