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 | // function specializations must be defined in the appropriate
|
---|
30 | // namespace - boost::serialization
|
---|
31 | #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
---|
32 | #define STD _STLP_STD
|
---|
33 | #else
|
---|
34 | #define STD std
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | namespace boost {
|
---|
38 | namespace serialization {
|
---|
39 |
|
---|
40 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
41 | inline void save(
|
---|
42 | Archive & ar,
|
---|
43 | const STD::map<Key, Type, Compare, Allocator> &t,
|
---|
44 | const unsigned int /* file_version */
|
---|
45 | ){
|
---|
46 | boost::serialization::stl::save_collection<
|
---|
47 | Archive,
|
---|
48 | STD::map<Key, Type, Compare, Allocator>
|
---|
49 | >(ar, t);
|
---|
50 | }
|
---|
51 |
|
---|
52 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
53 | inline void load(
|
---|
54 | Archive & ar,
|
---|
55 | STD::map<Key, Type, Compare, Allocator> &t,
|
---|
56 | const unsigned int /* file_version */
|
---|
57 | ){
|
---|
58 | boost::serialization::stl::load_collection<
|
---|
59 | Archive,
|
---|
60 | STD::map<Key, Type, Compare, Allocator>,
|
---|
61 | boost::serialization::stl::archive_input_map<
|
---|
62 | Archive, STD::map<Key, Type, Compare, Allocator> >,
|
---|
63 | boost::serialization::stl::no_reserve_imp<STD::map<
|
---|
64 | Key, Type, Compare, Allocator
|
---|
65 | >
|
---|
66 | >
|
---|
67 | >(ar, t);
|
---|
68 | }
|
---|
69 |
|
---|
70 | // split non-intrusive serialization function member into separate
|
---|
71 | // non intrusive save/load member functions
|
---|
72 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
73 | inline void serialize(
|
---|
74 | Archive & ar,
|
---|
75 | STD::map<Key, Type, Compare, Allocator> &t,
|
---|
76 | const unsigned int file_version
|
---|
77 | ){
|
---|
78 | boost::serialization::split_free(ar, t, file_version);
|
---|
79 | }
|
---|
80 |
|
---|
81 | // multimap
|
---|
82 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
83 | inline void save(
|
---|
84 | Archive & ar,
|
---|
85 | const STD::multimap<Key, Type, Compare, Allocator> &t,
|
---|
86 | const unsigned int /* file_version */
|
---|
87 | ){
|
---|
88 | boost::serialization::stl::save_collection<
|
---|
89 | Archive,
|
---|
90 | STD::multimap<Key, Type, Compare, Allocator>
|
---|
91 | >(ar, t);
|
---|
92 | }
|
---|
93 |
|
---|
94 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
95 | inline void load(
|
---|
96 | Archive & ar,
|
---|
97 | STD::multimap<Key, Type, Compare, Allocator> &t,
|
---|
98 | const unsigned int /* file_version */
|
---|
99 | ){
|
---|
100 | boost::serialization::stl::load_collection<
|
---|
101 | Archive,
|
---|
102 | STD::multimap<Key, Type, Compare, Allocator>,
|
---|
103 | boost::serialization::stl::archive_input_multimap<
|
---|
104 | Archive, STD::multimap<Key, Type, Compare, Allocator>
|
---|
105 | >,
|
---|
106 | boost::serialization::stl::no_reserve_imp<
|
---|
107 | STD::multimap<Key, Type, Compare, Allocator>
|
---|
108 | >
|
---|
109 | >(ar, t);
|
---|
110 | }
|
---|
111 |
|
---|
112 | // split non-intrusive serialization function member into separate
|
---|
113 | // non intrusive save/load member functions
|
---|
114 | template<class Archive, class Type, class Key, class Compare, class Allocator >
|
---|
115 | inline void serialize(
|
---|
116 | Archive & ar,
|
---|
117 | STD::multimap<Key, Type, Compare, Allocator> &t,
|
---|
118 | const unsigned int file_version
|
---|
119 | ){
|
---|
120 | boost::serialization::split_free(ar, t, file_version);
|
---|
121 | }
|
---|
122 |
|
---|
123 | } // serialization
|
---|
124 | } // namespace boost
|
---|
125 |
|
---|
126 | #undef STD
|
---|
127 |
|
---|
128 | #endif // BOOST_SERIALIZATION_MAP_HPP
|
---|