1 | #ifndef BOOST_SERIALIZATION_MAP_HPP |
---|
2 | #define BOOST_SERIALIZATION_MAP_HPP |
---|
3 | |
---|
4 | // MS compatible compilers support #pragma once |
---|
5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
---|
6 | # pragma once |
---|
7 | #endif |
---|
8 | |
---|
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
---|
10 | // serialization/map.hpp: |
---|
11 | // serialization for stl map templates |
---|
12 | |
---|
13 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
---|
14 | // Use, modification and distribution is subject to the Boost Software |
---|
15 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
16 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
17 | |
---|
18 | // See http://www.boost.org for updates, documentation, and revision history. |
---|
19 | |
---|
20 | #include <map> |
---|
21 | |
---|
22 | #include <boost/config.hpp> |
---|
23 | |
---|
24 | #include <boost/serialization/utility.hpp> |
---|
25 | #include <boost/serialization/collections_save_imp.hpp> |
---|
26 | #include <boost/serialization/collections_load_imp.hpp> |
---|
27 | #include <boost/serialization/split_free.hpp> |
---|
28 | |
---|
29 | namespace boost { |
---|
30 | namespace serialization { |
---|
31 | |
---|
32 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
33 | inline void save( |
---|
34 | Archive & ar, |
---|
35 | const std::map<Key, Type, Compare, Allocator> &t, |
---|
36 | const unsigned int /* file_version */ |
---|
37 | ){ |
---|
38 | boost::serialization::stl::save_collection< |
---|
39 | Archive, |
---|
40 | std::map<Key, Type, Compare, Allocator> |
---|
41 | >(ar, t); |
---|
42 | } |
---|
43 | |
---|
44 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
45 | inline void load( |
---|
46 | Archive & ar, |
---|
47 | std::map<Key, Type, Compare, Allocator> &t, |
---|
48 | const unsigned int /* file_version */ |
---|
49 | ){ |
---|
50 | boost::serialization::stl::load_collection< |
---|
51 | Archive, |
---|
52 | std::map<Key, Type, Compare, Allocator>, |
---|
53 | boost::serialization::stl::archive_input_unique< |
---|
54 | Archive, std::map<Key, Type, Compare, Allocator> >, |
---|
55 | boost::serialization::stl::no_reserve_imp<std::map< |
---|
56 | Key, Type, Compare, Allocator |
---|
57 | > |
---|
58 | > |
---|
59 | >(ar, t); |
---|
60 | } |
---|
61 | |
---|
62 | // split non-intrusive serialization function member into separate |
---|
63 | // non intrusive save/load member functions |
---|
64 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
65 | inline void serialize( |
---|
66 | Archive & ar, |
---|
67 | std::map<Key, Type, Compare, Allocator> &t, |
---|
68 | const unsigned int file_version |
---|
69 | ){ |
---|
70 | boost::serialization::split_free(ar, t, file_version); |
---|
71 | } |
---|
72 | |
---|
73 | // multimap |
---|
74 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
75 | inline void save( |
---|
76 | Archive & ar, |
---|
77 | const std::multimap<Key, Type, Compare, Allocator> &t, |
---|
78 | const unsigned int /* file_version */ |
---|
79 | ){ |
---|
80 | boost::serialization::stl::save_collection< |
---|
81 | Archive, |
---|
82 | std::multimap<Key, Type, Compare, Allocator> |
---|
83 | >(ar, t); |
---|
84 | } |
---|
85 | |
---|
86 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
87 | inline void load( |
---|
88 | Archive & ar, |
---|
89 | std::multimap<Key, Type, Compare, Allocator> &t, |
---|
90 | const unsigned int /* file_version */ |
---|
91 | ){ |
---|
92 | boost::serialization::stl::load_collection< |
---|
93 | Archive, |
---|
94 | std::multimap<Key, Type, Compare, Allocator>, |
---|
95 | boost::serialization::stl::archive_input_multi< |
---|
96 | Archive, std::multimap<Key, Type, Compare, Allocator> |
---|
97 | >, |
---|
98 | boost::serialization::stl::no_reserve_imp< |
---|
99 | std::multimap<Key, Type, Compare, Allocator> |
---|
100 | > |
---|
101 | >(ar, t); |
---|
102 | } |
---|
103 | |
---|
104 | // split non-intrusive serialization function member into separate |
---|
105 | // non intrusive save/load member functions |
---|
106 | template<class Archive, class Type, class Key, class Compare, class Allocator > |
---|
107 | inline void serialize( |
---|
108 | Archive & ar, |
---|
109 | std::multimap<Key, Type, Compare, Allocator> &t, |
---|
110 | const unsigned int file_version |
---|
111 | ){ |
---|
112 | boost::serialization::split_free(ar, t, file_version); |
---|
113 | } |
---|
114 | |
---|
115 | } // serialization |
---|
116 | } // namespace boost |
---|
117 | |
---|
118 | #endif // BOOST_SERIALIZATION_MAP_HPP |
---|