]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/serialization/hash_set.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / serialization / hash_set.hpp
CommitLineData
7c673cae
FG
1#ifndef BOOST_SERIALIZATION_HASH_SET_HPP
2#define BOOST_SERIALIZATION_HASH_SET_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// hash_set.hpp: serialization for stl hash_set templates
11
f67539c2 12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
7c673cae
FG
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17// See http://www.boost.org for updates, documentation, and revision history.
18
19#include <boost/config.hpp>
20#ifdef BOOST_HAS_HASH
21#include BOOST_HASH_SET_HEADER
22
23#include <boost/serialization/hash_collections_save_imp.hpp>
24#include <boost/serialization/hash_collections_load_imp.hpp>
25#include <boost/serialization/split_free.hpp>
b32b8144 26#include <boost/move/utility_core.hpp>
7c673cae 27
f67539c2 28namespace boost {
7c673cae
FG
29namespace serialization {
30
31namespace stl {
32
33// hash_set input
34template<class Archive, class Container>
35struct archive_input_hash_set
36{
37 inline void operator()(
f67539c2
TL
38 Archive &ar,
39 Container &s,
7c673cae
FG
40 const unsigned int v
41 ){
42 typedef typename Container::value_type type;
43 detail::stack_construct<Archive, type> t(ar, v);
44 // borland fails silently w/o full namespace
45 ar >> boost::serialization::make_nvp("item", t.reference());
f67539c2 46 std::pair<typename Container::const_iterator, bool> result =
b32b8144 47 s.insert(boost::move(t.reference()));
7c673cae
FG
48 if(result.second)
49 ar.reset_object_address(& (* result.first), & t.reference());
50 }
51};
52
53// hash_multiset input
54template<class Archive, class Container>
55struct archive_input_hash_multiset
56{
57 inline void operator()(
f67539c2
TL
58 Archive &ar,
59 Container &s,
7c673cae
FG
60 const unsigned int v
61 ){
62 typedef typename Container::value_type type;
63 detail::stack_construct<Archive, type> t(ar, v);
64 // borland fails silently w/o full namespace
65 ar >> boost::serialization::make_nvp("item", t.reference());
f67539c2 66 typename Container::const_iterator result
b32b8144 67 = s.insert(boost::move(t.reference()));
7c673cae
FG
68 ar.reset_object_address(& (* result), & t.reference());
69 }
70};
71
72} // stl
73
74template<
f67539c2
TL
75 class Archive,
76 class Key,
77 class HashFcn,
7c673cae
FG
78 class EqualKey,
79 class Allocator
80>
81inline void save(
82 Archive & ar,
83 const BOOST_STD_EXTENSION_NAMESPACE::hash_set<
84 Key, HashFcn, EqualKey, Allocator
85 > &t,
86 const unsigned int file_version
87){
88 boost::serialization::stl::save_hash_collection<
f67539c2 89 Archive,
7c673cae
FG
90 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
91 Key, HashFcn, EqualKey, Allocator
f67539c2 92 >
7c673cae
FG
93 >(ar, t);
94}
95
96template<
f67539c2
TL
97 class Archive,
98 class Key,
99 class HashFcn,
7c673cae
FG
100 class EqualKey,
101 class Allocator
102>
103inline void load(
104 Archive & ar,
105 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
106 Key, HashFcn, EqualKey, Allocator
107 > &t,
108 const unsigned int file_version
109){
110 boost::serialization::stl::load_hash_collection<
111 Archive,
112 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
113 Key, HashFcn, EqualKey, Allocator
114 >,
115 boost::serialization::stl::archive_input_hash_set<
f67539c2 116 Archive,
7c673cae
FG
117 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
118 Key, HashFcn, EqualKey, Allocator
119 >
120 >
121 >(ar, t);
122}
123
124// split non-intrusive serialization function member into separate
125// non intrusive save/load member functions
126template<
f67539c2
TL
127 class Archive,
128 class Key,
129 class HashFcn,
7c673cae
FG
130 class EqualKey,
131 class Allocator
132>
133inline void serialize(
134 Archive & ar,
135 BOOST_STD_EXTENSION_NAMESPACE::hash_set<
136 Key, HashFcn, EqualKey, Allocator
137 > &t,
138 const unsigned int file_version
139){
140 boost::serialization::split_free(ar, t, file_version);
141}
142
143// hash_multiset
144template<
f67539c2
TL
145 class Archive,
146 class Key,
147 class HashFcn,
7c673cae
FG
148 class EqualKey,
149 class Allocator
150>
151inline void save(
152 Archive & ar,
153 const BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
154 Key, HashFcn, EqualKey, Allocator
155 > &t,
156 const unsigned int file_version
157){
158 boost::serialization::stl::save_hash_collection<
f67539c2 159 Archive,
7c673cae
FG
160 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
161 Key, HashFcn, EqualKey, Allocator
f67539c2 162 >
7c673cae
FG
163 >(ar, t);
164}
165
166template<
f67539c2
TL
167 class Archive,
168 class Key,
169 class HashFcn,
7c673cae
FG
170 class EqualKey,
171 class Allocator
172>
173inline void load(
174 Archive & ar,
175 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
176 Key, HashFcn, EqualKey, Allocator
177 > &t,
178 const unsigned int file_version
179){
180 boost::serialization::stl::load_hash_collection<
181 Archive,
182 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
183 Key, HashFcn, EqualKey, Allocator
184 >,
185 boost::serialization::stl::archive_input_hash_multiset<
186 Archive,
187 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
188 Key, HashFcn, EqualKey, Allocator
f67539c2 189 >
7c673cae
FG
190 >
191 >(ar, t);
192}
193
194// split non-intrusive serialization function member into separate
195// non intrusive save/load member functions
196template<
f67539c2
TL
197 class Archive,
198 class Key,
199 class HashFcn,
7c673cae
FG
200 class EqualKey,
201 class Allocator
202>
203inline void serialize(
204 Archive & ar,
205 BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<
206 Key, HashFcn, EqualKey, Allocator
207 > & t,
208 const unsigned int file_version
209){
210 boost::serialization::split_free(ar, t, file_version);
211}
212
213} // namespace serialization
214} // namespace boost
215
216#include <boost/serialization/collection_traits.hpp>
217
218BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_set)
219BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_multiset)
220
221#endif // BOOST_HAS_HASH
222#endif // BOOST_SERIALIZATION_HASH_SET_HPP