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 <boost/unordered_map.hpp> |
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 boost::unordered_map<Key, HashFcn, EqualKey, Allocator> &t, |
44 | const unsigned int /*file_version*/ |
45 | ){ |
46 | boost::serialization::stl::save_unordered_collection< |
47 | Archive, |
48 | boost::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 | boost::unordered_map<Key, HashFcn, EqualKey, Allocator> &t, |
62 | const unsigned int /*file_version*/ |
63 | ){ |
64 | boost::serialization::stl::load_unordered_collection< |
65 | Archive, |
66 | boost::unordered_map<Key, HashFcn, EqualKey, Allocator>, |
67 | boost::serialization::stl::archive_input_unordered_map< |
68 | Archive, |
69 | boost::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 | boost::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 boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> &t, |
102 | const unsigned int /*file_version*/ |
103 | ){ |
104 | boost::serialization::stl::save_unordered_collection< |
105 | Archive, |
106 | boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> |
107 | >(ar, t); |
108 | } |
109 | |
110 | template< |
111 | class Archive, |
112 | class Key, |
113 | class HashFcn, |
114 | class EqualKey, |
115 | class Allocator |
116 | > |
117 | inline void load( |
118 | Archive & ar, |
119 | boost::unordered_multimap< |
120 | Key, HashFcn, EqualKey, Allocator |
121 | > &t, |
122 | const unsigned int /*file_version*/ |
123 | ){ |
124 | boost::serialization::stl::load_unordered_collection< |
125 | Archive, |
126 | boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator>, |
127 | boost::serialization::stl::archive_input_unordered_multimap< |
128 | Archive, |
129 | boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> |
130 | > |
131 | >(ar, t); |
132 | } |
133 | |
134 | // split non-intrusive serialization function member into separate |
135 | // non intrusive save/load member functions |
136 | template< |
137 | class Archive, |
138 | class Key, |
139 | class HashFcn, |
140 | class EqualKey, |
141 | class Allocator |
142 | > |
143 | inline void serialize( |
144 | Archive & ar, |
145 | boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> &t, |
146 | const unsigned int file_version |
147 | ){ |
148 | boost::serialization::split_free(ar, t, file_version); |
149 | } |
150 | |
151 | } // namespace serialization |
152 | } // namespace boost |
153 | |
154 | #endif // BOOST_SERIALIZATION_UNORDERED_MAP_HPP |
155 | |