Remote Call Framework 3.1
BsAutoPtr.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2019, Delta V Software. All rights reserved.
6 // http://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
12 // under GPL terms.
13 //
14 // Version: 3.1
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_BSAUTOPTR_HPP
20 #define INCLUDE_RCF_BSAUTOPTR_HPP
21 
22 #include <memory>
23 
24 #include <boost/serialization/split_free.hpp>
25 #include <boost/serialization/nvp.hpp>
26 
27 // Boost.Serialization code for std::unique_ptr.
28 
29 namespace boost {
30  namespace serialization {
31 
32  template<typename Archive, typename T>
33  void serialize(Archive &ar, std::unique_ptr<T> &apt, const unsigned int version)
34  {
35  split_free(ar, apt, version);
36  }
37 
38  template<typename Archive, typename T>
39  void save(Archive &ar, const std::unique_ptr<T> &apt, const unsigned int)
40  {
41  T *pt = apt.get();
42  ar & boost::serialization::make_nvp("Dummy", pt);
43  }
44 
45  template<typename Archive, typename T>
46  void load(Archive &ar, std::unique_ptr<T> &apt, const unsigned int)
47  {
48  T *pt = NULL;
49  ar & boost::serialization::make_nvp("Dummy", pt);
50  apt.reset(pt);
51  }
52 
53  }
54 }
55 
56 #endif // ! INCLUDE_RCF_BSAUTOPTR_HPP
Definition: AsioFwd.hpp:27