1 #ifndef BOOST_SERIALIZATION_HASH_MAP_HPP
2 #define BOOST_SERIALIZATION_HASH_MAP_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // serialization/hash_map.hpp:
11 // serialization for stl hash_map templates
13 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
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)
18 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <boost/config.hpp>
22 #include BOOST_HASH_MAP_HEADER
24 #include <boost/serialization/utility.hpp>
25 #include <boost/serialization/hash_collections_save_imp.hpp>
26 #include <boost/serialization/hash_collections_load_imp.hpp>
27 #include <boost/serialization/split_free.hpp>
28 #include <boost/serialization/detail/stack_constructor.hpp>
29 #include <boost/move/utility_core.hpp>
32 namespace serialization {
37 template<class Archive, class Container>
38 struct archive_input_hash_map
40 inline void operator()(
45 typedef typename Container::value_type type;
46 detail::stack_construct<Archive, type> t(ar, v);
47 // borland fails silently w/o full namespace
48 ar >> boost::serialization::make_nvp("item", t.reference());
49 std::pair<typename Container::const_iterator, bool> result =
50 s.insert(boost::move(t.reference()));
51 // note: the following presumes that the map::value_type was NOT tracked
52 // in the archive. This is the usual case, but here there is no way
55 ar.reset_object_address(
56 & (result.first->second),
57 & t.reference().second
64 template<class Archive, class Container>
65 struct archive_input_hash_multimap
67 inline void operator()(
72 typedef typename Container::value_type type;
73 detail::stack_construct<Archive, type> t(ar, v);
74 // borland fails silently w/o full namespace
75 ar >> boost::serialization::make_nvp("item", t.reference());
76 typename Container::const_iterator result
77 = s.insert(boost::move(t.reference()));
78 // note: the following presumes that the map::value_type was NOT tracked
79 // in the archive. This is the usual case, but here there is no way
81 ar.reset_object_address(
100 const BOOST_STD_EXTENSION_NAMESPACE::hash_map<
101 Key, T, HashFcn, EqualKey, Allocator
103 const unsigned int file_version
105 boost::serialization::stl::save_hash_collection<
107 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
108 Key, T, HashFcn, EqualKey, Allocator
123 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
124 Key, T, HashFcn, EqualKey, Allocator
126 const unsigned int file_version
128 boost::serialization::stl::load_hash_collection<
130 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
131 Key, T, HashFcn, EqualKey, Allocator
133 boost::serialization::stl::archive_input_hash_map<
135 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
136 Key, T, HashFcn, EqualKey, Allocator
142 // split non-intrusive serialization function member into separate
143 // non intrusive save/load member functions
152 inline void serialize(
154 BOOST_STD_EXTENSION_NAMESPACE::hash_map<
155 Key, T, HashFcn, EqualKey, Allocator
157 const unsigned int file_version
159 boost::serialization::split_free(ar, t, file_version);
173 const BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
174 Key, T, HashFcn, EqualKey, Allocator
176 const unsigned int file_version
178 boost::serialization::stl::save_hash_collection<
180 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
181 Key, T, HashFcn, EqualKey, Allocator
196 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
197 Key, T, HashFcn, EqualKey, Allocator
199 const unsigned int file_version
201 boost::serialization::stl::load_hash_collection<
203 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
204 Key, T, HashFcn, EqualKey, Allocator
206 boost::serialization::stl::archive_input_hash_multimap<
208 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
209 Key, T, HashFcn, EqualKey, Allocator
215 // split non-intrusive serialization function member into separate
216 // non intrusive save/load member functions
225 inline void serialize(
227 BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<
228 Key, T, HashFcn, EqualKey, Allocator
230 const unsigned int file_version
232 boost::serialization::split_free(ar, t, file_version);
235 } // namespace serialization
238 #endif // BOOST_HAS_HASH
239 #endif // BOOST_SERIALIZATION_HASH_MAP_HPP