Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:31:00

0001 #ifndef BOOST_SERIALIZATION_LIST_HPP
0002 #define BOOST_SERIALIZATION_LIST_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // list.hpp: serialization for stl list templates
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
0018 
0019 #include <list>
0020 
0021 #include <boost/config.hpp>
0022 
0023 #include <boost/serialization/collections_save_imp.hpp>
0024 #include <boost/serialization/collections_load_imp.hpp>
0025 
0026 #include <boost/serialization/access.hpp>
0027 #include <boost/serialization/nvp.hpp>
0028 #include <boost/serialization/collection_size_type.hpp>
0029 #include <boost/serialization/item_version_type.hpp>
0030 #include <boost/serialization/library_version_type.hpp>
0031 #include <boost/serialization/split_free.hpp>
0032 
0033 namespace boost {
0034 namespace serialization {
0035 
0036 template<class Archive, class U, class Allocator>
0037 inline void save(
0038     Archive & ar,
0039     const std::list<U, Allocator> &t,
0040     const unsigned int /* file_version */
0041 ){
0042     boost::serialization::stl::save_collection<
0043         Archive,
0044         std::list<U, Allocator>
0045     >(ar, t);
0046 }
0047 
0048 template<class Archive, class U, class Allocator>
0049 inline void load(
0050     Archive & ar,
0051     std::list<U, Allocator> &t,
0052     const unsigned int /* file_version */
0053 ){
0054     const boost::serialization::library_version_type library_version(
0055         ar.get_library_version()
0056     );
0057     // retrieve number of elements
0058     item_version_type item_version(0);
0059     collection_size_type count;
0060     ar >> BOOST_SERIALIZATION_NVP(count);
0061     if(boost::serialization::library_version_type(3) < library_version){
0062         ar >> BOOST_SERIALIZATION_NVP(item_version);
0063     }
0064     stl::collection_load_impl(ar, t, count, item_version);
0065 }
0066 
0067 // split non-intrusive serialization function member into separate
0068 // non intrusive save/load member functions
0069 template<class Archive, class U, class Allocator>
0070 inline void serialize(
0071     Archive & ar,
0072     std::list<U, Allocator> & t,
0073     const unsigned int file_version
0074 ){
0075     boost::serialization::split_free(ar, t, file_version);
0076 }
0077 
0078 } // serialization
0079 } // namespace boost
0080 
0081 #include <boost/serialization/collection_traits.hpp>
0082 
0083 BOOST_SERIALIZATION_COLLECTION_TRAITS(std::list)
0084 
0085 #endif // BOOST_SERIALIZATION_LIST_HPP