os/ossrv/ossrv_pub/boost_apis/boost/serialization/weak_ptr.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
#ifndef BOOST_SERIALIZATION_WEAK_PTR_HPP
sl@0
     2
#define BOOST_SERIALIZATION_WEAK_PTR_HPP
sl@0
     3
sl@0
     4
// MS compatible compilers support #pragma once
sl@0
     5
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
sl@0
     6
# pragma once
sl@0
     7
#endif
sl@0
     8
sl@0
     9
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
sl@0
    10
// shared_ptr.hpp: serialization for boost shared pointer
sl@0
    11
sl@0
    12
// (C) Copyright 2004 Robert Ramey and Martin Ecker
sl@0
    13
// Use, modification and distribution is subject to the Boost Software
sl@0
    14
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
    15
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    16
sl@0
    17
//  See http://www.boost.org for updates, documentation, and revision history.
sl@0
    18
sl@0
    19
#include <boost/weak_ptr.hpp>
sl@0
    20
#include <boost/serialization/shared_ptr.hpp>
sl@0
    21
sl@0
    22
namespace boost {
sl@0
    23
namespace serialization{
sl@0
    24
sl@0
    25
template<class Archive, class T>
sl@0
    26
inline void save(
sl@0
    27
    Archive & ar,
sl@0
    28
    const boost::weak_ptr<T> &t,
sl@0
    29
    const unsigned int /* file_version */
sl@0
    30
){
sl@0
    31
    const boost::shared_ptr<T> sp(t);
sl@0
    32
        ar << boost::serialization::make_nvp(NULL, sp);
sl@0
    33
}
sl@0
    34
sl@0
    35
template<class Archive, class T>
sl@0
    36
inline void load(
sl@0
    37
    Archive & ar,
sl@0
    38
    boost::weak_ptr<T> &t,
sl@0
    39
    const unsigned int /* file_version */
sl@0
    40
){
sl@0
    41
    boost::shared_ptr<T> sp;
sl@0
    42
        ar >> boost::serialization::make_nvp(NULL, sp);
sl@0
    43
    t = sp;
sl@0
    44
}
sl@0
    45
sl@0
    46
template<class Archive, class T>
sl@0
    47
inline void serialize(
sl@0
    48
    Archive & ar,
sl@0
    49
    boost::weak_ptr<T> &t,
sl@0
    50
    const unsigned int file_version
sl@0
    51
){
sl@0
    52
    boost::serialization::split_free(ar, t, file_version);
sl@0
    53
}
sl@0
    54
sl@0
    55
} // namespace serialization
sl@0
    56
} // namespace boost
sl@0
    57
sl@0
    58
#endif // BOOST_SERIALIZATION_WEAK_PTR_HPP