1 #ifndef BOOST_SERIALIZATION_BOOST_SERIALIZATION_UNORDERED_MAP_HPP
2 #define BOOST_SERIALIZATION_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 T,
38 class HashFcn,
39 class EqualKey,
40 class Allocator
41 >
save(Archive & ar,const boost::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)42 inline void save(
43 Archive & ar,
44 const boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
45 const unsigned int /*file_version*/
46 ){
47 boost::serialization::stl::save_unordered_collection<
48 Archive,
49 boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator>
50 >(ar, t);
51 }
52
53 template<
54 class Archive,
55 class Key,
56 class T,
57 class HashFcn,
58 class EqualKey,
59 class Allocator
60 >
load(Archive & ar,boost::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)61 inline void load(
62 Archive & ar,
63 boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
64 const unsigned int /*file_version*/
65 ){
66 boost::serialization::stl::load_unordered_collection<
67 Archive,
68 boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator>,
69 boost::serialization::stl::archive_input_unordered_map<
70 Archive,
71 boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator>
72 >
73 >(ar, t);
74 }
75
76 // split non-intrusive serialization function member into separate
77 // non intrusive save/load member functions
78 template<
79 class Archive,
80 class Key,
81 class T,
82 class HashFcn,
83 class EqualKey,
84 class Allocator
85 >
serialize(Archive & ar,boost::unordered_map<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int file_version)86 inline void serialize(
87 Archive & ar,
88 boost::unordered_map<Key, T, HashFcn, EqualKey, Allocator> &t,
89 const unsigned int file_version
90 ){
91 boost::serialization::split_free(ar, t, file_version);
92 }
93
94 // unordered_multimap
95 template<
96 class Archive,
97 class Key,
98 class HashFcn,
99 class T,
100 class EqualKey,
101 class Allocator
102 >
save(Archive & ar,const boost::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)103 inline void save(
104 Archive & ar,
105 const boost::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator> &t,
106 const unsigned int /*file_version*/
107 ){
108 boost::serialization::stl::save_unordered_collection<
109 Archive,
110 boost::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>
111 >(ar, t);
112 }
113
114 template<
115 class Archive,
116 class Key,
117 class T,
118 class HashFcn,
119 class EqualKey,
120 class Allocator
121 >
load(Archive & ar,boost::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int)122 inline void load(
123 Archive & ar,
124 boost::unordered_multimap<
125 Key, T, HashFcn, EqualKey, Allocator
126 > &t,
127 const unsigned int /*file_version*/
128 ){
129 boost::serialization::stl::load_unordered_collection<
130 Archive,
131 boost::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>,
132 boost::serialization::stl::archive_input_unordered_multimap<
133 Archive,
134 boost::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator>
135 >
136 >(ar, t);
137 }
138
139 // split non-intrusive serialization function member into separate
140 // non intrusive save/load member functions
141 template<
142 class Archive,
143 class Key,
144 class T,
145 class HashFcn,
146 class EqualKey,
147 class Allocator
148 >
serialize(Archive & ar,boost::unordered_multimap<Key,T,HashFcn,EqualKey,Allocator> & t,const unsigned int file_version)149 inline void serialize(
150 Archive & ar,
151 boost::unordered_multimap<Key, T, HashFcn, EqualKey, Allocator> &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_BOOST_SERIALIZATION_UNORDERED_MAP_HPP
161