]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_SERIALIZATION_UNORDERED_SET_HPP |
2 | #define BOOST_SERIALIZATION_UNORDERED_SET_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 | // unordered_set.hpp: serialization for stl unordered_set templates | |
11 | ||
12 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . | |
13 | // (C) Copyright 2014 Jim Bell | |
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 <boost/config.hpp> | |
21 | ||
22 | #include <unordered_set> | |
23 | ||
24 | #include <boost/serialization/unordered_collections_save_imp.hpp> | |
25 | #include <boost/serialization/unordered_collections_load_imp.hpp> | |
26 | #include <boost/serialization/archive_input_unordered_set.hpp> | |
27 | #include <boost/serialization/split_free.hpp> | |
28 | ||
29 | namespace boost { | |
30 | namespace serialization { | |
31 | ||
32 | template< | |
33 | class Archive, | |
34 | class Key, | |
35 | class HashFcn, | |
36 | class EqualKey, | |
37 | class Allocator | |
38 | > | |
39 | inline void save( | |
40 | Archive & ar, | |
41 | const std::unordered_set< | |
42 | Key, HashFcn, EqualKey, Allocator | |
43 | > &t, | |
44 | const unsigned int /*file_version*/ | |
45 | ){ | |
46 | boost::serialization::stl::save_unordered_collection< | |
47 | Archive, | |
48 | std::unordered_set<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_set< | |
62 | Key, HashFcn, EqualKey, Allocator | |
63 | > &t, | |
64 | const unsigned int /*file_version*/ | |
65 | ){ | |
66 | boost::serialization::stl::load_unordered_collection< | |
67 | Archive, | |
68 | std::unordered_set<Key, HashFcn, EqualKey, Allocator>, | |
69 | stl::archive_input_unordered_set< | |
70 | Archive, | |
71 | std::unordered_set< | |
72 | Key, HashFcn, EqualKey, Allocator | |
73 | > | |
74 | > | |
75 | >(ar, t); | |
76 | } | |
77 | ||
78 | // split non-intrusive serialization function member into separate | |
79 | // non intrusive save/load member functions | |
80 | template< | |
81 | class Archive, | |
82 | class Key, | |
83 | class HashFcn, | |
84 | class EqualKey, | |
85 | class Allocator | |
86 | > | |
87 | inline void serialize( | |
88 | Archive & ar, | |
89 | std::unordered_set< | |
90 | Key, HashFcn, EqualKey, Allocator | |
91 | > &t, | |
92 | const unsigned int file_version | |
93 | ){ | |
94 | split_free(ar, t, file_version); | |
95 | } | |
96 | ||
97 | // unordered_multiset | |
98 | template< | |
99 | class Archive, | |
100 | class Key, | |
101 | class HashFcn, | |
102 | class EqualKey, | |
103 | class Allocator | |
104 | > | |
105 | inline void save( | |
106 | Archive & ar, | |
107 | const std::unordered_multiset< | |
108 | Key, HashFcn, EqualKey, Allocator | |
109 | > &t, | |
110 | const unsigned int /*file_version*/ | |
111 | ){ | |
112 | stl::save_unordered_collection< | |
113 | Archive, | |
114 | std::unordered_multiset<Key, HashFcn, EqualKey, Allocator> | |
115 | >(ar, t); | |
116 | } | |
117 | ||
118 | template< | |
119 | class Archive, | |
120 | class Key, | |
121 | class HashFcn, | |
122 | class EqualKey, | |
123 | class Allocator | |
124 | > | |
125 | inline void load( | |
126 | Archive & ar, | |
127 | std::unordered_multiset< | |
128 | Key, HashFcn, EqualKey, Allocator | |
129 | > &t, | |
130 | const unsigned int /*file_version*/ | |
131 | ){ | |
132 | boost::serialization::stl::load_unordered_collection< | |
133 | Archive, | |
134 | std::unordered_multiset<Key, HashFcn, EqualKey, Allocator>, | |
135 | boost::serialization::stl::archive_input_unordered_multiset< | |
136 | Archive, | |
137 | std::unordered_multiset<Key, HashFcn, EqualKey, Allocator> | |
138 | > | |
139 | >(ar, t); | |
140 | } | |
141 | ||
142 | // split non-intrusive serialization function member into separate | |
143 | // non intrusive save/load member functions | |
144 | template< | |
145 | class Archive, | |
146 | class Key, | |
147 | class HashFcn, | |
148 | class EqualKey, | |
149 | class Allocator | |
150 | > | |
151 | inline void serialize( | |
152 | Archive & ar, | |
153 | std::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t, | |
154 | const unsigned int file_version | |
155 | ){ | |
156 | boost::serialization::split_free(ar, t, file_version); | |
157 | } | |
158 | ||
159 | } // namespace serialization | |
160 | } // namespace boost | |
161 | ||
162 | #endif // BOOST_SERIALIZATION_UNORDERED_SET_HPP |