Remote Call Framework 3.3
BsAutoPtr.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_BSAUTOPTR_HPP
19 #define INCLUDE_RCF_BSAUTOPTR_HPP
20 
21 #include <memory>
22 
23 #include <boost/serialization/split_free.hpp>
24 #include <boost/serialization/nvp.hpp>
25 
26 // Boost.Serialization code for std::unique_ptr.
27 
28 namespace boost {
29  namespace serialization {
30 
31  template<typename Archive, typename T>
32  void serialize(Archive &ar, std::unique_ptr<T> &apt, const unsigned int version)
33  {
34  split_free(ar, apt, version);
35  }
36 
37  template<typename Archive, typename T>
38  void save(Archive &ar, const std::unique_ptr<T> &apt, const unsigned int)
39  {
40  T *pt = apt.get();
41  ar & boost::serialization::make_nvp("Dummy", pt);
42  }
43 
44  template<typename Archive, typename T>
45  void load(Archive &ar, std::unique_ptr<T> &apt, const unsigned int)
46  {
47  T *pt = NULL;
48  ar & boost::serialization::make_nvp("Dummy", pt);
49  apt.reset(pt);
50  }
51 
52  }
53 }
54 
55 #endif // ! INCLUDE_RCF_BSAUTOPTR_HPP
Definition: AsioFwd.hpp:26