annotate DEPENDENCIES/generic/include/boost/serialization/weak_ptr.hpp @ 16:2665513ce2d3

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