Pothos  0.5.0-ga4964040
The Pothos dataflow programming software suite
Serialize.hpp
Go to the documentation of this file.
1 
15 #pragma once
16 
21 #define POTHOS_OBJECT_SERIALIZE(ValueType) \
22  POTHOS_CLASS_EXPORT_GUID(Pothos::Detail::ObjectContainerT<ValueType>, "Pothos::Object<" #ValueType ">")
23 
24 #include <Pothos/Config.hpp>
26 #include <Pothos/Archive.hpp>
27 #include <cassert>
28 
29 namespace Pothos {
30 namespace serialization {
31 
32 template<class Archive>
33 void serialize(Archive &, Pothos::Detail::ObjectContainer &, const unsigned int){}
34 
35 template <class Archive, typename ValueType>
36 void serialize(Archive &ar, Pothos::Detail::ObjectContainerT<ValueType> &t, const unsigned int)
37 {
38  ar & t.value;
39 }
40 
41 template<class Archive>
42 void save(Archive & ar, const Pothos::Object &t, const unsigned int)
43 {
44  const bool is_null = not t;
45  ar << is_null;
46  if (not is_null) ar << t._impl;
47 }
48 
49 template<class Archive>
50 void load(Archive & ar, Pothos::Object &t, const unsigned int)
51 {
52  assert(not t);
53  bool is_null = false;
54  ar >> is_null;
55  if (not is_null) ar >> t._impl;
56 }
57 
58 } // namespace serialization
59 } // namespace Pothos
60 
#define POTHOS_SERIALIZATION_SPLIT_FREE(T)
Definition: Split.hpp:21
Definition: ArchiveEntry.hpp:20
Detail::ObjectContainer * _impl
Private implementation details.
Definition: Object.hpp:258
Definition: Object.hpp:55
void save(Archive &ar, const std::complex< T > &t, const unsigned int)
Definition: Complex.hpp:20
void serialize(Archive &ar, std::complex< T > &t, const unsigned int ver)
Definition: Complex.hpp:37
void load(Archive &ar, std::complex< T > &t, const unsigned int)
Definition: Complex.hpp:27