1 | #ifndef BOOST_SERIALIZATION_DEQUE_HPP |
2 | #define BOOST_SERIALIZATION_DEQUE_HPP |
3 | |
4 | // MS compatible compilers support #pragma once |
5 | #if defined(_MSC_VER) |
6 | # pragma once |
7 | #endif |
8 | |
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
10 | // deque.hpp |
11 | |
12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
13 | // Use, modification and distribution is subject to the Boost Software |
14 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
15 | // http://www.boost.org/LICENSE_1_0.txt) |
16 | |
17 | // See http://www.boost.org for updates, documentation, and revision history. |
18 | |
19 | #include <deque> |
20 | |
21 | #include <boost/config.hpp> |
22 | |
23 | #include <boost/archive/basic_archive.hpp> |
24 | |
25 | #include <boost/serialization/collections_save_imp.hpp> |
26 | #include <boost/serialization/collections_load_imp.hpp> |
27 | #include <boost/serialization/detail/stack_constructor.hpp> |
28 | #include <boost/serialization/split_free.hpp> |
29 | |
30 | namespace boost { |
31 | namespace serialization { |
32 | |
33 | template<class Archive, class U, class Allocator> |
34 | inline void save( |
35 | Archive & ar, |
36 | const std::deque<U, Allocator> &t, |
37 | const unsigned int /* file_version */ |
38 | ){ |
39 | boost::serialization::stl::save_collection< |
40 | Archive, std::deque<U, Allocator> |
41 | >(ar, t); |
42 | } |
43 | |
44 | template<class Archive, class U, class Allocator> |
45 | inline void load( |
46 | Archive & ar, |
47 | std::deque<U, Allocator> &t, |
48 | const unsigned int /* file_version */ |
49 | ){ |
50 | const boost::archive::library_version_type library_version( |
51 | ar.get_library_version() |
52 | ); |
53 | // retrieve number of elements |
54 | item_version_type item_version(0); |
55 | collection_size_type count; |
56 | ar >> BOOST_SERIALIZATION_NVP(count); |
57 | if(boost::archive::library_version_type(3) < library_version){ |
58 | ar >> BOOST_SERIALIZATION_NVP(item_version); |
59 | } |
60 | stl::collection_load_impl(ar, t, count, item_version); |
61 | } |
62 | |
63 | // split non-intrusive serialization function member into separate |
64 | // non intrusive save/load member functions |
65 | template<class Archive, class U, class Allocator> |
66 | inline void serialize( |
67 | Archive & ar, |
68 | std::deque<U, Allocator> &t, |
69 | const unsigned int file_version |
70 | ){ |
71 | boost::serialization::split_free(ar, t, file_version); |
72 | } |
73 | |
74 | } // namespace serialization |
75 | } // namespace boost |
76 | |
77 | #include <boost/serialization/collection_traits.hpp> |
78 | |
79 | BOOST_SERIALIZATION_COLLECTION_TRAITS(std::deque) |
80 | |
81 | #endif // BOOST_SERIALIZATION_DEQUE_HPP |
82 | |