]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_SERIALIZATION_UNORDERED_MAP_HPP |
2 | #define BOOST_SERIALIZATION_UNORDERED_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/unordered_map.hpp: | |
11 | // serialization for stl unordered_map templates | |
12 | ||
13 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
14 | // (C) Copyright 2014 Jim Bell | |
15 | // Use, modification and distribution is subject to the Boost Software | |
16 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
17 | // http://www.boost.org/LICENSE_1_0.txt) | |
18 | ||
19 | // See http://www.boost.org for updates, documentation, and revision history. | |
20 | ||
21 | #include <boost/config.hpp> | |
22 | ||
23 | #include <unordered_map> | |
24 | ||
25 | #include <boost/serialization/utility.hpp> | |
26 | #include <boost/serialization/unordered_collections_save_imp.hpp> | |
27 | #include <boost/serialization/unordered_collections_load_imp.hpp> | |
28 | #include <boost/serialization/archive_input_unordered_map.hpp> | |
29 | #include <boost/serialization/split_free.hpp> | |
30 | ||
31 | namespace boost { | |
32 | namespace serialization { | |
33 | ||
34 | template< | |
35 | class Archive, | |
36 | class Key, | |
37 | class HashFcn, | |
38 | class EqualKey, | |
39 | class Allocator | |
40 | > | |
41 | inline void save( | |
42 | Archive & ar, | |
43 | const std::unordered_map<Key, HashFcn, EqualKey, Allocator> &t, | |
44 | const unsigned int /*file_version*/ | |
45 | ){ | |
46 | boost::serialization::stl::save_unordered_collection< | |
47 | Archive, | |
48 | std::unordered_map<Key, HashFcn, EqualKey, Allocator> | |
49 | >(ar, t); | |
50 | } | |
51 | ||
52 | template< | |
53 | class Archive, | |
54 | class Key, | |
55 | class HashFcn, | |
56 | class EqualKey, | |
57 | class Allocator | |
58 | > | |
59 | inline void load( | |
60 | Archive & ar, | |
61 | std::unordered_map<Key, HashFcn, EqualKey, Allocator> &t, | |
62 | const unsigned int /*file_version*/ | |
63 | ){ | |
64 | boost::serialization::stl::load_unordered_collection< | |
65 | Archive, | |
66 | std::unordered_map<Key, HashFcn, EqualKey, Allocator>, | |
67 | boost::serialization::stl::archive_input_unordered_map< | |
68 | Archive, | |
69 | std::unordered_map<Key, HashFcn, EqualKey, Allocator> | |
70 | > | |
71 | >(ar, t); | |
72 | } | |
73 | ||
74 | // split non-intrusive serialization function member into separate | |
75 | // non intrusive save/load member functions | |
76 | template< | |
77 | class Archive, | |
78 | class Key, | |
79 | class HashFcn, | |
80 | class EqualKey, | |
81 | class Allocator | |
82 | > | |
83 | inline void serialize( | |
84 | Archive & ar, | |
85 | std::unordered_map<Key, HashFcn, EqualKey, Allocator> &t, | |
86 | const unsigned int file_version | |
87 | ){ | |
88 | boost::serialization::split_free(ar, t, file_version); | |
89 | } | |
90 | ||
91 | // unordered_multimap | |
92 | template< | |
93 | class Archive, | |
94 | class Key, | |
95 | class HashFcn, | |
96 | class EqualKey, | |
97 | class Allocator | |
98 | > | |
99 | inline void save( | |
100 | Archive & ar, | |
101 | const std::unordered_multimap< | |
102 | Key, HashFcn, EqualKey, Allocator | |
103 | > &t, | |
104 | const unsigned int /*file_version*/ | |
105 | ){ | |
106 | boost::serialization::stl::save_unordered_collection< | |
107 | Archive, | |
108 | std::unordered_multimap<Key, HashFcn, EqualKey, Allocator> | |
109 | >(ar, t); | |
110 | } | |
111 | ||
112 | template< | |
113 | class Archive, | |
114 | class Key, | |
115 | class HashFcn, | |
116 | class EqualKey, | |
117 | class Allocator | |
118 | > | |
119 | inline void load( | |
120 | Archive & ar, | |
121 | std::unordered_multimap< | |
122 | Key, HashFcn, EqualKey, Allocator | |
123 | > &t, | |
124 | const unsigned int /*file_version*/ | |
125 | ){ | |
126 | boost::serialization::stl::load_unordered_collection< | |
127 | Archive, | |
128 | std::unordered_multimap< | |
129 | Key, HashFcn, EqualKey, Allocator | |
130 | >, | |
131 | boost::serialization::stl::archive_input_unordered_multimap< | |
132 | Archive, | |
133 | std::unordered_multimap<Key, HashFcn, EqualKey, Allocator> | |
134 | > | |
135 | >(ar, t); | |
136 | } | |
137 | ||
138 | // split non-intrusive serialization function member into separate | |
139 | // non intrusive save/load member functions | |
140 | template< | |
141 | class Archive, | |
142 | class Key, | |
143 | class HashFcn, | |
144 | class EqualKey, | |
145 | class Allocator | |
146 | > | |
147 | inline void serialize( | |
148 | Archive & ar, | |
149 | std::unordered_multimap< | |
150 | Key, HashFcn, EqualKey, Allocator | |
151 | > &t, | |
152 | const unsigned int file_version | |
153 | ){ | |
154 | boost::serialization::split_free(ar, t, file_version); | |
155 | } | |
156 | ||
157 | } // namespace serialization | |
158 | } // namespace boost | |
159 | ||
160 | #endif // BOOST_SERIALIZATION_UNORDERED_MAP_HPP |